Skip to content

Commit 9e30eed

Browse files
authored
fix: reconcile engine, TUI, Tower and Remote Control fixes (#377)
## Requirement or Bug A set of fixes and features across the engine, TUI, gateway, Tower, Remote Control and the VS Code extension. ## Bug Reproduction Steps Each fix has a regression test. The main ones: - Re-import a provider registry with `pythinker provider` → the default model and provider are cleared. - Cancel a background agent → the TUI does not show it as stopped. - Resume a session that used image or video tools → the media tools are gone. - Fork a subagent → its request prefix differs from the parent, so the prompt cache misses. - Press Ctrl+C while shutdown hooks run → no progress, no forced exit. - Remote Control response over 10 MiB → rejected. ## Root Cause Each commit fixes its own root cause; see the commit messages. All are fundamental fixes, not workarounds. ## Code Changes 32 commits, one per change, so they can be reviewed one at a time: - **Engine (`agent-core-v2`)**: mid-turn progress notes and calmer NotifyUser nudges, media tools restored after resume, fork subagent prefix parity (plus a prompt-cache probe that reports it), `PYTHINKER_CODE_LLM_HEADERS_TIMEOUT_MS`, `select_tools` explanations, plugin skills under qualified names, `[mcp] default_deferred`, a todo-list nudge, subagent tool descriptions that match what the subagent can use, model migration metadata from provider registries. - **Tower (experimental)**: missions are merged and reviewed through deterministic git checks; new `TowerComplete` and `TowerRebase` tools; a bash guard blocks destructive commands in the main checkout; `tower.base` state is removed. - **TUI / CLI**: Working… spinner label, shutdown progress with forced exit on a second Ctrl+C, inline skill-prompt tokens and steering, the previous answer stays visible after task-notification turns, the git-status footer no longer blocks (chokidar watcher), command lookup skips workspace binaries instead of failing, cumulative survey turn counts. - **Gateway**: agent hooks run in the session's working directory. - **Remote Control**: `pythinker web` exits when the relay takes the device offline; responses over 10 MiB are sent as 5 MiB `response_chunk` frames (up to about 100 MiB), and a relay `abort` cancels a transfer. The relay already accepts `response_chunk` frames (deployed before this merges). - **Providers**: Gemini 4 uses thinking levels; "off" maps to LOW. - **Removed**: the unused `packages/pyaos` package, the never-implemented MCP `executor = "pyaos"` option (and its `"kaos"` alias), the SDK `pyaos` session options and RPCs, and the `ssh2` overrides. `flake.nix` workspace lists and the `pnpmDeps` hash are updated. - **VS Code**: Back navigation in multi-question AskUserQuestion prompts. - **Docs**: Tower guide, NotifyUser, MCP "Loading tools on demand", provider registry upgrade metadata. ## Behavior Changes and Affected Users | Behavior | Before | After | Who relies on the old behavior | Escape hatch | |---|---|---|---|---| | Plugin skill invocation by bare name | `/skill:review` ran a plugin's `review` skill | Only `/skill:<plugin-id>:review` runs it | Users, saved prompts and scripts that call plugin skills by short name | None (maintainer sign-off below); use the qualified name | | Plugin name validation | Lowercase only | Uppercase, dots and an `@` suffix allowed | Nobody (it only widens accepted input) | n/a | | MCP stdio `executor = "pyaos"` / `"kaos"` | Accepted (`kaos` normalized to `pyaos`), never implemented | Config fails validation at load time | Configs that set it; it never had any effect | Remove the key | | SDK `pyaos` / `persistencePyaos` session options | Accepted and ignored | Stripped before the RPC; the `*WithPyaos` RPCs are gone | SDK hosts that pass them (still ignored, no crash) | n/a | | Agent hook working directory (web/desktop) | Gateway process cwd | Session working directory | Hook scripts that assumed the gateway cwd | Use absolute paths in the hook | | Command lookup finds a binary inside the workspace | Lookup failed | Binary skipped; search continues on PATH; also when cwd is `/` | Nobody relied on the failure | n/a | | Tower shell in the main checkout | Any command allowed | Destructive commands blocked | Tower users (experimental flag) | Tower is off unless `PYTHINKER_CODE_EXPERIMENTAL_TOWER=1` | | `tower_mode.enter` records with `base` | `base` stored in `tower.base` | Field dropped on replay (zod strips unknown keys) | Sessions that entered Tower before this change | Resume works; verified | | Default model when a registry retires it | Kept the retired model | Switches to the declared replacement and shows migration notes | Users whose default model the registry retires | None | | Registry re-import | Cleared default model and provider | Keeps them | Nobody | n/a | | Remote Control response > 10 MiB | Rejected | Sent in chunks up to about 100 MiB | Relays without `response_chunk` support (ours is updated) | n/a | | `pythinker web` when the relay takes the device offline | Kept running | Exits | Users who expected it to keep serving locally | None | | Gemini 4 thinking | Thinking budget | Thinking level; off → LOW | Gemini 4 users | n/a | | MCP deferred loading | Per-server `deferred` only | Plus global `[mcp] default_deferred` (needs tool-select flag) | Nobody (default off) | n/a | | Prompt text: NotifyUser / progress notes | Discouraged short notes between tool calls | Allows them; reminders counted per round of tool calls | Every session | n/a | | Prompt text: todo nudge | No nudge | Reminder when todo items stay open for several steps | Every session with a todo list | n/a | | Prompt text: subagent tool descriptions | Listed tools the subagent could not use | Lists only available tools | Sessions that spawn subagents | n/a | **Maintainer sign-off needed:** the plugin-skill bare-name removal has no escape hatch. Approved by the maintainer for this PR. **Contract files touched and their consumers:** - `config-manifest.toml`: new `[mcp] default_deferred`, new registry `upgrade` object. Additive; old configs load unchanged. - `state-manifest.d.ts`: `tower.base` removed, `llmRequester.lastTurnRequest` added. Old journals replay (unknown key dropped). - `wire-manifest.d.ts`: `tower_mode.enter` drops `base`. Older records still parse. - `features/externalHooks/`: hook cwd change above. - `apps/pythinker-code/src/cli/`: `provider` refresh now goes through the engine; `web` exits on relay offline. - `packages/node-sdk`: `pyaos` options and RPCs removed (SDK is internal; the CLI is the only published consumer). **Tests:** every row above has a test in the touched package. Full gates: build, typecheck, lint, sherif, all tests, VS Code typecheck and tests, Nix workspace check, web bundle check, `nix build .#pythinker-code`. ## Checklist - [x] I have read the [CONTRIBUTING](https://github.com/PyModel/pythinker-code/blob/main/CONTRIBUTING.md) document. - [ ] I have linked a related issue (external PRs: issue must have a maintainer's `/approve`). - [x] I have added tests that prove my feature works. - [x] The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR. - [x] Ran `gen-changesets` skill, or this PR needs no changeset. - [x] Ran `gen-docs` skill, or this PR needs no doc update.
1 parent e1791a6 commit 9e30eed

376 files changed

Lines changed: 20919 additions & 14122 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/gen-changesets/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Use when generating changesets in the pythinker-code repository —
55

66
# Generate Changesets
77

8-
The only user-facing published package is the CLI: `@pymodel/pythinker-code`. All other `@pymodel/*` packages (sdk, agent-core, kosong, pyaos, oauth, telemetry, and so on) are internal.
8+
The only user-facing published package is the CLI: `@pymodel/pythinker-code`. All other `@pymodel/*` packages (sdk, agent-core, kosong, oauth, telemetry, and so on) are internal.
99

1010
## 1. Whether to Write
1111

‎.changeset/calm-progress-nudges.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@pymodel/pythinker-code": patch
3+
---
4+
5+
Stop discouraging short progress notes between tool calls, and count NotifyUser reminders per round of tool calls.

‎.changeset/cancel-video-uploads.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@pymodel/pythinker-code": patch
3+
---
4+
5+
Cancel in-flight video uploads when a media read is interrupted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@pymodel/pythinker-code": patch
3+
---
4+
5+
Skip executables inside the workspace during command lookup instead of failing, including when the working directory is the filesystem root.

‎.changeset/footer-git-refresh.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@pymodel/pythinker-code": patch
3+
---
4+
5+
Stop the footer from waiting on git status; it now refreshes when the repository changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@pymodel/pythinker-code": patch
3+
---
4+
5+
Keep forked subagent requests on the same prefix as the parent so they reuse the prompt cache.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@pymodel/pythinker-code": patch
3+
---
4+
5+
Use thinking levels for Gemini 4 models, and send the lowest level when thinking is off.

‎.changeset/hooks-session-cwd.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@pymodel/pythinker-code": patch
3+
---
4+
5+
Run agent hooks in the session's working directory in the web and desktop apps.

‎.changeset/inline-skill-prompts.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@pymodel/pythinker-code": patch
3+
---
4+
5+
Show skills invoked in a prompt as highlighted tokens in the message, and let Ctrl+S steer a skill prompt into a running turn.

‎.changeset/llm-headers-timeout.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@pymodel/pythinker-code": patch
3+
---
4+
5+
Add PYTHINKER_CODE_LLM_HEADERS_TIMEOUT_MS to set how long a request waits for LLM response headers, for slow non-streaming thinking.

0 commit comments

Comments
 (0)