Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesMoves per-turn elevated-exec guidance below the stable system-prompt cache boundary. Example: A sandboxed parent delegates through sessions_spawn and sessions_yield, then receives a child-completion announcement.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review This PR fixes a demonstrated prompt-prefix defect still present on current main, preserves permission guidance, and has no actionable review findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe agent prompt renderer receives prepared sandbox permissions and workspace instructions, then emits stable and dynamic system instructions for provider request preparation. flowchart LR
A[Gateway parent turn] --> B[Sandbox permission preparation]
B --> C[Agent prompt renderer]
C --> D[Stable workspace prefix]
C --> E[Dynamic elevated guidance]
D --> F[Provider request]
E --> F
Technical reviewBest possible solution: Land this bounded guidance relocation and retain the linked issue for remaining cache-churn contributors. Do we have a high-confidence way to reproduce the issue? Current-main source shows per-turn elevated availability above the stable boundary, and the supplied Gateway trace confirms the normal-to-announcement prefix change; no target code was executed during this review. Is this the best way to solve the issue? Relocating the existing instructions within the existing renderer fixes their cache placement without adding another owner or changing permission enforcement. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b36ed3195cb4. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +11. Total +11 across 3 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (11 earlier review cycles; latest 8 shown)
Reviewed October 12, 2026, 10:13 PM ET / October 13, 2026, 02:13 UTC (Revision 12). |
d35195f to
9b04495
Compare
|
Follow-up on the ClawSweeper review: CI failures fixed and the proof gap closed with a run through the production turn-preparation chain. Head is now 1. CI failures on the previous head (
|
9b04495 to
d674a74
Compare
|
Rank-up move from the last review ("evidence from an actual 1. Real gateway run, measured on the wireThe qa-lab e2e harness now boots the real thing instead of calling the renderer:
Turn sequence driven through it: Both runs use the same harness, config and turn sequence; the only difference is
2. Rebased, so CI is freshThe two red jobs on
I have no rerun permission on this repo, hence the rebase to get a fresh run. 3. Local verification on the new head
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
CI on Two consecutive local runs of that single file on this exact head: So the assertion is a 1 ms wall-clock race in how the shared provider-HTTP owner derives the remaining request budget — it passes or fails depending on how much of the budget was consumed before the request record was captured. This PR touches only I have no rerun permission on this repo ( |
d674a74 to
cac373f
Compare
|
Rebased onto current The previous red Re-verification on the new head:
|
…refix Elevated-exec availability and toggle guidance rendered above the system prompt cache boundary, so a parent turn whose elevated permissions differ from the previous turn (normal vs sessions_yield/announce re-entry) produced a different stable prefix and defeated provider-side literal prefix caching. Move the guidance below the boundary, next to the existing per-turn "Current elevated level:" line, and cover prefix stability across elevated-availability changes. Fixes openclaw#150081
cac373f to
0e3d395
Compare
|
Slimmed to Re-verified: RED on unpatched |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thanks @LiuwqGit. We proved this on a built Gateway: the stable prefix hash changed on every spawn/yield/announce transition on main and stayed fixed with your change. While it was in final checks, #170516 (0e6eb69) landed on main and moved the whole Sandbox section, including all the elevated-exec lines, below the cache boundary. That supersedes this PR's relocation, and the PR now conflicts, so I'm closing it as superseded. Your report and proof in #150081 helped show the gap. |
…e/yield turns Fixes openclaw#150081: Ollama prompt_eval_cached_count drops from ~25k to ~14k tokens when transitioning between normal main turns and sessions_yield/ announce turns, causing prompt evaluation time to increase from ~11s to ~123-203s. Changes: - system-prompt.ts: Always render Silent Replies section; always use standard output directives variant; always render Control UI Embed when message tool available - system-prompt-messaging.ts: Always use same completion-event guidance wording referencing SILENT_REPLY_TOKEN - get-reply-run-execute.ts: Fall back to resolveConfiguredCommandOwners when command.ownerList is empty (announce turns with no sender) - system-prompt-cache-stability.test.ts: Regression tests Prior partial fixes (all merged): - openclaw#167898: Conversation Context stabilization - openclaw#175309: Tool definition stabilization - openclaw#170516: Sandbox/elevated section moved below boundary Related: openclaw#98261, openclaw#150099
…e/yield turns Fixes openclaw#150081: Ollama prompt_eval_cached_count drops from ~25k to ~14k tokens when transitioning between normal main turns and sessions_yield/ announce turns, causing prompt evaluation time to increase from ~11s to ~123-203s. Changes: - system-prompt.ts: Always render Silent Replies section; always use standard output directives variant; always render Control UI Embed when message tool available - system-prompt-messaging.ts: Always use same completion-event guidance wording referencing SILENT_REPLY_TOKEN - get-reply-run-execute.ts: Fall back to resolveConfiguredCommandOwners when command.ownerList is empty (announce turns with no sender) - system-prompt-cache-stability.test.ts: Regression tests Prior partial fixes (all merged): - openclaw#167898: Conversation Context stabilization - openclaw#175309: Tool definition stabilization - openclaw#170516: Sandbox/elevated section moved below boundary Related: openclaw#98261, openclaw#150099
…e/yield turns Fixes openclaw#150081: Ollama prompt_eval_cached_count drops from ~25k to ~14k tokens when transitioning between normal main turns and sessions_yield/ announce turns, causing prompt evaluation time to increase from ~11s to ~123-203s. Changes: - system-prompt.ts: Always render Silent Replies section; always use standard output directives variant; always render Control UI Embed when message tool available - system-prompt-messaging.ts: Always use same completion-event guidance wording referencing SILENT_REPLY_TOKEN - get-reply-run-execute.ts: Fall back to resolveConfiguredCommandOwners when command.ownerList is empty (announce turns with no sender) - system-prompt-cache-stability.test.ts: Regression tests Prior partial fixes (all merged): - openclaw#167898: Conversation Context stabilization - openclaw#175309: Tool definition stabilization - openclaw#170516: Sandbox/elevated section moved below boundary Related: openclaw#98261, openclaw#150099
…e/yield turns Fixes openclaw#150081: Ollama prompt_eval_cached_count drops from ~25k to ~14k tokens when transitioning between normal main turns and sessions_yield/ announce turns, causing prompt evaluation time to increase from ~11s to ~123-203s. Changes: - system-prompt.ts: Always render Silent Replies section; always use standard output directives variant; always render Control UI Embed when message tool available - system-prompt-messaging.ts: Always use same completion-event guidance wording referencing SILENT_REPLY_TOKEN - get-reply-run-execute.ts: Fall back to resolveConfiguredCommandOwners when command.ownerList is empty (announce turns with no sender) - system-prompt-cache-stability.test.ts: Regression tests Prior partial fixes (all merged): - openclaw#167898: Conversation Context stabilization - openclaw#175309: Tool definition stabilization - openclaw#170516: Sandbox/elevated section moved below boundary Related: openclaw#98261, openclaw#150099
Related: #150081
What Problem This Solves
Normal parent turns include elevated-exec availability facts that are absent on the subagent-completion announce turn. Rendering those facts above the stable system-prompt boundary invalidates literal prefix caches on both transitions.
Move the existing elevated-exec guidance into the existing volatile system-prompt suffix in
src/agents/system-prompt.ts. No new module, permission policy, config, or instruction authority is introduced. The sandbox restriction remains in the stable prefix. The availability statements and warnings remain system/developer instructions with their existing conditions and wording.User-visible change: delegation no longer invalidates the stable prompt prefix merely because elevated-exec facts differ between normal and announce runs. This is a bounded fix, not a claim that every source of the reporter's Ollama cache churn is fixed.
Thanks to @Eragim for reporting and @LiuwqGit for the fix. No overlap with Pash/Sarah changes was found in the three changed files.
Evidence
Built current main
e5606888f0a503dba456c7fb6905e67440d6877band merged candidate861f22474ec9d3c27466c757f2f2f8cd4b6163ddin a secretless Node 24.16 Docker container. An isolated Gateway used the shipped OpenAI Responses provider against a capturing loopback endpoint (no real API key). A real SSH sandbox on container loopback exercised elevated-exec-enabled sessions without mounting the host Docker socket.Through Gateway
chat.send: normal parent turn → actualsessions_spawn→ actualsessions_yield→ child completion → parent announce → next parent turn. Both versions completed the sequence. Hashes below are SHA-256 of the captured provider instruction's stable region, through the text preceding<!-- /openclaw:attempt:STABLE -->(the transport's representation of the cache boundary).2348ece76bd1c971ac3d724ff4cc1be67bc263b80a0133af81efae535d141af6861223b9c8cedf146f6598c61def9d9e72aa5134d6550047f4e9475fa72c2af12348ece76bd1c971ac3d724ff4cc1be67bc263b80a0133af81efae535d141af696c8871b26aecedfec639681eab8eecb0461663fe7bba1759682074893cd87a8Paths are isolated per build, so compare equality within each build, not base hashes against candidate hashes. The base stable-region diff contains exactly these three removed lines; candidate keeps them in the dynamic system/developer region on normal turns:
Every captured parent and child turn on both builds retains this system/developer-authority restriction:
As before, the announce run has no elevated availability fact; the next normal turn restores that fact. No warning was demoted to user content. This proves prompt bytes and instruction presence, not an Ollama latency measurement.
The merged base includes #170282 (Code Mode schema-directory guidance moved into the dynamic region) and #168169 (date/time moved into runtime context). Neither moves elevated-exec availability out of main's stable Sandbox section. The candidate preserves both upstream changes and moves the elevated block below the same boundary. The full spawn/yield/announce comparison above was rerun after merging them; the defect still reproduces on current main and is absent on the merged candidate.
Focused checks and simplification
node scripts/run-vitest.mjs src/agents/system-prompt.test.ts src/agents/system-prompt.cache-prefix.test.ts: 60 tests passed; 48.59 seconds wall time across two selected shards.2dd42a977aa9: the two new regressions fail on the intended prefix/placement assertions (8 existing tests pass). The refreshed current-main Gateway proof above independently reproduces the defect.Risk and reversibility
Two-way door: reverting restores the previous rendering positions; no persisted state or public API changes. Blast radius is agent system-prompt rendering for elevated-exec sandbox sessions; a mistake could reduce cache reuse or omit permission guidance.