/code-review xhigh --fix master
- User
/code-review xhigh --fix master
- User
code-review /code-review xhigh --fix master
Assistant· claude-opus-4-8
I'll start by gathering the diff under review.
Assistant· claude-opus-4-8
Let me read the diff myself to understand the change before dispatching finder agents.
Assistant· claude-opus-4-8
Let me read the rest of the diff, focusing on the worker.rs changes which are the most substantial.
Assistant· claude-opus-4-8
I have the full diff. Now let me read key source context to ground the review — especially
build_memory_marker, the recall query source, and theinvoke_ccsurroundings.Assistant· claude-opus-4-8
Now let me examine
format_cc_inputto verify theexpectsafety and the omission logic, plus check for any prompt-file cleanup.Assistant· claude-opus-4-8
Let me check for any dangling references to the removed functions before dispatching finder agents.
Assistant· claude-opus-4-8
Let me check the
main.rscallsite that references a fixedcomposite-system-prompt.mdpath — it wasn't in the diff, so I need to confirm it doesn't break.Assistant· claude-opus-4-8
This
main.rscallsite builds its prompt independently (not via the changed function) — out of scope. I now have a thorough understanding. Let me dispatch parallel finder agents to maximize independent coverage, then I'll verify and fix.Assistant· claude-opus-4-8
Three finder agents returned strong candidates. Let me verify the highest-severity ones by reading the actual control flow. First, the consume-before-deliver path (C1) — I need to confirm early returns exist between the
memory_status_lastmutation (line 2860) and the stdin write (~3190).Assistant· claude-opus-4-8
Confirmed C1: line 2951 (
guard_no_sandboxed_host_exec(...)?) and line 3032 (shutdown check) are early returns after thememory_status_lastmutation at 2860 — and the guard fails precisely on sandbox/backend outage, exactly when memory is degraded. The marker is recorded as emitted but never delivered. Let me read the stdin-write area to assess fix feasibility, plusyaml_escape_stringand thebuild_memory_markerdoc comment.Assistant· claude-opus-4-8
The stdin write succeeds by line 3210 (error path returns at 3206);
stoppedflags the cancelled case. A clean deferred-commit point exists. Now let me checkyaml_escape_string, thebuild_memory_markerdoc comment, and thewrap_memory_for_promptto finalize the escaping/reuse decision.Assistant· claude-opus-4-8
Confirmed:
yaml_escape_string(attachments.rs:570) is weaker thanformat_chat_context_scalar(no control-char handling), so the "just reuse it" suggestion would weaken the injection defense — I'll reject that as-written but strengthen the chat-context escaper for U+2028/U+2029. C6 stale doc confirmed. Let me run one sweep agent for gaps while I prepare fixes.Assistant· claude-opus-4-8
Sweep found 3 candidates. S3 (sibling shared prompt path) is a false positive —
claude_argsgo into the command string, not the prompt file, and the siblings passNonefor chat-context so their file content is agent-stable (the clobber writes identical bytes; pre-existing and benign). S1/S2 (agent-facing docs) need verification. Let me read the agent-facing instructions.Assistant· claude-opus-4-8
Confirmed S1:
OPERATING_INSTRUCTIONS.md:139(agent-facing, shipped every turn, NOT touched by this PR) listsauthor/chatas per-message fields — now wrong for DMs (omit both) and groups (omitchat), and the new## Current Conversationblock is undocumented to the agent. This is the strongest gap.I have a complete, verified findings list. Let me read the exact edit sites, then apply fixes.
Assistant· claude-opus-4-8
I have everything verified. Now applying fixes, starting with the contained ones.
Fix 5 — escape U+2028/U+2029 in the chat-context scalar escaper (header-injection gap):
Assistant· claude-opus-4-8
I need to read the file first (the diff isn't the file itself).
Assistant· claude-opus-4-8
Fix 6 — stale doc comment on
build_memory_marker:Assistant· claude-opus-4-8
Fix 3 —
edge_memory_markerfalsely announces "recovered" when the Healthy-state retain-errors info marker clears:Assistant· claude-opus-4-8
Fix 4 —
forum_topics::listerror silently swallowed by.ok():Assistant· claude-opus-4-8
Fix 2 — agent-facing stdin YAML schema doc is stale (prompt-tier, ships every turn):
Assistant· claude-opus-4-8
Fix 1 (the highest-severity finding) — defer the
memory_status_lastcommit until stdin is actually delivered, so a turn that fails before delivery re-emits the marker next turn. Let me re-read the current state of the relevant spots (line numbers shifted after prior edits).Assistant· claude-opus-4-8
Now replace the immediate insert/remove with the deferred capture:
Assistant· claude-opus-4-8
Now add the delivery flag and the deferred commit at the stdin-write site:
Assistant· claude-opus-4-8
Now let me add a regression test for the retain-errors recovery suppression (Fix 3). Let me locate the edge-marker tests.
Assistant· claude-opus-4-8
Now let me verify the changes compile and the targeted tests pass.
Assistant· claude-opus-4-8
Compiles cleanly. Now run the targeted tests for the changed modules:
Assistant· claude-opus-4-8
All 60 targeted tests pass, including the new regression test. Let me run the full workspace test (mandatory final check) plus clippy on the touched crates.
Assistant· claude-opus-4-8
Let me confirm none of these clippy warnings come from my edits (most look pre-existing). Let me get exact locations:
Assistant· claude-opus-4-8
None of those warnings are from my edits (attachments.rs:268/302 and worker.rs:4051 are all outside my changed regions; the "too many arguments" belongs to the PR's own
build_prompt_assembly_script, which I deliberately left as a NOTE). Now the mandatory full workspace test:Assistant· claude-opus-4-8
Let me confirm there were no failures across the whole workspace run:
Assistant· claude-opus-4-8
All clean — 2578 tests passed, zero failures (the
error::tests::...oklines are false matches on theerror:substring in module paths, not failures). Let me do a final explicit failure check to be certain:Assistant· claude-opus-4-8
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.