Repository navigation
fix(agents): detached tool runs lose their final reply - #189984
Conversation
Keep settled-turn finalization inside the existing harness admission and borrowed-manager write scope. Preserve the prepared native registration fingerprint and reject transcript appends after admission closes. Co-authored-by: ethanhawkes-gif <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR preserves harness admission and native registration during finalization and rejects borrowed-transcript writes after run admission closes. Example: A detached review writes note.txt, receives an empty post-tool response, and recovers “The review evidence has been saved.”
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR repairs a remaining detached-run finalization defect on current main. No introduced correctness or security defect was found; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe embedded runner sends settled tool context through the selected harness for a tool-free final answer, then appends through the existing session manager and prepares caller payloads. flowchart TD
A[Detached agent run] --> B[Completed tool work]
B --> C[Settled turn finalizer]
C --> D[Existing harness admission]
D --> E[Tool free model response]
E --> F[Session manager write assertion]
F --> G[Borrowed transcript and caller reply]
Technical reviewBest possible solution: Keep finalization within the existing admitted harness and manager write owners while retaining tool-free execution and committed writer fencing. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the missing finalizer registration boundary, and the PR reports unchanged paired regressions failing on the pinned base and passing on this head; this read-only review ran no target code. Is this the best way to solve the issue? The patch restores admission at the existing harness owner and carries liveness to the existing write owner; the simplification pass found no unnecessary production machinery or redundant test group. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ebf13610e1b8. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource 0, Tests +210, Other +2. Total +212 across 5 files. Added test files: 1. 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:
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 Reviewed October 31, 2026, 10:40 PM ET / November 1, 2026, 02:40 UTC. |
|
Merged via squash.
|
…89984) Keep tool-free settled-turn finalization inside the existing harness admission and borrowed-manager write scope. Retain the native registration fingerprint and reject transcript appends after admission closes. Remove duplicate finalizer parameter assembly and projection aliases, keeping production LOC unchanged. Supersedes openclaw#167892, thanks @ethanhawkes-gif. Co-authored-by: ethanhawkes-gif <[email protected]>
What Problem This Solves
Detached tool runs can finish their work but lose the recovered final reply; a cancelled finalizer can also append that reply to its borrowed transcript after admission closes.
Supersedes #167892, thanks @ethanhawkes-gif.
User Impact
Detached runs return their recovered answer through the original transcript, and revoked runs cannot persist a late answer. No configuration or migration is required.
Why This Change Was Made
Reuse the existing harness admission for tool-free finalization, retain its native registration fingerprint, and carry the live run assertion into the borrowed manager's write admission. Current main already retains child writer context (#140399) and serializes session turns (#175837); these remaining finalizer boundaries still needed repair.
Production LOC is net zero (+43/-43): one finalizer parameter object replaces duplicate identity assembly, and redundant projection aliases are removed. The 210-line regression allocation covers the real runner/native-registration/tool/transcript composition that scripted backend tests miss.
Evidence
7db5a3f79d186d617ae96fa48f64ebb2f8d49b91, 2 pass with this change. The affected production files also match newer main.runEmbeddedAgent, built-in harness, file write, native registration, private-session replacement, borrowed transcript and persistence. Only provider responses are scripted; no paid provider or production Gateway was used.node scripts/run-vitest.mjs run src/agents/embedded-agent-runner/run/settled-turn-finalization.borrowed.test.ts --maxWorkers=1.core-test-agents-other), changed-file lint/format andgit diff --checkpass.7db5a3f79d18, P0–P2, scoped-clean, no actionable findings. No reviewer configuration was changed.Hosted ClawSweeper review of
d4bacc15eb75: no findings or before-merge work.