Repository navigation
fix(agents): route CLI bootstrap truncation notice into the system prompt - #130325
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 5:46 PM ET / 21:46 UTC. ClawSweeper reviewWhat this changesThe PR moves CLI bootstrap-truncation guidance from each user turn into the shared system prompt and refreshes first-only resumed CLI sessions when truncation begins or ends. Merge readinessKeep open. Current main still appends the detailed truncation warning to CLI turn prompts; this branch moves it through the existing shared system-prompt path and adds session-drift handling. No blocking source defect surfaced, but the documented one-time soft resume for existing bindings remains a merge-visible session-state change. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe CLI agent runner analyzes truncated workspace bootstrap files while preparing a run, then supplies a system prompt and a user-turn prompt to a configured CLI backend. Transcript-facing surfaces render the turn prompt, so routing the notice through the system prompt keeps diagnostic guidance out of user chat bubbles. flowchart LR
A[Workspace bootstrap files] --> B[Bootstrap budget analysis]
B --> C[Truncation notice]
C --> D[CLI system prompt]
U[User turn] --> E[CLI turn prompt]
D --> F[CLI backend session]
E --> F
F --> G[Transcript rendering]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -22, Tests +19. Total -3 across 17 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the shared system-prompt route and the truncation-aware reuse fingerprint, with maintainers knowingly accepting the documented one-time soft resume before merge. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence: current main appends the detailed truncation block to the CLI body prompt, while a truncated bootstrap fixture reaches that code path. Is this the best way to solve the issue? Yes. Reusing the shared system-prompt notice already used by the embedded runner removes the transcript leak at the producer boundary, and the fingerprint update prevents stale first-only resumed sessions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 54db7d4f99e8. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Addressed the ClawSweeper review (all three checklist items reduce to the one P2 finding): Track truncation notice changes in session reuse — fixed in a792630. Truncation-notice presence is now folded into the CLI session reuse fingerprint ( Two-turn regression added ( One-time migration note: existing bindings for sessions in Fresh autoreview (Codex, gpt-5.5) on the updated branch: clean, no actionable findings. 🤖 Generated with Claude Code |
…ompt CLI-backed runs appended the detailed bootstrap truncation warning to every turn's wire prompt, which surfaced the warning block inside user chat bubbles on transcript-rendering surfaces. The embedded runner already routes a compact notice through the shared system prompt builder's bootstrapTruncationNotice slot. Route the CLI runner through the same slot and delete the per-turn prompt append plus its context plumbing. Detailed per-file stats still land in the system prompt report for diagnostics. Co-Authored-By: Claude Fable 5 <[email protected]>
Fold bootstrap truncation-notice presence into the CLI session reuse fingerprint, mirroring the existing bootstrapMode hashing. Without this, a systemPromptWhen:"first" backend resuming an existing session never receives the updated system prompt when an AGENTS.md edit crosses the truncation threshold mid-session — a path the removed per-turn body append used to cover. Two-turn regression proves the drift resend. Co-Authored-By: Claude Fable 5 <[email protected]>
a792630 to
0407fc0
Compare
* origin/main: (26 commits) fix(plugins): preserve registry epoch on activation rollback (#129232) refactor(plugins): make discovery invocation-owned (#130486) feat(ui): save appearance preferences per user profile (#130340) fix: Buzz bots recover relay stalls and reject revoked senders (#130467) fix(code-mode): serialize catalog handles nested in final values (#130276) fix(webchat): CLI skill and harness-injected turns render as operator-sent messages (#130427) fix(agents): read the published model catalog owner from session_status (#130277) fix(channels): preserve long presentation text (#130368) fix(agents): route CLI bootstrap truncation notice into the system prompt (#130325) refactor(plugins): unify setup registration and artifact selection (#130474) fix(memory): prevent forgotten session content from returning (#130451) refactor(outbound): consolidate transport completion (#130460) fix(workers): protect in-flight workspace manifests from concurrent retention (#130449) fix(portals): keep worker previews reachable and owned by the active environment (#130434) fix(config): keep core channels keys in the generated config schema (#120736) chore(deps): refresh dependencies after seven-day cooldown (#130296) fix(agents): remind exec models to quote shell metacharacters (#125485) fix(auth): honor shared-store ownership in temp-state exec and agent deletion (#130437) fix(openshell): preserve file writes during concurrent mirror commands (#130447) fix(workers): report full nodes as at capacity, not offline (#130445) ...
…ompt (openclaw#130325) * fix(agents): route CLI bootstrap truncation notice into the system prompt CLI-backed runs appended the detailed bootstrap truncation warning to every turn's wire prompt, which surfaced the warning block inside user chat bubbles on transcript-rendering surfaces. The embedded runner already routes a compact notice through the shared system prompt builder's bootstrapTruncationNotice slot. Route the CLI runner through the same slot and delete the per-turn prompt append plus its context plumbing. Detailed per-file stats still land in the system prompt report for diagnostics. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(agents): drift first-only CLI sessions when truncation state changes Fold bootstrap truncation-notice presence into the CLI session reuse fingerprint, mirroring the existing bootstrapMode hashing. Without this, a systemPromptWhen:"first" backend resuming an existing session never receives the updated system prompt when an AGENTS.md edit crosses the truncation threshold mid-session — a path the removed per-turn body append used to cover. Two-turn regression proves the drift resend. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>
What
Routes the CLI runner's bootstrap truncation warning through the shared system prompt builder's
bootstrapTruncationNoticeslot (the same path the embedded runner uses) and deletes the per-turn append of the detailed warning block onto the wire prompt.Why
CLI-backed sessions (
claude-cli/*,codex-cli/*, …) appended the full[Bootstrap truncation warning]block to every turn's user prompt viaappendBootstrapPromptWarningincli-runner/execute.ts. Because the composed wire prompt is what transcript-rendering surfaces display, the warning block appeared inside the user's chat bubble on every message — a UX regression relative to API-backed models, where the embedded runner places a compact notice in the (invisible) system prompt. Truncation state is computed from the same bootstrap files each turn and does not change mid-session, so the per-turn repetition bought nothing.Changes
appendBootstrapPromptWarningwire-prompt appendbootstrapPromptWarningLinescontext plumbingappendBootstrapPromptWarning(execute.ts was its only consumer)Detailed per-file truncation stats still land in the system-prompt report (
buildBootstrapTruncationReportMeta), so diagnostics lose nothing. Production LOC delta: −27 (+8/−35); tests −51.Testing
pnpm vitest runover the 21 affected agent test files: 1073 passedpnpm check:changed: all lanes green (format, typecheck core + tests, lint, guards)routes bootstrap truncation notices into the system prompt, not the turn promptverified to fail against pre-fixprepare.ts/helpers.tsLive verification: not run against a live gateway — this machine's gateway is serving the session driving this work, and restarting it from the branch would kill that session. The changed seam is covered end-to-end at the prepare/execute boundary by the tests above; happy to live-verify on a session switched to a
claude-climodel after landing.Review notes
Autoreview (Codex,
gpt-5.5) raised one P2: abefore_prompt_buildhook returningsystemPromptreplaces the built system prompt, discarding the notice, whereas the old body append survived hook replacement. Rejected as parity-consistent: the embedded runner has identical semantics (attempt-prompt-build.ts— legacy full-replacementsystemPrompthooks discard the entire built prompt, including the injected Project Context itself). A hook that replaces the system prompt owns all of it; retaining a truncation warning for context the hook already discarded would be misleading.🤖 Generated with Claude Code