Repository navigation
fix(claude-cli): preserve active foreground Agent calls past 15 minutes - #157248
Conversation
Semantic subagent records attributed to the active Agent or Task call renew the stuck-session clock. Raw stdout, partial deltas, and mismatched parents still do not. Parent-lane isolation stays. Fixes openclaw#157209
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 7:53 PM ET / 23:53 UTC (Revision 4). ClawSweeper reviewWhat this changesThe Claude CLI runner now credits meaningful child Agent records to an active parent Agent or Task call so long-running work can continue without being mistaken for a stalled tool. Regression provenancePossible regression — probable (failure trace; reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep open. Current main still lacks this progress path, and the branch has a bounded fix with credible production-boundary proof. I found no actionable patch defect. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw parses records from the Claude Code subprocess and tracks tool activity for the current agent run. Diagnostic recovery uses that activity to decide whether to wait for a reply or abort a stalled run. flowchart LR
A[Claude Code subprocess] --> B[JSONL parser]
B --> C{Attributed child record?}
C --> D[Active parent Agent call]
D --> E[Current run progress clock]
E --> F{Recovery decision}
F --> G[Continue or abort run]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +105, Tests +228. Total +333 across 9 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain current-run and matching-parent checks, preserve silent-tool recovery and parent-lane isolation, and handle the separate stream-budget problem in its own work. Do we have a high-confidence way to reproduce the issue? Yes. The contributor reports a baseline run through the process and diagnostic boundary that aborts at 900 seconds despite attributed child results; fetched main retains that same relevant path. I did not execute it in this read-only review. Is this the best way to solve the issue? Yes. The patch credits only attributed records for an active Agent or Task call while retaining recovery for silence and keeping child content out of the parent conversation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 374f893b896c. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
CI handoff for head
Neither failing test file is changed by this PR. I ran those two complete files locally on the PR head with |
|
Landed as e8e68ea. Attributed semantic subagent work now keeps the active foreground Agent/Task alive without leaking child content into the parent lane. Real-child CLI-runner proof: current main aborted at 900 simulated seconds; the fix completed at 960 seconds. Silent Agent and non-Agent Bash controls still aborted at 900 seconds. Focused tests, owner types, lint, exact-head CI, and hosted review passed. Thanks @Olli0103 for the fix and @OpenClawKobian99 for the detailed report! |
…es (openclaw#157248) ## What Problem This Solves Fixes foreground Claude CLI `Agent`/`Task` calls being killed after 15 minutes even while their subagents are working, losing the in-flight work and final reply. Fixes openclaw#157209. ## User Impact Long foreground Agent calls can finish while their attributed subagents continue making semantic progress. A genuinely silent tool still reaches the existing 900-second recovery floor. No configuration or migration is needed. ## Why This Change Was Made Only semantic child records attributed to an active parent Agent/Task call renew its progress clock. Tool calls, tool results, and completed assistant snapshots count; raw stdout, partial deltas, system chatter, mismatched parents, and non-Agent tools do not. The parser still drops child content before parent dispatch, preserving openclaw#125621. Output-budget behavior is unchanged and remains separate from this fix. ## Evidence A synthetic Claude executable was driven through `executePreparedCliRun`, the real process supervisor/child adapter, streaming parser, tool-event handlers, and diagnostic heartbeat. Time was advanced with fake timers at the diagnostic boundary; the production 900-second floor was not changed. The recovery callback aborted the actual child through the run's AbortController. Preparation/admission used the existing executor fixture, so this is CLI-runner boundary proof, not full Gateway E2E. No real Claude or paid provider was used. - Current-main baseline `3b5f5168783`: parent Agent starts; attributed child tool results arrive every 240 simulated seconds. Semantic progress stays at `tool:Agent:started`; recovery requests active abort at 900 seconds and the executor returns `AbortError: CLI run aborted`. - Candidate: the same child records renew `tool:Agent:subagent_progress`; at 960 seconds the parent completes with `parent-complete`, exit 0, and no recovery request. The tool summary contains only one Agent call; child results never appear in parent events. - Silent Agent control: abort at 900 seconds, with no attributed records. - Non-Agent Bash control: attributed child-shaped records do not renew progress; abort at 900 seconds. Parent events contain no child content. - Focused parser, executor, and backend-liveness suites plus the temporary real-child proof: 117 tests passed across three shards in 28.99 seconds. The temporary proof is not added to routine CI. Existing coverage also rejects mismatched parent IDs and partial deltas and checks that progress followed by silence eventually aborts. - Type-aware lint on all nine changed files passed. Focused `core-test-agents-root`, `core-test-agents-other`, and `core-test-state-logging` type graphs passed (9.4s, 9.4s, 6.4s). Formatting and `git diff --check` passed. The earlier contributor evidence additionally records an installed Claude Code 2.1.243 foreground Agent run lasting 991 wall-clock seconds: 19 child Bash calls, 59 accepted semantic-progress callbacks, exit 0, and final marker `PROOF-COMPLETE-157248`. That earlier harness manually established the active tool; the synthetic executor proof above exercises that connection without a paid provider. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes foreground Claude CLI
Agent/Taskcalls being killed after 15 minutes even while their subagents are working, losing the in-flight work and final reply.Fixes #157209.
User Impact
Long foreground Agent calls can finish while their attributed subagents continue making semantic progress. A genuinely silent tool still reaches the existing 900-second recovery floor. No configuration or migration is needed.
Why This Change Was Made
Only semantic child records attributed to an active parent Agent/Task call renew its progress clock. Tool calls, tool results, and completed assistant snapshots count; raw stdout, partial deltas, system chatter, mismatched parents, and non-Agent tools do not. The parser still drops child content before parent dispatch, preserving #125621. Output-budget behavior is unchanged and remains separate from this fix.
Evidence
A synthetic Claude executable was driven through
executePreparedCliRun, the real process supervisor/child adapter, streaming parser, tool-event handlers, and diagnostic heartbeat. Time was advanced with fake timers at the diagnostic boundary; the production 900-second floor was not changed. The recovery callback aborted the actual child through the run's AbortController. Preparation/admission used the existing executor fixture, so this is CLI-runner boundary proof, not full Gateway E2E. No real Claude or paid provider was used.74469f58f38: parent Agent starts; attributed child tool results arrive every 240 simulated seconds. Semantic progress stays attool:Agent:started; recovery requests active abort at 900 seconds and the executor returnsAbortError: CLI run aborted.tool:Agent:subagent_progress; at 960 seconds the parent completes withparent-complete, exit 0, and no recovery request. The tool summary contains only one Agent call; child results never appear in parent events.core-test-agents-root,core-test-agents-other, andcore-test-state-loggingtype graphs passed (9.4s, 9.4s, 6.4s). Formatting andgit diff --checkpassed.The earlier contributor evidence additionally records an installed Claude Code 2.1.243 foreground Agent run lasting 991 wall-clock seconds: 19 child Bash calls, 59 accepted semantic-progress callbacks, exit 0, and final marker
PROOF-COMPLETE-157248. That earlier harness manually established the active tool; the synthetic executor proof above exercises that connection without a paid provider.