Skip to content

fix: stop yielded commands from channel /stop - #166764

Merged
shakkernerd merged 4 commits into
mainfrom
fix/stop-channel-exec
Oct 8, 2026
Merged

shakkernerd merged 4 commits into
mainfrom
fix/stop-channel-exec

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Channel /stop could 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 /stop cancels the selected request's ordinary commands and joins their cleanup. Cleanup errors are reported. Explicit background: true services 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 /stop ingress passed on head 220cea25068bb5b4d66a47295b353cc6498e9139 through the real Telegram plugin against Crabline's local provider. The scripted model started two real processes: an ordinary command using yieldMs and an independent service using background: 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.

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M labels Oct 7, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed October 8, 2026, 12:11 AM ET / 04:11 UTC (Revision 6).

ClawSweeper review

What this changes

Channel 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

  • Before: The reply can stop while the ordinary command keeps running.
  • After: Stop waits for the ordinary command to terminate while a service started with background: true remains alive.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The repair is useful and source-clean, with stronger ingress evidence, but the specific Telegram proof gate remains unresolved.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: The user stops a channel reply, but its yielded shell command can keep running.
Reason: Stop should terminate the selected request’s ordinary commands. The change extends the already-landed request cancellation design to the remaining channel owners without adding configuration or a competing lifetime owner.

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
Reviewed head: 220cea25068bb5b4d66a47295b353cc6498e9139

Before merge

  • Complete next step (P2) - Attach Telegram Test Server userbot proof of yielded-command cleanup before Stop acknowledgment while preserving the independent service. Redact IP addresses, credentials, phone numbers, and private endpoints. Updating the PR body triggers fresh review; otherwise a maintainer can comment @clawsweeper re-review.

Findings

None.

Tests

  • Missing end-to-end proof: The reported local-provider run reaches production Telegram ingress, but no Telegram Test Server userbot result demonstrates ordinary-command cleanup before acknowledgment with the independent service preserved. Contributor-reported negative controls were read; base/head tests were not rerun during this read-only review.
Agent review details

How this fits together

Channel 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]
Loading

Technical review

Best 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

Testing

Proof path: shipped entry point. Added test files: 8.

Security

None.

Evidence

What I checked:

  • Pinned patch inspected: Reviewed the verified merge-base-to-head delta rather than endpoint drift; the checkout remained clean and git diff --check passed. (220cea25068b)
  • Current main still needs channel integration: Current main’s channel abort owner signals reply and embedded runs and retires MCP state, but does not capture or settle request-owned shell commands. The merged prerequisite fix: stop yielded commands with their Gateway request #166753 explicitly leaves channel cancellation to a separate owner. (src/auto-reply/reply/abort-operation.ts:44, 9215ac23bb42)
  • Existing cancellation owner reused: The branch captures shell-command owners before asynchronous preparation and joins their cleanup through the existing process cancellation owner; both channel command paths consume this operation. (src/auto-reply/reply/abort-operation.ts:45, 220cea25068b)
  • Negative authority and isolation coverage: The changed owner tests use real supervised processes to check that denied and stale dispatch leave commands untouched, accepted Stop terminates ordinary commands, independent services survive, and cleanup failures remain observable. Additional cases cover later turns, other agents, queue ownership, and replacement writers. These tests were inspected, not executed during this read-only review. (src/auto-reply/reply/abort.target-owner.test.ts:188, 220cea25068b)
  • New ingress evidence and access limitation: The complete PR body and re-review comment report exact-head native Stop ingress through the real Telegram plugin against Crabline’s local provider: both processes were initially alive, the ordinary process was absent at acknowledgment, the independent service survived, a later turn replied, and teardown completed. The linked receipt and scripts could not be opened because their Cloudflare artifact domain is outside the review proxy allowlist. This access failure is reviewer infrastructure, not evidence that the run failed. Captured context source identity: 6c971f7869c4e952be5eb18c7e2c63a87f5ae045d804c6381486e0eb9b86d942. (220cea25068b)
  • Specific Telegram proof requirement remains: Root policy states: “Telegram claims need Test Server userbot proof (Convex-leased credentials).” The previous review requested that environment, and the new evidence expressly identifies a local provider. No Test Server evidence or applicable override was supplied. (AGENTS.md:118, 220cea25068b)

Likely related people:

  • shakkernerd: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • jalehman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

PR surface

Source +195, Tests +635, Docs 0, Other -3. Total +827 across 20 files.

View PR surface stats
Area Files Added Removed Net
Source 9 326 131 +195
Tests 9 789 154 +635
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 3 -3
Total 20 1116 289 +827

Review metrics

Metric Value Why it matters
Production and regression growth Production net +195 lines; tests net +634 lines Production growth implements capture-before-await ownership and cleanup joining, while most growth exercises process failures and later-turn isolation.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Channel Stop can acknowledge cancellation while a request-owned shell command continues executing.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. Telegram users observe the changed Stop acknowledgment and command lifetime, so the repository’s Test Server userbot proof applies.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted Telegram Test Server userbot evidence showing ordinary-command termination before Stop acknowledgment while the independent background service survives.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (5 earlier review cycles)
  • reviewed 2026-10-07T22:05:34.267Z sha 694c0a8 :: needs changes before merge. :: none
  • reviewed 2026-10-07T22:52:33.708Z sha e9447d6 :: blocked before merge. :: none
  • reviewed 2026-10-08T02:00:53.478Z sha e9447d6 :: blocked before merge. :: none
  • reviewed 2026-10-08T02:44:49.260Z sha c10696a :: needs maintainer review before merge. :: none
  • reviewed 2026-10-08T03:51:37.141Z sha 220cea2 :: needs changes before merge. :: none

Base automatically changed from fix/stop-owned-exec to main October 8, 2026 01:54
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: XL and removed size: M labels Oct 8, 2026
@clawsweeper clawsweeper Bot added proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 8, 2026
@shakkernerd
shakkernerd force-pushed the fix/stop-channel-exec branch from e9447d6 to c10696a Compare October 8, 2026 02:36
@openclaw-barnacle openclaw-barnacle Bot removed app: web-ui App: web-ui gateway Gateway runtime labels Oct 8, 2026
@shakkernerd shakkernerd self-assigned this Oct 8, 2026
@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The missing ingress evidence is now attached in the PR body for 220cea25068bb5b4d66a47295b353cc6498e9139. The real Telegram plugin consumes a native command through Crabline's local provider, reaches the production Stop owner, and physically terminates the ordinary command before the observed acknowledgment while preserving the independent service. A later human turn and complete fixture cleanup also pass. The receipt and reproducible scripts distinguish this local provider proof from external Telegram service coverage; existing owner regressions retain the overlapping later-human race coverage.

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@shakkernerd
shakkernerd merged commit b9533fb into main Oct 8, 2026
209 checks passed
@shakkernerd
shakkernerd deleted the fix/stop-channel-exec branch October 8, 2026 04:23
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: channel /stop now waits for its selected ordinary commands to stop while preserving independent services and later human work.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 9, 2026
Connect channel /stop to request-owned command cleanup, preserving independent services and later human work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant