Repository navigation
fix(system-agent): make exit-and-run-a-terminal guidance surface-correct - #114633
Conversation
|
Codex review: found issues before merge. Reviewed July 31, 2026, 2:45 PM ET / 18:45 UTC. ClawSweeper reviewWhat this changesThe branch rewrites static system-agent recovery guidance and related tests so Control UI and app users are directed to Settings or commands on the OpenClaw host, and it also adds a changelog entry. Merge readinessKeep this PR open for maintainer review. It is a well-proven, bounded repair for static system-agent replies, but it adds a release-owned Priority: P1 Review scores
Verification
How this fits togetherThe system agent handles setup and recovery requests arriving through the Control UI, TUI, and remote-message rescue paths. It either hands the user to an in-product Settings flow or explains the host-side command needed to repair configuration or inference. flowchart LR
A[User setup request] --> B[System agent]
B --> C{Interaction surface}
C --> D[Settings handoff]
C --> E[Host-side recovery guidance]
D --> F[Control UI or app]
E --> G[OpenClaw host command]
G --> H[Recovered configuration]
Decision needed
Why: The unchanged prompt lines affect the same user-facing guidance but changing them alters model behavior and snapshot-controlled prompt text; the repository's protected maintainer label also requires explicit human handling. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +60, Docs +1. Total +61 across 15 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the static-reply repair, remove the release-owned changelog edit, and explicitly choose whether the remaining model-generated guidance is a separately owned follow-up or must be included before landing. Do we have a high-confidence way to reproduce the issue? Yes for the static reply: current main's gateway setup branch contains the terminal-only wording, and the PR provides before/after proof through the real browser RPC path. The broader model-generated wording gap is source-proven but was not independently run in this review. Is this the best way to solve the issue? No, not as a complete solution to surface-correct system-agent guidance: the static-copy repair is appropriate, but the model-facing directives remain unchanged and need an explicit maintainer scope decision. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 36b80ada3cea. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
75e1a37 to
4eea3af
Compare
|
/clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
/clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
/clawsweeper re-review |
1 similar comment
|
/clawsweeper re-review |
The startup action line in overview.ts is reachable only from the TUI: the gateway path overwrites defaultModel in chat-engine.ts loadOverview, and server-methods/system-agent.ts returns UNAVAILABLE before the greeting is ever computed. Its original text also never said 'exit' or 'in a terminal', so it was never in scope for browser-safe guidance.
Four strings described where work happens instead of telling the reader what to do. Match the imperative shape the other ten already use.
05fb543 to
566c23b
Compare
|
Merged via squash.
|
* origin/main: fix(test/ui): prevent shared history pollution (openclaw#117348) fix(openrouter): apply image request transport policy (openclaw#117336) perf(gateway): skip clean transcript workers (openclaw#117342) test(testing): assert relay smoke readiness fix(testing): activate relay live smoke transport feat(channels): record account lifecycle facts and retire inferred health vocabularies (openclaw#117300) fix(canvas): remove unsupported snapshot delay hint (openclaw#117326) refactor(agents): fold cache TTL pruning into prompt projection (openclaw#117313) fix(canvas): honor paired-node invocation deadlines (openclaw#117316) fix(system-agent): make exit-and-run-a-terminal guidance surface-correct (openclaw#114633) fix(ai): assistant text blocks are run together on replay (openclaw#115743) refactor(agents): canonicalize subagent execution state (openclaw#117267)
…ect (openclaw#114633) * fix(system-agent): make exit-and-run-a-terminal guidance surface-correct * fix(system-agent): drop out-of-scope overview startup copy change The startup action line in overview.ts is reachable only from the TUI: the gateway path overwrites defaultModel in chat-engine.ts loadOverview, and server-methods/system-agent.ts returns UNAVAILABLE before the greeting is ever computed. Its original text also never said 'exit' or 'in a terminal', so it was never in scope for browser-safe guidance. * fix(system-agent): make recovery copy imperative, not descriptive Four strings described where work happens instead of telling the reader what to do. Match the imperative shape the other ten already use. * fix(system-agent): preserve host recovery lifecycle * fix(system-agent): keep final recovery wording * test(system-agent): repair rebased suite boundary * fix(system-agent): restore onboarding host lifecycle * docs(changelog): note system-agent recovery guidance
* origin/main: fix(test/ui): prevent shared history pollution (openclaw#117348) fix(openrouter): apply image request transport policy (openclaw#117336) perf(gateway): skip clean transcript workers (openclaw#117342) test(testing): assert relay smoke readiness fix(testing): activate relay live smoke transport feat(channels): record account lifecycle facts and retire inferred health vocabularies (openclaw#117300) fix(canvas): remove unsupported snapshot delay hint (openclaw#117326) refactor(agents): fold cache TTL pruning into prompt projection (openclaw#117313) fix(canvas): honor paired-node invocation deadlines (openclaw#117316) fix(system-agent): make exit-and-run-a-terminal guidance surface-correct (openclaw#114633) fix(ai): assistant text blocks are run together on replay (openclaw#115743) refactor(agents): canonicalize subagent execution state (openclaw#117267)
New behavior
Someone talking to the system agent from the Control UI in a browser (or the macOS app) is no longer given "exit OpenClaw and run a terminal command" as their only way forward. That instruction is unfollowable there: closing a browser tab does not exit OpenClaw, and the process is usually running on another machine entirely, so the reader was left with no next step at all.
Recovery guidance now names where the command runs rather than telling the reader to leave. A terminal user reads the same sentence and is unaffected — they are already on that machine, at a shell.
Nothing changed about what the system agent executes, refuses, or permits. This is copy only.
The clearest case is the setup request, which is the one place the gateway already had a real in-product answer and simply led with the wrong one:
Before — points at Settings, then sends the reader to a terminal:
Now — leads with the screens that exist, and locates the command instead of demanding an exit:
The same reframing applies to the model-setup, doctor-repair, plugin-removal, config-write and inference-unavailable replies, which previously all opened with "Exit OpenClaw and…".
Why this is not a
surfaceflagOnly one message had a genuine per-surface answer, and it was already branching on
surface === "gateway"— that branch was improved, not added.Everywhere else the honest fix is a sentence that is true on every surface. Threading
surfacethrough the rest would mean touching all 34 construction sites ofSystemAgentInferenceUnavailableErrorand reshaping a module-level constant, to end up with two variants of copy that a browser reader and a terminal reader can both already read correctly. The wording change carries the same information at net zero production lines.How to verify
The gateway reply is exercised through the engine, not just asserted as a string.
src/system-agent/chat-engine.test.ts:1136drives both surfaces in one test:SystemAgentChatEnginewithsurface: "gateway"(:1150).engine.handle("open setup wizard")(:1151), which routes through the realopen-setupoperation path.Settingsand must not containExit OpenClaw(:1156-1157).The terminal surface is protected by assertions that were deliberately left untouched and still pass: the CLI half of that same test (
:1142-1148) and:1386-1400, both of which still requirerun \openclaw onboard`from the CLI branch atchat-engine.ts:918. That branch sits behind thesurface === "gateway"` early return and was not edited.To check by hand on the gateway surface: open the Control UI, ask the system agent to change your model or open setup, and confirm the reply points at Settings and locates
openclaw onboardrather than instructing you to exit.Browser proof
Captured against a real loopback gateway serving the real Control UI, with a working inference route, by sending
open setup wizardover the sameopenclaw.chatRPC the browser uses. The only thing changed between the two runs wassrc/system-agent/chat-engine.ts, swapped between the PR base commitd2dc61cddfcand this branch, with a full rebuild each time.Before — base commit
d2dc61cddfcWhat this shows: the reply a browser reader received before this PR. "use Settings" is present but subordinate, and the sentence still ends by sending the reader to a terminal they may not have.
State:
/custodianon a loopback Control UI, gateway built fromd2dc61cddfc, assistant bubble element crop at a 1280x860 viewport. Cropped to the bubble because the surrounding chat chrome is unchanged and adds nothing to the claim.Now — this branch
What this shows: the same request on the same surface now leads with the in-product path and names where the command runs, so the reader always has a step they can actually take.
State: identical instance, route, and viewport; only
src/system-agent/chat-engine.tsdiffers.In both captures
openclaw onboardrenders as inline code, confirming the string survives the markdown pipeline into the browser intact.That run also empirically confirms the
defaultModeloverride described under Implementation notes: the same session's greeting readsModel: local-cli-proxy/claude-sonnet-4-6, neverInference is unavailable, becausechat-engine.ts:1001had already replaced it.Checks
chat-engine,operations,operations.setup,operations.tui,rescue-message: 176 tests, 3 shards, exit 0.oxfmt --checkclean on the touched sources.pnpm check:changedresolved to thecoreandcoreTestslanes and passed.check-prompt-snapshotsis green, which independently confirms no model-facing prompt text was touched.Implementation notes
One string was examined and deliberately reverted.
formatStartupActioninsrc/system-agent/overview.tslooks like the browser's "inference is unavailable" greeting, and an earlier revision of this PR changed it on that basis. It is not:src/system-agent/chat-engine.ts:1001returns{ ...overview, defaultModel: verifiedRoute.modelLabel }unconditionally, so on the gateway pathdefaultModelis always set and the!overview.defaultModelbranch cannot be taken;loadOverviewForTui(src/system-agent/tui-backend.ts:86-91), which uses the raw loader with no override — so the line is terminal-only.Its original text also never said "exit" or "in a terminal", so it was never in scope. It is back at its base state.
Two guard phrasings were left alone on purpose.
plugin-install.ts:16and the$include/env/secretsentries inconfig-write-policy.tssay "in a trusted shell". That is a statement about a human-only security boundary, not surface guidance; softening it would weaken a guard rather than clarify a path.Known gap
Model-generated prose is still not surface-correct.
src/system-agent/assistant-prompts.ts:72,125andsrc/agents/tools/system-agent-tool.ts:393,398still instruct the model to "Tell the user to exit OpenClaw and runopenclaw onboard", so a browser reader can still see that phrasing in sentences the model writes freshly. Both were left untouched deliberately — the first is prompt text behind thecheck-prompt-snapshotsgate, and the second is the same category outsidesrc/system-agent/**. Making those directives surface-aware is a behavior change (options.surfaceis already available atsystem-agent-tool.ts:459) and wants its own issue and owner review.