Repository navigation
fix: stop yielded commands from channel /stop - #166764
Conversation
|
🦞👀 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 changes before merge. Reviewed October 8, 2026, 12:11 AM ET / 04:11 UTC (Revision 6). ClawSweeper reviewWhat this changesChannel Stop commands cancel and join cleanup of captured request-owned shell commands while preserving independent services and later user work. Example: The user sends /stop after an ordinary command yields a process handle
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains This PR remains useful and has no actionable source finding, but needs real behavior proof before merge under the repository’s Telegram Test Server requirement. The new local-provider ingress evidence strengthens coverage without satisfying that specific requirement. Likely related people: shakkernerd and steipete (high-confidence routing), and jalehman (medium-confidence routing). Priority: P1 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherChannel commands enter OpenClaw’s reply handlers, which select the session’s running and queued work. The cancellation owner signals selected model runs and shell processes, waits for cleanup, and returns the Stop acknowledgment. flowchart TD
A[Channel Stop command] --> B[Sender and session authorization]
B --> C[Capture selected request and queued work]
C --> D[Cancel selected runs and ordinary commands]
D --> E[Join process cleanup]
E --> F[Stop acknowledgment or cleanup error]
C --> G[Preserve later work and independent services]
Technical reviewBest possible solution: Retain the shared request cancellation owner and complete the required channel-boundary verification before landing. Do we have a high-confidence way to reproduce the issue? Yes, source establishes a focused reproduction: start an ordinary yielded shell command through a channel, then send /stop; current main’s channel abort owner does not join its process cancellation. No target code was executed in this review. Is this the best way to solve the issue? Yes, reusing the existing request cancellation owner is the narrow maintainable repair, with captured ownership preserving later work and independent services. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9215ac23bb42. Provenance checked
TestingProof path: shipped entry point. Added test files: 8. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +195, Tests +635, Docs 0, Other -3. Total +827 across 20 files. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (5 earlier review cycles)
|
9e006fd to
1b79448
Compare
e9447d6 to
c10696a
Compare
|
@clawsweeper re-review The missing ingress evidence is now attached in the PR body for |
|
🦞👀 Re-review progress:
|
|
Fixed: channel /stop now waits for its selected ordinary commands to stop while preserving independent services and later human work. |
Connect channel /stop to request-owned command cleanup, preserving independent services and later human work.
What Problem This Solves
Channel
/stopcould abort a reply while leaving its ordinary shell command running after the tool returned a process handle. Completed model replies could also leave request-owned commands behind. Both channel command paths were affected.User Impact
An authorized
/stopcancels the selected request's ordinary commands and joins their cleanup. Cleanup errors are reported. Explicitbackground: trueservices and completed model receipts are preserved.Stop captures parent runs, command owners, and queued input before asynchronous descendant preparation. Later human work keeps its model run, commands, queued input, and active MCP lease. Native retries and compaction remain attached to the same admitted request; replacement instances and renewed or revoked authority claims are excluded.
Why This Change Was Made
Both channel paths now use the request cancellation owner delivered in #166753. Explicit reply abort carries the direct Stop reason. The normal command path starts selected descendant cancellation before joining accepted parent cleanup, so a cleanup failure cannot prevent that traversal; rejection before acceptance still prevents it.
Abort bookkeeping checks the captured session and writer identity, including a captured absence. A later writer is not marked aborted, and a future request receives no stale continuation hint.
Evidence
The correction passed 112 cases across seven affected test files through scoped remote runs, plus retained proof for 16 unchanged reply-registry cases. Coverage includes real supervised processes, both channel paths, cleanup failures, later-human races, queue ownership, active MCP leases, writer replacement, and admitted native retries/compaction. All selected compiler coverage and changed formatting/lint passed. The mock-export baseline shrank by three resolved entries.
Regression controls reproduce commands surviving the original abort owner, an unobserved cleanup rejection, descendant traversal skipped after parent cleanup failure, six later-human capture failures, three MCP/writer failures with valid fixtures, and two native retry/compaction failures. The corrected paths pass.
With
pnpm test <file> --maxWorkers=1, the latest store and native-run suites passed 38 cases in 33.52 seconds across two native test groups (25.15 and 5.23 seconds in Vitest). The real process boundary and database-worker setup account for most channel-suite cost. Final hosted timing is pending.The branch is reconciled onto the landed prerequisite. The current main composition passed 260 cases across 16 owner and integration files, 13 affected structural checks, seven selected compiler graphs, and the full private-QA build. The integration tests took 295.11 seconds across six native shards; the build took 353.42 seconds. Earlier broad baseline results retain their original source identities and are reused only where their inputs remain applicable.
The existing native-Stop trigger fixture now registers a real native run and checks its cancellation. All 20 cases in that file passed, with cleanup, in 63.83 seconds in Vitest and 81.82 seconds in the native test wrapper. Changed formatting/lint and the messaging test type graph passed.
Actual native
/stopingress passed on head220cea25068bb5b4d66a47295b353cc6498e9139through the real Telegram plugin against Crabline's local provider. The scripted model started two real processes: an ordinary command usingyieldMsand an independent service usingbackground: true. Both were alive before Stop. At the observed cancellation acknowledgment, the ordinary process was absent and the service remained alive. A later human message received its reply. Stop caused no extra model request; the complete flow used four. All fixture processes, Gateway, transport and provider cleaned up successfully without fallback signals.Sanitized execution receipt, reproduction instructions, driver, and process fixture. The driver correlates actual tool-call results and PID/start-time/executable identities, then checks process state synchronously when the acknowledgment is observed. This is local-provider Telegram evidence; existing owner tests separately cover later-human work arriving during Stop preparation. The retained build is qualified by unchanged production inputs between its source and this test-only final head.
Current-head CI passed all 106 executed jobs. The 23 skipped jobs remain skips. Independent engineering review found no outstanding defect.