Repository navigation
Closed
Labels
priority/normalOrdinary priority (the default)Ordinary priority (the default)source/design-architectFiled by the repo design architect jobFiled by the repo design architect jobsource/pr-comment-reviewFiled by the pr-comment-review jobFiled by the pr-comment-review jobtask/triageQueue packet kind: verify, reproduce, and route this itemQueue packet kind: verify, reproduce, and route this item
Description
Finding (from PR review)
A cancellation that races with a prompt's completion leaves a stale cancellation marker that mislabels the next normally completed prompt. Codex (P2, PR #3997):
When a cancellation notification races with the prompt's final idle event, the prompt can finish before this handler runs. The handler still records the session as cancelled, but an ensuing idle event cannot remove that marker because cleanup in
handleServeEventrequires a pending prompt. The next normally completed prompt then incorrectly returnsstopReason: "cancelled". The marker also survives a cancelled prompt ending throughsession.error. Only mark active prompts as cancelled and clear their cancellation state on every terminal path.
Evidence
- Source PR: feat(openclaw): ACP-to-HTTP adapter so OpenClaw shares the standing opencode serve (#1243) #3997 — feat(openclaw): ACP-to-HTTP adapter so OpenClaw shares the standing opencode serve (#1243) #3997 (merged 2026-11-02 as-is)
- Review comment: feat(openclaw): ACP-to-HTTP adapter so OpenClaw shares the standing opencode serve (#1243) #3997 (comment) — chatgpt-codex-connector[bot], 2026-11-01T21:31:19Z,
bin/opencode-acp-adapter.mjs:422 - No-response evidence: the review thread is unresolved (GraphQL
reviewThreads, checked 2026-11-02), the comment has no replies, and PR feat(openclaw): ACP-to-HTTP adapter so OpenClaw shares the standing opencode serve (#1243) #3997 contains a single commit (8e67215, 2026-11-01T21:26:51Z) that predates the comment — no fix followed it before merge. - Still live on current main (verified by raw read 2026-11-02):
bin/opencode-acp-adapter.mjs:422—session/cancelcallscancelledSessions.add(sessionId)unconditionally; the marker is deleted only at:308-312, inside thesession.idlebranch gated onpendingPrompts.has(sessionId), and thesession.errorpath (finishPrompt) never clears it.
Acceptance criteria
- Cancellation is recorded only for prompts actually in flight, and cancellation state is cleared on every terminal path (
session.idle,session.error, prompt finish). - A regression test covers: cancel arriving after a prompt finished, followed by a normal prompt that must return
stopReason: "end_turn". - Or the finding is resolved by a documented decision on this issue.
Metadata
Metadata
Assignees
Labels
priority/normalOrdinary priority (the default)Ordinary priority (the default)source/design-architectFiled by the repo design architect jobFiled by the repo design architect jobsource/pr-comment-reviewFiled by the pr-comment-review jobFiled by the pr-comment-review jobtask/triageQueue packet kind: verify, reproduce, and route this itemQueue packet kind: verify, reproduce, and route this item
Activity
dezren39 commentedon Nov 2, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 2, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 2, 2026
agent-note:v1
event: handed_off
state: handed off
task: 6520 (repo-health-code-pilot; worker repo-worker-code)
session: ses_e5e61a4e311ffea3y9BCxWDFUd
route: opencode-route/workhorse
action: Bound OpenCode worker launched for this already-claimed task; it must not claim another task.
dezren39 commentedon Nov 2, 2026
🤖 Agent note · picked up
dezren39 commentedon Nov 2, 2026
🤖 Agent note · parked
session/canceladds tocancelledSessionsunconditionally (lines 419–426);session.idleclears it only while a prompt is pending (307–312);session.errorfinishes the prompt without clearing it (314–320).32 remaining items
dezren39 commentedon Nov 3, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 3, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 3, 2026
🤖 Agent note · bound
dezren39 commentedon Nov 3, 2026
🤖 Agent note · picked up
queue/6520-4618-stale-cancel-marker— kept the openclaw ACP adapter: cancellation marker survives a finished prompt and mislabels the next prompt as cancelled (#3997) #4618 guard (clear the cancel marker on every terminal path, ignore cancel when no prompt is pending), adopted main's openclaw ACP adapter: load the standing-server credential — gateway launch wires no OPENCODE_SERVER_PASSWORD (#3997) #4615 auth tests anddata.errormessage shape, droppedpartTextSent.clear()(variable removed on main). Head now f9fd9ff.node --test bin/opencode-acp-adapter.test.mjspasses 9/9; merge fix(acp): clear stale cancellation markers on every terminal path (#4618) #4642 when the PR tier is green.Merge pull request #4642 from developing-today/queue/6520-4618-stale-…
dezren39 commentedon Nov 3, 2026
🤖 Agent note · done
session/cancelwith no pending prompt no longer arms a stale marker, so the next prompt keeps its ownend_turn. Merge resolved main's openclaw ACP adapter: load the standing-server credential — gateway launch wires no OPENCODE_SERVER_PASSWORD (#3997) #4615 auth-test additions alongside the openclaw ACP adapter: cancellation marker survives a finished prompt and mislabels the next prompt as cancelled (#3997) #4618 regression test.node --test bin/opencode-acp-adapter.test.mjs— 9/9 pass locally on the merged head; PR tierbasic: OpenCode metered-provider guardpass.