Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 23, 2026, 12:19 AM ET / 04:19 UTC. ClawSweeper reviewWhat this changesThe PR retains already-streamed Claude CLI text after an interrupted live turn and records the result as aborted or timed out instead of successful. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain The patch follows the Claude live-turn owner boundary and carries interruption state through persistence and settlement without a concrete correctness defect found. It still needs after-fix proof from a real Claude CLI setup before merge. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherClaude CLI live sessions parse streamed output before passing a normalized result to the CLI runner. The runner writes transcripts, emits hooks, updates session continuity, and settles auth and execution metadata. flowchart LR
A[Claude CLI stream] --> B[Live turn parser]
B --> C{Terminal outcome}
C -->|Completed| D[Successful settlement]
C -->|Partial interrupted| E[Interrupted settlement]
D --> F[Transcript hooks session auth]
E --> F
Before merge
Agent review detailsSecurityNone. PR surfaceSource +78, Tests +255. Total +333 across 7 files. 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. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one explicit interruption fact on normalized CLI output, settle it once across transcript/session/auth projections, and prove the resulting partial reply in a real Claude CLI abort. Do we have a high-confidence way to reproduce the issue? Yes, from source: stream assistant text through a Claude live turn and abort its signal; the focused regression test models that path, though no current-main live CLI run was available to this review. Is this the best way to solve the issue? Yes for the code path reviewed: the disposition is attached at the live-turn owner and consumed by existing settlement projections instead of treating partial output as a normal success. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 434fd0c10690. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
214805f to
a72669c
Compare
a72669c to
230cb5d
Compare
Use the canonical signal-reason rule (isSignalTimeoutReason, as run-diagnostics does) for the partial-output disposition instead of failover message sniffing plus a DOM-abort special case; the failover pattern list counts "operation was aborted" as timeout-like, so a plain /stop abort classified as a timeout without that carve-out. Settlement owns one cliSessionBindingCleared fact, the interruption reason string, and the transcript stop reason; drop the redundant bindingFlushOk interruption branch and the unreachable idle re-arm.
…openclaw#126883) Claude CLI live turns that were aborted (user /stop) or hit a caller deadline rejected in failClaudeTurn, so assistant text the streaming parser had already accepted was dropped from the transcript. The turn now resolves that partial output with a terminalInterruption disposition (aborted | timeout, classified by the canonical signal-reason rule) and the CLI runner settles it as a non-successful terminal run: transcript stopReason aborted, trace attempt aborted/timeout, agent_end success=false, native session binding cleared, no successful auth binding. Structured FailoverError paths, provider failures, and interruptions without usable text still reject. Closes openclaw#120207 Co-authored-by: Jason O'Neal <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #144392 Supersedes #145788 by @Marvinthebored. Thanks to @EnotionZ for the issue report. The original commit and authorship are preserved. ## What Problem This Solves Canceling a reply makes the next turn forget the conversation, even though earlier messages still appear in history. ## User Impact Stopping a reply keeps the established conversation available for the next turn. Invalid sessions and account boundaries still receive their existing checks. ## Why This Change Was Made Retain established native bindings on cancellation. Clear unfinished replacements on both thrown errors and returned partial-output interruptions. An incomplete fork claim is restored by current-owner cleanup even when the signal is aborted. New claims, successor publication, and recovery arming retain their abort guards; all writes retain session, lifecycle, writer, and source-binding checks. This preserves partial-output reporting from #126883 while removing cancellation-only binding invalidation. No schema, migration, configuration, protocol, or dependency change. ## Final-head evidence Head `b068bf05618ddcd3e1b28894c68ad734e0eac997` includes a one-line test-type correction that passes the existing defined session entry; the command still reloads persisted state before choosing the next native binding. All 157 tests in that file, targeted lint, and formatting pass. Production source is unchanged from `2c163fd9eb57100ae3a2eec38cb6038e5f752851`. The complete affected owner suites passed on fresh merge `4b66a1a18209c21b5e92986452b2b98b95ae6fa1`, with parents `2c163fd9eb57100ae3a2eec38cb6038e5f752851` and main `9542320aa5cdcc4af53e3b05ad75160992a34407`. All **28 complete canonical groups exited 0**: 46,971 labeled passes and 88 skips. Three cases are unlabelled in the native support summary; no status is inferred. This includes both fork-restoration cases and all four abort/timeout × established/replacement command cases. Complete current group membership, exact commands, numeric exits, and raw logs are retained. ```sh env -u NO_COLOR -u FORCE_COLOR node --import tsx scripts/ci-run-node-test-shard.mts ``` Hosted [CI run 34774482283, attempt 1](https://github.com/openclaw/openclaw/actions/runs/34774482283) passed except `checks-node-compact-small-32` and its aggregate gate. Its QA-profile routing assertion is **base-red**: the same test fails on plain main `28887b564210326174413d0d8ade72b38268d5f3` and fresh candidate/main merge `7ea7374fcf62570c9b3fa631cf17072ef5eda2d6`, both exit 1. #143968 (`07b96d9b4122e1afdd0efbb662b2335eb716dfec`) added `qa-profile-run-status.test.ts` as a sixth workflow reader without updating the five-target expectation. This PR changes none of those routing inputs. ```sh OPENCLAW_E2E_USE_PREBUILT_DIST=1 node scripts/run-vitest.mjs run \ test/scripts/test-projects.test.ts -t 'routes QA Profile Evidence' ``` ## Fork-claim correction Candidate `2c163fd9eb57100ae3a2eec38cb6038e5f752851` restores a committed fork claim after cancellation before a successor appears. Previously, restoration rejected the aborted signal, lost the fork marker, and let the next command resume the source directly. Cleanup now uses the existing current-owner settlement assertion. Stale session, lifecycle, writer, placement, and source-binding checks remain enforced. The regression fails on `e2ca5b29bfa09810aaa20eca8a1d0e85ced913c8`: the marker is absent and the next command receives `forkCliSessionOnResume=false`. After correction, both the recovery-error control and actual-signal cancellation pass; stored/cache markers and the source checkpoint remain, and the next command receives `forkCliSessionOnResume=true`. ```sh env -u NO_COLOR -u FORCE_COLOR node scripts/run-vitest.mjs run \ --config test/vitest/vitest.agents.config.ts \ src/agents/command/attempt-execution.cli.test.ts --maxWorkers=1 \ -t 'preserves a restored fork marker before a successor' ``` Fresh merge `54a5c90a8b4585f72842e380365b95263b05983d` has first parent candidate `2c163fd9eb57100ae3a2eec38cb6038e5f752851` and second parent main `adb6e518a44218650883f3daec4bd319165e0017`. All **436 tests in seven complete focused files passed**, including command successor/flag cleanup, aborted pre-successor restoration, stale-store guards, returned interruption, thrown cancellation, auto-reply, and fork-runner siblings. This bounded rerun supplements the earlier complete suites. Both real Gateway cancellation shapes also passed on that merge: before output (zero assistant events) and after first output. Both next turns resumed the same native binding, logged `historyPrompt=none`, and recalled `PEBBLE-7429`. Both drivers exited 0. The new catalog regression uses the real command/store entry point with a mocked native runner; it proves next-turn fork routing, not a new live source-transcript isolation capture. Targeted lint passed, including max-lines: ```sh pnpm exec oxlint --config .oxlintrc.json \ src/agents/command/attempt-execution.ts \ src/agents/command/attempt-execution.cli.test.ts ``` Original red evidence remains intact. Exact commands, merge identities, numeric exits, and complete captures are retained. The complete affected-suite rerun and final-head CI classification are recorded above. ## Earlier evidence Validated corrected candidate `4fd555e5957f86289cf981ce4cf4b0bb1122c679` on temporary merge `d5f41d1cd6c9b603db32deec1d60c1ba93e7e04d`. Its parents are that candidate and main `a0cce74d389d737d6dcf21de7344af10cf862f72`. All 28 complete canonical CI groups for the affected agent, reply, scheduled-run, and fast test suites exited 0 on that merge. Reporters label **46,859 tests passed and 88 skipped**. The full command persistence matrix passed, including unfinished-successor and temporary-flag cleanup for abort and timeout, plus established-binding resume. Each complete group ran through the CI command, with its canonical configuration, include list and environment preserved: ```sh node --import tsx scripts/ci-run-node-test-shard.mts ``` These are the complete affected test suites on the recorded merge. Final-head CI and its reproduced base-red exception are recorded above. Initial host setup failures were retained, then resolved by removing conflicting color settings and making GNU timeout available without replacing existing command resolution. No source assertions or timeouts were relaxed. One native summary leaves three cases unlabeled; the raw count line is retained without assigning them a status. The real Gateway was also rerun from the merge with isolated state, workspace and port: ```sh OPENCLAW_CONFIG_PATH="$PROOF/openclaw.json" OPENCLAW_STATE_DIR="$PROOF/state" \ pnpm openclaw gateway --port 21978 --bind loopback ``` `chat.send` remembered a synthetic code, a second request started a long reply, `chat.abort` canceled it, and the next `chat.send` requested the code without repeating it. | Cancellation | Recorded main | Corrected merge | | --- | --- | --- | | Before output | Fresh native session; `UNKNOWN` | Same native binding; `PEBBLE-7429` | | After first output | Fresh native session; `UNKNOWN` | Same native binding; `PEBBLE-7429` | Both drivers exited 0. Both continuations logged `useResume=true` with the same native fingerprint and `historyPrompt=none`. The pre-output run had zero assistant events before cancellation. Original red captures, merge parents, selection, exact commands, numeric exits and complete logs are preserved. Final-head CI and its reproduced base-red exception are recorded above. ## Compatibility and prior behavior This deliberately changes the cancellation-only binding invalidation retained by #126883 and #128131. Partial output remains visible, interrupted turns remain unsuccessful, and successful authentication settlement remains suppressed. Expired-session recovery from #115513 and the retired-field migration from #143347 remain unchanged. There is no schema, migration, configuration, protocol, dependency, or permission change. ## Consumers Command attempts, auto-reply turns, and scheduled turns consume the binding result. History import, session freshness, catalog continuation, export, runtime selection, and detached-media continuation read the retained binding or its explicit absence. Catalog adoption seeds a binding with `forceReuse` and a one-shot fork marker. The command path claims that marker before execution and can persist a successor before final settlement. These writes require the current session, lifecycle, writer, and expected source binding. Successful settlement removes the temporary reuse flag; interrupted replacement cleanup removes the successor and flag together. An established binding remains available after cancellation. Cancellation before a fork successor appears restores the one-shot marker, so the next command must still fork from the source. Cache updates occur at the successful commit, and scheduled continuation publication follows base-session persistence. ## Evidence limits The real Gateway sequences cover cancellation before output and after the first output. Both failed on main `fe3b2891fdeaa1a891d54cb2b306e975fc5408cf` and passed at `f9c5b148cf4d92de5211315a4e8c374bef279d9d`. The next turn resumed the same native binding without replaying local history and recalled the seeded code. The initial 272 focused tests include command persistence and next-turn routing, auto-reply retention, failed-flush cleanup, and scheduled-run settlement. They ran on the branch based on `f85a9945daaebc61d041db27b4d3175d17082e37`. The later fresh merge `d5f41d1cd6c9b603db32deec1d60c1ba93e7e04d`, recorded above, passed all 28 complete affected test groups and both real Gateway cancellation shapes. No browser-click or platform-specific UI claim is made. The two test suites that failed on the contributor head pass when applied to the refreshed main base and after correction. The original hosted failures were not reproduced in their original shard order, so their cause remains unclassified. No assertion or timeout was relaxed for this repair. ## Test ledger clarification - The ordinary-abort policy and command assertions now require retention instead of unconditional deletion. Command coverage also checks the subsequent resume. - The contributor-only interrupted-flush helper matrix was removed before the final diff because command persistence coverage supersedes it. - The retained interrupted-partial-output fixture now names an established reusable session. Its unchanged clear assertion independently protects failed transcript flush; its partial-output, unsuccessful-hook, timeout, and authentication assertions remain. - The new composition cases invoke `runAgentAttempt`, claim a fork, persist its successor, abort the actual signal, consume the production settlement result, reopen stored state, and check the next attempt. The channel regression invokes `executeAgentTurn`; the failed-flush regression invokes `runPreparedCliAgent`. Direct policy-unit assertions supplement these entry-point checks. The earlier head `e2ca5b29bfa09810aaa20eca8a1d0e85ced913c8` only replaces a retained unflushed ID with the equivalent condition at its two consumers. Review accepted that behavior-preserving delta. CI run [34769866871](https://github.com/openclaw/openclaw/actions/runs/34769866871) passed at attempt 2 on this exact head. Attempt 1 had one test failure in an unrelated QA binary-admission case; it passed on the retry without a code or timeout change and is recorded as a flake. Co-authored-by: Marvinthebored <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Related: openclaw#144392 Supersedes openclaw#145788 by @Marvinthebored. Thanks to @EnotionZ for the issue report. The original commit and authorship are preserved. ## What Problem This Solves Canceling a reply makes the next turn forget the conversation, even though earlier messages still appear in history. ## User Impact Stopping a reply keeps the established conversation available for the next turn. Invalid sessions and account boundaries still receive their existing checks. ## Why This Change Was Made Retain established native bindings on cancellation. Clear unfinished replacements on both thrown errors and returned partial-output interruptions. An incomplete fork claim is restored by current-owner cleanup even when the signal is aborted. New claims, successor publication, and recovery arming retain their abort guards; all writes retain session, lifecycle, writer, and source-binding checks. This preserves partial-output reporting from openclaw#126883 while removing cancellation-only binding invalidation. No schema, migration, configuration, protocol, or dependency change. ## Final-head evidence Head `b068bf05618ddcd3e1b28894c68ad734e0eac997` includes a one-line test-type correction that passes the existing defined session entry; the command still reloads persisted state before choosing the next native binding. All 157 tests in that file, targeted lint, and formatting pass. Production source is unchanged from `2c163fd9eb57100ae3a2eec38cb6038e5f752851`. The complete affected owner suites passed on fresh merge `4b66a1a18209c21b5e92986452b2b98b95ae6fa1`, with parents `2c163fd9eb57100ae3a2eec38cb6038e5f752851` and main `a9a9a16114bea90d6eac90486356697df2462cb9`. All **28 complete canonical groups exited 0**: 46,971 labeled passes and 88 skips. Three cases are unlabelled in the native support summary; no status is inferred. This includes both fork-restoration cases and all four abort/timeout × established/replacement command cases. Complete current group membership, exact commands, numeric exits, and raw logs are retained. ```sh env -u NO_COLOR -u FORCE_COLOR node --import tsx scripts/ci-run-node-test-shard.mts ``` Hosted [CI run 34774482283, attempt 1](https://github.com/openclaw/openclaw/actions/runs/34774482283) passed except `checks-node-compact-small-32` and its aggregate gate. Its QA-profile routing assertion is **base-red**: the same test fails on plain main `a1105f105a093f768914a29c24b70d6ba406cad8` and fresh candidate/main merge `7ea7374fcf62570c9b3fa631cf17072ef5eda2d6`, both exit 1. openclaw#143968 (`41aebf15de48524e80c95f05e0c1212f2dfd29c6`) added `qa-profile-run-status.test.ts` as a sixth workflow reader without updating the five-target expectation. This PR changes none of those routing inputs. ```sh OPENCLAW_E2E_USE_PREBUILT_DIST=1 node scripts/run-vitest.mjs run \ test/scripts/test-projects.test.ts -t 'routes QA Profile Evidence' ``` ## Fork-claim correction Candidate `2c163fd9eb57100ae3a2eec38cb6038e5f752851` restores a committed fork claim after cancellation before a successor appears. Previously, restoration rejected the aborted signal, lost the fork marker, and let the next command resume the source directly. Cleanup now uses the existing current-owner settlement assertion. Stale session, lifecycle, writer, placement, and source-binding checks remain enforced. The regression fails on `e2ca5b29bfa09810aaa20eca8a1d0e85ced913c8`: the marker is absent and the next command receives `forkCliSessionOnResume=false`. After correction, both the recovery-error control and actual-signal cancellation pass; stored/cache markers and the source checkpoint remain, and the next command receives `forkCliSessionOnResume=true`. ```sh env -u NO_COLOR -u FORCE_COLOR node scripts/run-vitest.mjs run \ --config test/vitest/vitest.agents.config.ts \ src/agents/command/attempt-execution.cli.test.ts --maxWorkers=1 \ -t 'preserves a restored fork marker before a successor' ``` Fresh merge `54a5c90a8b4585f72842e380365b95263b05983d` has first parent candidate `2c163fd9eb57100ae3a2eec38cb6038e5f752851` and second parent main `e08263bdd3341031c219bb147638f23a1f4c3c03`. All **436 tests in seven complete focused files passed**, including command successor/flag cleanup, aborted pre-successor restoration, stale-store guards, returned interruption, thrown cancellation, auto-reply, and fork-runner siblings. This bounded rerun supplements the earlier complete suites. Both real Gateway cancellation shapes also passed on that merge: before output (zero assistant events) and after first output. Both next turns resumed the same native binding, logged `historyPrompt=none`, and recalled `PEBBLE-7429`. Both drivers exited 0. The new catalog regression uses the real command/store entry point with a mocked native runner; it proves next-turn fork routing, not a new live source-transcript isolation capture. Targeted lint passed, including max-lines: ```sh pnpm exec oxlint --config .oxlintrc.json \ src/agents/command/attempt-execution.ts \ src/agents/command/attempt-execution.cli.test.ts ``` Original red evidence remains intact. Exact commands, merge identities, numeric exits, and complete captures are retained. The complete affected-suite rerun and final-head CI classification are recorded above. ## Earlier evidence Validated corrected candidate `4fd555e5957f86289cf981ce4cf4b0bb1122c679` on temporary merge `d5f41d1cd6c9b603db32deec1d60c1ba93e7e04d`. Its parents are that candidate and main `e0ad90d2bc2effce521cbde79cec2be56cece725`. All 28 complete canonical CI groups for the affected agent, reply, scheduled-run, and fast test suites exited 0 on that merge. Reporters label **46,859 tests passed and 88 skipped**. The full command persistence matrix passed, including unfinished-successor and temporary-flag cleanup for abort and timeout, plus established-binding resume. Each complete group ran through the CI command, with its canonical configuration, include list and environment preserved: ```sh node --import tsx scripts/ci-run-node-test-shard.mts ``` These are the complete affected test suites on the recorded merge. Final-head CI and its reproduced base-red exception are recorded above. Initial host setup failures were retained, then resolved by removing conflicting color settings and making GNU timeout available without replacing existing command resolution. No source assertions or timeouts were relaxed. One native summary leaves three cases unlabeled; the raw count line is retained without assigning them a status. The real Gateway was also rerun from the merge with isolated state, workspace and port: ```sh OPENCLAW_CONFIG_PATH="$PROOF/openclaw.json" OPENCLAW_STATE_DIR="$PROOF/state" \ pnpm openclaw gateway --port 21978 --bind loopback ``` `chat.send` remembered a synthetic code, a second request started a long reply, `chat.abort` canceled it, and the next `chat.send` requested the code without repeating it. | Cancellation | Recorded main | Corrected merge | | --- | --- | --- | | Before output | Fresh native session; `UNKNOWN` | Same native binding; `PEBBLE-7429` | | After first output | Fresh native session; `UNKNOWN` | Same native binding; `PEBBLE-7429` | Both drivers exited 0. Both continuations logged `useResume=true` with the same native fingerprint and `historyPrompt=none`. The pre-output run had zero assistant events before cancellation. Original red captures, merge parents, selection, exact commands, numeric exits and complete logs are preserved. Final-head CI and its reproduced base-red exception are recorded above. ## Compatibility and prior behavior This deliberately changes the cancellation-only binding invalidation retained by openclaw#126883 and openclaw#128131. Partial output remains visible, interrupted turns remain unsuccessful, and successful authentication settlement remains suppressed. Expired-session recovery from openclaw#115513 and the retired-field migration from openclaw#143347 remain unchanged. There is no schema, migration, configuration, protocol, dependency, or permission change. ## Consumers Command attempts, auto-reply turns, and scheduled turns consume the binding result. History import, session freshness, catalog continuation, export, runtime selection, and detached-media continuation read the retained binding or its explicit absence. Catalog adoption seeds a binding with `forceReuse` and a one-shot fork marker. The command path claims that marker before execution and can persist a successor before final settlement. These writes require the current session, lifecycle, writer, and expected source binding. Successful settlement removes the temporary reuse flag; interrupted replacement cleanup removes the successor and flag together. An established binding remains available after cancellation. Cancellation before a fork successor appears restores the one-shot marker, so the next command must still fork from the source. Cache updates occur at the successful commit, and scheduled continuation publication follows base-session persistence. ## Evidence limits The real Gateway sequences cover cancellation before output and after the first output. Both failed on main `0c664785f82d3af6c2101efb53d7269d30261f4c` and passed at `f9c5b148cf4d92de5211315a4e8c374bef279d9d`. The next turn resumed the same native binding without replaying local history and recalled the seeded code. The initial 272 focused tests include command persistence and next-turn routing, auto-reply retention, failed-flush cleanup, and scheduled-run settlement. They ran on the branch based on `329bc5bf9694af38477f9fd45ebe47ad86b538a9`. The later fresh merge `d5f41d1cd6c9b603db32deec1d60c1ba93e7e04d`, recorded above, passed all 28 complete affected test groups and both real Gateway cancellation shapes. No browser-click or platform-specific UI claim is made. The two test suites that failed on the contributor head pass when applied to the refreshed main base and after correction. The original hosted failures were not reproduced in their original shard order, so their cause remains unclassified. No assertion or timeout was relaxed for this repair. ## Test ledger clarification - The ordinary-abort policy and command assertions now require retention instead of unconditional deletion. Command coverage also checks the subsequent resume. - The contributor-only interrupted-flush helper matrix was removed before the final diff because command persistence coverage supersedes it. - The retained interrupted-partial-output fixture now names an established reusable session. Its unchanged clear assertion independently protects failed transcript flush; its partial-output, unsuccessful-hook, timeout, and authentication assertions remain. - The new composition cases invoke `runAgentAttempt`, claim a fork, persist its successor, abort the actual signal, consume the production settlement result, reopen stored state, and check the next attempt. The channel regression invokes `executeAgentTurn`; the failed-flush regression invokes `runPreparedCliAgent`. Direct policy-unit assertions supplement these entry-point checks. The earlier head `e2ca5b29bfa09810aaa20eca8a1d0e85ced913c8` only replaces a retained unflushed ID with the equivalent condition at its two consumers. Review accepted that behavior-preserving delta. CI run [34769866871](https://github.com/openclaw/openclaw/actions/runs/34769866871) passed at attempt 2 on this exact head. Attempt 1 had one test failure in an unrelated QA binary-admission case; it passed on the retry without a code or timeout change and is recorded as a flake. Co-authored-by: Marvinthebored <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #120207
AI-assisted: Yes — implemented, tested, and reviewed with Codex; repaired and re-proved by a maintainer agent (see "Maintainer repair").
What Problem This Solves
Claude CLI live turns can stream useful assistant text before cancellation. The old abort path finalized the parser and rejected the turn without returning that text, so an interrupted reply disappeared completely.
The first version of this patch retained the text but settled it as an ordinary success. That would persist a normal
stoptranscript, emitagent_endwithsuccess: true, record a successful execution attempt, preserve native-session continuity, and invoke successful auth binding even though the live process had been aborted.Why This Change Was Made
The Claude live turn boundary now attaches an explicit
abortedortimeoutdisposition when finalized parser output contains usable partial text. The top-level CLI runner carries that disposition through transcript persistence, context-engine finalization, hooks, run metadata, execution traces, session binding, and auth settlement.Structured
FailoverErrorpaths, genuine provider failures, and interruptions without usable assistant text still reject. Completed turns retain their existing success behavior.User Impact
Users keep assistant text that arrived before a Claude CLI cancellation or caller deadline. The turn is still visibly terminal and non-successful, dead native continuity is cleared, and the interrupted run cannot be recorded as a successful auth binding.
Maintainer repair
Root cause:
failClaudeTurn(src/agents/cli-runner/claude-live-turn.ts) rejected every aborted turn, discarding text the streaming parser had already accepted. Owner: the Claude live turn boundary; settlement (cli-run-settlement.ts) and transcript (cli-run-transcript.ts) consume the recorded disposition instead of inferring it.Changes on top of the author's head
230cb5db04e:isSignalTimeoutReason, the same rulerun-diagnostics.tsuses): only aTimeoutErrorreason is a deadline. The author'sisTimeoutError+isPlainDomAbortErrorpair was message sniffing — the failover pattern list countsoperation was abortedas timeout-like, so a plain/stopabort classified astimeoutwithout the special case. The special case is gone; the rule is the owner's contract.cliSessionBindingClearedfact replaces three nested ternaries;formatCliTerminalInterruptionowns the recorded reason string (trace attempt +agent_enderror);resolveCliAssistantStopReasonowns the transcript stop reason (required param, no?? "stop"fallback). The redundantbindingFlushOkinterruption branch incli-runner.tsis removed — settlement already clears the binding from the recorded disposition.failClaudeTurnno longer re-arms idle close on the partial path; interruptions only arrive throughclose("abort"), where the host is already closing.claude live session aborted turn preserved partial output:is the stable operator-visible marker for this path (the Telegram E2E harness keys on it).bb6dba54ef9: +121/−43 (net +78); tests +255/−0. The net growth is the new disposition surface itself (terminalInterruptioninCliOutput, meta/trace/completion projections, auth-binding gate), not guard stacking.Evidence
Environment
openclaw/openclawbb6dba54ef97aac71b8c7a62db2b77b57b1b5e3e7ce8b85611d66a9d987173ebe652146b05957fe6v24.19.0Regression tests
src/agents/cli-runner/claude-live-session.abort-partial-output.test.ts(owner boundary): plain abort →aborted;TimeoutErrorreason →timeout;AbortErrorwrapping aTimeoutError→aborted(an abort, not a deadline);FailoverErrorstill rejects; empty-output abort still rejects. Pre-fix proof: withclaude-live-turn.tsswapped to basebb6dba54ef9, the three partial-output cases fail (turn rejects), the two still-reject cases pass.src/agents/cli-runner.interrupted-partial-output.test.ts(caller boundary): payload retained,meta.aborted/providerStarted/stopReason/timeoutPhase, trace attemptaborted|timeoutwith reason,agentMeta.sessionId: ""+clearCliSessionBinding, noonSuccessfulAuthBinding,agent_endsuccess: falsewith the partial assistant message atstopReason: "aborted".Local proof (exact head)
node scripts/run-vitest.mjs src/agents/cli-runner— 23 test files, 422 tests passed (agents-core + agents-support shards).pnpm tsgo,pnpm check:test-types,node scripts/run-oxlint.mjs <touched files>,node_modules/.bin/oxfmt --check <touched files>,git diff --check— all exit 0.ClawSweeper
Local ClawSweeper review on exact head
7ce8b85611d66a9d987173ebe652146b05957fe6(modelgpt-5.6-terra, reasoning high):overallCorrectness: patch is correct,reviewFindings: [], securitycleared(0 concerns), no maintainer decision. Two Rank-up moves, both proof requests (attach a redacted after-fix trace of an injected abort after streamed Claude output, showing the retained message, aborted terminal result, cleared native binding, and absent successful auth settlement) — satisfied by the Telegram E2E trace below plus the caller-boundary test for the settlement facts the live trace does not log. Re-run on the same head after attaching that evidence: PASS — 0 findings, security cleared, no maintainer decision, 0 Rank-up moves.Telegram E2E (real Telegram, managed Claude stdio fixture)
Exact head
7ce8b85611d66a9d987173ebe652146b05957fe6, builtdist(pnpm build, 0INEFFECTIVE_DYNAMIC_IMPORT), real Telegram DM through the QA user account,claude-clibackend with the provider-freepartial-output-abortstdio fixture (streams assistant text, then the harness injects/stop; zero provider requests).Redacted after-fix trace (
summary.json→claudeLiveFixture):{ "mode": "partial-output-abort", "operatorDiagnostic": "aborted", "telegramReplies": ["⚙️ Agent was aborted."], "providerRequests": 0, "partialOutput": { "streamedText": "OPENCLAW_E2E_PARTIAL_OUTPUT streamed before the abort arrived", "transcriptSessions": 1, "transcriptAssistantTexts": ["OPENCLAW_E2E_PARTIAL_OUTPUT streamed before the abort arrived"], "preservedInTranscript": true, "preservedInGatewayLog": true, "verdict": "fixed", "expect": "fixed", "ok": true } }Gateway log (isolated
logging.file, the run's own gateway), in order:Recorded Telegram timeline: user prompt at 4.7s → SUT typing →
/stopat 8.3s → one SUT message at 8.6s (⚙️ Agent was aborted., the non-success terminal outcome); the streamed assistant text is retained in the session transcript (session-transcripts.json, 1 session, assistant text = the streamed fixture line). Same harness onmain(bb6dba54ef9) before this PR:verdict: affected(transcript empty, no log marker).The live trace does not log session-binding or auth-settlement facts; those are pinned at the caller boundary by
src/agents/cli-runner.interrupted-partial-output.test.ts(agentMeta.sessionId: ""+clearCliSessionBinding: true,onSuccessfulAuthBindingnever invoked,agent_endsuccess: false, trace attemptaborted).Review Notes
reviewMetrics: production+121/-43; tests+255/-0; seven changed files.risks: the new disposition is set only after the finalized parser has non-empty assistant text and no parser error. Generic failover selection and empty-output rejection remain unchanged.bestSolution: carry interruption state with the already-normalized CLI output at the Claude live-turn owner boundary, then settle it once at the top-level runner instead of throwing away text or fabricating a successful completion.testAudit: the direct live-session table protects parser/abort behavior; the caller-boundary table independently protects terminal metadata, hooks, session clearing, and successful-auth suppression. Neither requires a test-only production seam.