Fix stale inter-session orphan prompt merge#78094
Conversation
byungskers
left a comment
There was a problem hiding this comment.
Thanks for the fix! The inter-session provenance check is a clean way to avoid shadowing fresh prompts with stale orphan leaves. Good test coverage too — the runtime contract test makes the behavior explicit. 👍
|
Thanks for the contribution. I reviewed the branch, and this PR is not a good landing base for OpenClaw. Close this PR as a useful but no-longer-viable landing branch: it is conflicting, its runtime/test edits target the removed Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. So I’m closing this PR rather than keeping an unmergeable branch open. A new narrow PR that carries only the useful part is welcome. Review detailsBest possible solution: Close this stale branch as a landing vehicle and keep #76888 as the canonical place for a fresh current-path embedded-agent-runner repair. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main still prepends orphan text before the active prompt, and the canonical issue supplies logs from that repair path. I did not run a live channel reproduction in this read-only pass. Is this the best way to solve the issue? No. The helper idea is plausible, but this branch is not the best solution because it targets the removed runner path and treats all non-empty-prompt Security review: Security review cleared: No concrete security or supply-chain concern was found; the diff touches TypeScript runner logic, focused tests, and a changelog entry without dependency, workflow, permission, or secret changes. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 8cd0c11227f6. |
969cb03 to
98ec473
Compare
98ec473 to
89d894b
Compare
89d894b to
2b0034c
Compare
36d816b to
6229a85
Compare
da826f2 to
90f6372
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
|
ClawSweeper applied the proposed close for this PR.
|
Summary
Why
A stale inter-session subagent completion can be left as a trailing user leaf. The orphan repair path currently prepends that leaf ahead of a newer prompt, so stale control text such as
NO_REPLYcan shadow the fresh user/voice request and route incorrectly.Inter-session leaves are system-delivered completion context, not user text that arrived while a previous turn was active. When a fresh prompt exists, the safer repair is to remove the stale leaf rather than merge it into the new prompt.
Test plan
git diff --checkcorepack pnpm exec vitest run src/agents/pi-embedded-runner/run/attempt.test.ts src/agents/pi-embedded-runner/run/transcript-repair-runtime-contract.test.tsReal behavior proof
NO_REPLYare dropped instead of prepended to a fresh user/voice prompt.fix/drop-stale-inter-session-orphans), rebased ontoorigin/mainat2daf3d332f; Node 22.22.0 with pnpm/corepack on Linux.{ "prompt": "fresh voice request", "merged": false, "removeLeaf": true }fresh voice request; the staleNO_REPLYinter-session leaf was not merged; the helper returnedmerged: falseandremoveLeaf: true.After-fix verification
origin/mainand resolved theCHANGELOG.mdconflict.CHANGELOG.md,attempt.prompt-helpers.ts, and the two focused regression test files.git diff --check origin/main...HEAD— passed locally.corepack pnpm exec vitest run src/agents/pi-embedded-runner/run/attempt.test.ts src/agents/pi-embedded-runner/run/transcript-repair-runtime-contract.test.ts— passed locally: 4 files, 272 tests.This also proves the concrete repair behavior through the added runtime-contract regression: an inter-session-provenance trailing user leaf is removed instead of prepended when a fresh prompt exists, while normal queued user prompt repair still merges.