Repository navigation
Description
Context
Tools receive an AbortSignal parameter in their execute() signature but currently ignore it (typed as _signal). When a run is interrupted (abort, force-detach), the tool continues executing to natural completion, blocking the old run's cleanup and wasting resources.
Current Behavior
process poll --timeout 30000: 250ms tick loop continues for full duration after abortsessions_send: HTTP connection to gateway hangs until timeout (callGatewayhas no cancel mechanism)- All other tools: blocked until natural return
The old run cannot complete its finally block until the tool returns, keeping the ReplyOperation alive.
Key Findings from PR A/B/C Implementation
Tool results persist in conversation history before abort check
pi-agent-core's executeToolCalls always pushes tool results to currentContext.messages before checking stopReason === "aborted" in the next loop iteration. This means:
- New runs can see old tool results (session IDs, run IDs, file paths) in conversation history
- Agents can theoretically resume operations by reading history — e.g., re-polling a process session ID from a previous run's tool result
- This is an implicit "resume" mechanism that doesn't require explicit framework support
forceDetach no longer notifies global waiters
As of #65221, forceDetachEmbeddedRun no longer calls notifyEmbeddedRunEnded. Concurrent waiters (session-reset, session management) time out naturally rather than receiving a premature idle signal. This means the detached run's continued tool execution doesn't create false-idle signals for other code paths.
Tool-by-tool analysis after interrupt
| Tool | Process survives? | New run can resume? | Worth adding signal handling? |
|---|---|---|---|
exec (start) |
Yes (bash registry) | Yes, via session ID in history | No — don't kill process |
process poll |
N/A (no process) | N/A | Yes — stop 250ms tick loop |
sessions_send |
Child run continues | Orphaned (no cancel for callGateway) |
Known limitation |
browser |
State persistent | Yes | No special handling needed |
| Short-lived tools | Complete before abort | N/A | Not worth handling |
Design Questions
1. Per-tool vs framework-level
Per-tool: Each tool manually checks the signal and returns early. Pros: can return meaningful partial results. Cons: every new tool needs explicit handling; easy to forget.
Framework-level (Promise.race wrapper): Wrap every tool.execute() call with a race against the abort signal at the agent-core layer. Pros: automatic coverage for all tools. Cons: tool continues running in background; no partial results; tool result in conversation history becomes "interrupted" rather than actual output.
2. Interrupt vs steer semantics
The current AbortSignal maps to interrupt semantics (kill old run, start new). For steer mode, tools need a different signal — "there is a steering message, yield back to the agent loop so it can be processed" — rather than abort.
Should tools receive a second signal/callback for steer awareness? Or should the framework race against the steering queue?
3. Partial results
When a tool is interrupted mid-execution:
- Should the partial result (e.g., last 5 seconds of
process polloutput) be preserved in conversation history? - If using framework-level race, the real tool result is lost — only "Tool execution interrupted" appears in history
- Note: even without explicit partial results, tool results from previous calls in the same run ARE preserved (see "Key Findings" above)
4. Resource cleanup
process poll: Stop tick loop, but keep underlying exec process alive (new run can resume polling)sessions_send: No way to cancelcallGatewayHTTP call currently — connection leaks until timeoutexec(process start): Process should never be killed on abort — only the poll
Proposed Approach
Layered:
- Framework-level safety net (new): Race
tool.execute()against abort signal at the agent-core wrapper level. Guarantees no tool can block the agent loop indefinitely. One change covers all tools. - Per-tool optimization (opt-in): Tools that can meaningfully handle interruption check the signal themselves and return partial results. Framework race becomes a fallback.
This does not depend on PR C (abort-signal-propagation branch) — it can be built directly on top of the merged PR A + PR B codebase.
Related
- fix: resolve interrupt scheduling race between embedded run and ReplyOperation registries #65221 — Interrupt scheduling race fix (PR B, documents tool continuation as known limitation)
- fix: use isActive+isStopped instead of isStreaming for steer message injection #65010 — Steer gate fix (PR A)
- fix(telegram): bypass grammY sequential key for interrupt/steer message delivery #65222 — Telegram delivery bypass (PR C, includes debouncer bypass)
- Inbound debouncer keyChains re-serializes steer messages, making per-message grammY keys ineffective #64951 — Inbound debouncer keyChains issue (closed, resolved by fix(telegram): bypass grammY sequential key for interrupt/steer message delivery #65222)
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
jetd1 commentedon Apr 12, 2026
Added labels request:
enhancement+agents. (Can't add from fork — maintainers please tag if appropriate.)This is a design discussion for framework-level tool abort signal handling. The prerequisite fixes are in PR #65010 (A) and #65221 (B). Would love input from anyone working on the agent runtime — cc @tyler6204 @joshavant @gumadeiras.
openclaw-barnacle commentedon Apr 12, 2026
Please don’t spam-ping multiple maintainers at once. Be patient, or join our community Discord for help: https://discord.gg/clawd
clawsweeper commentedon Apr 27, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 3, 2026, 1:04 AM ET / 05:04 UTC.
Summary
Codex review failed: codex execution failed.
Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.
Ways to help us reproduce this
Next step
Review did not complete, so no work-lane recommendation was made.
Review details
Best possible solution:
Retry the Codex review after fixing the execution failure.
Do we have a high-confidence way to reproduce the issue?
Unclear. The review failed before ClawSweeper could establish a reproduction path.
Is this the best way to solve the issue?
Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.
AGENTS.md: unclear because the file could not be read completely.
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against c0c4156b6dc9.
Label changes
Label changes:
issue-rating: 🦪 silver shellfish: Current issue advisory state selects this label.clawsweeper:needs-info: Current issue advisory state selects this label.P2: Current review triage priority is none.clawsweeper:no-new-fix-pr: Current issue advisory state no longer selects this label.clawsweeper:needs-maintainer-review: Current issue advisory state no longer selects this label.clawsweeper:needs-product-decision: Current issue advisory state no longer selects this label.clawsweeper:source-repro: Current issue advisory state no longer selects this label.impact:session-state: Current review selected no impact labels.impact:crash-loop: Current review selected no impact labels.issue-rating: 🦞 diamond lobster: Current issue advisory state no longer selects this label.Evidence reviewed
What I checked:
Likely related people:
How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.openclaw-barnacle commentedon Jun 3, 2026
This issue has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.
openclaw-barnacle commentedon Jun 12, 2026
Closing due to inactivity.
If this is still an issue, please retry on the latest OpenClaw release and share updated details.
If you are absolutely sure it still happens on the latest release, open a new issue with fresh steps to reproduce.