Skip to content

fix(gateway): cancelled tasks no longer continue running - #118358

Merged
obviyus merged 13 commits into
openclaw:mainfrom
peter3n:fix/gateway-cli-cancel-session-lanes
Sep 5, 2026
Merged

obviyus merged 13 commits into
openclaw:mainfrom
peter3n:fix/gateway-cli-cancel-session-lanes

Conversation

@peter3n

@peter3n peter3n commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Cancelling an ordinary Gateway-owned agent task could report success while its real run and foreground command continued. The CLI excluded all cli tasks from Gateway cancellation. The shared registry then changed the task record without aborting the run.

Why This Change Was Made

The Gateway producer now binds the task to its exact live run owner. The shared task canceller uses that capability, reuses the canonical chat-abort operation, and waits for the producer's actual completion before confirming cancellation.

The binding checks task scope, session, controller, operational instance, lifecycle generation, and current authority. A copied run ID cannot select replacement work. Early lifecycle events cannot finish the task record before the producer settles. Gateway shutdown joins the same completion promise.

The CLI now reaches that shared Gateway path and uses one result formatter. Background commands keep their existing process-control owner. The incoming health and lane-age additions were removed.

The producer also carries its final redacted diagnostic with the existing private result metadata. Failed and timed-out tracked tasks retain that diagnostic after settlement. The existing SDK outcome carrier and JSON response shape stay unchanged.

User Impact

  • Cancelling a running ordinary task stops its exact run and closes its pending approvals.
  • Missing, terminal, ownerless, or unconfirmed cancellation does not report a new success.
  • Unrelated runs and approvals remain usable. A normal subsequent request can complete.
  • Operator-supplied cancellation reasons are retained.
  • No schema, migration, protocol, configuration, or monitoring-policy surface is added. Existing agent-result wire vocabulary and other runtime cancellation owners remain unchanged.

For records left behind by a crash or upgrade, keep the Gateway running so its existing maintenance pass can reconcile missing live CLI contexts as lost. Use openclaw tasks audit and openclaw tasks maintenance to inspect the result. Offline maintenance does not guess Gateway liveness. See task maintenance.

Evidence

Baseline: d3adc01d75e2b189732bd4d86c6b3be3cfa7e03e.
Current source head: a11633d9101a6b2e170f263d2cee0e761e591043.
Runtime product-proof head: ac9113aec97e32230207cc68bbff3f87d1970218.
Integration base: 4311b45631b3f9aeee6a69e1a5b1e0a22cb17234.
Retained crash/upgrade and deadline-diagnostic proof: bbe8c7889ee58ccb22debfc3b65d9f97b6758cf8.

Both sides used the real packaged Gateway, normal authentication, a real supported locally served model, and an owned workspace. Task, session, and run identities came from the shipped tasks API. The foreground calls actually used exec with yieldMs: 120000, timeoutSeconds: 180, and background: false.

Product path Before After
openclaw tasks cancel Printed cancellation success; the same foreground command kept writing ticks. The run eventually timed out. Confirmed cancellation; the tool returned Aborted, ticks stopped, and the command never wrote its completion marker.
Gateway tasks.cancel Returned cancelled: true; the command wrote six more observed ticks, finished, and the agent replied DONE. Stopped the exact run, retained the supplied reason, and reported a cancelled task without successful agent completion.
Approval waiting Not claimed as baseline proof. Two real runs waited for approval. Cancelling one removed only its approval. Its old /approve command was rejected as unknown or expired. The other approval remained valid, and its approved command completed.
Other work Not claimed as baseline proof. A concurrent foreground run completed. Old-terminal and missing cancellation left same-session replacement work running; that request completed normally. Real background-exec cancellation also passed.
Crash and upgrade A real task and approval were created by the baseline package, then its isolated Gateway was stopped before the command began. The final package reopened the same state. Cancellation refused the ownerless row. Existing maintenance reported it as lost. Its old approval was cancelled for Gateway restart and could not execute. A newly approved command completed.
Deadline diagnostic Covered by the separate failing regression tests. A real one-second agent deadline produced a timed-out task with a useful diagnostic. This live case supplements, rather than replaces, the tracking-enabled resolved-result tests.

Earlier bbe8c788 approval flow: CLI cancellation removes the selected approval; its stale approval command is refused; the other approval remains usable and its command completes. Playback is 3×. The synthetic workspace path is redacted.

task-cancellation-final-v2.mp4

Fresh ac9113ae approval proof: two pending approvals, selected cancellation, stale approval refusal, and the other approved request completing. Playback is 3×; the synthetic workspace row is redacted.

task-cancellation-ac9113ae.mp4

The original failing CLI reproduction was preserved, not replayed during fixture corrections. Each valid package and each failed preparation attempt was retained. The current-main integration preserved the received-work lifetime owner from #136146 and received fresh package, test, and live verification.

The first CI correction used the canonical deferred helper and completed a sibling Gateway context fixture. The next CI run exposed a newly merged main test that imported the moved abort-operations helper from its old module. This head integrates that main change and updates the caller's import without a compatibility alias or media-policy change.

This integrated head received a fresh canonical package build and install. All 37,906 tracked source entries matched the exact commit before build and provider execution. Fresh live proof passed CLI and Gateway foreground cancellation, concurrent work, terminal/missing controls, same-session replacement, background exec, and two real approvals. The selected approval was cancelled; its stale command was refused; the other actual Allow once action completed its command and agent turn. Effective model context remained 32,768 tokens, with no serving-runtime truncation.

Regression and sibling checks: All 777 tests in 22 files passed on ac9113ae. This includes the eight-case new-main attachment fixture and the managed-worktree snapshot case previously blocked by disk capacity. Earlier failed runs remain in the evidence history. One new test launch stopped before collection because the copied experimental test cache was stale after the lockfile changed; a fresh isolated cache fixed the harness setup without changing source or assertions. The canonical package build and integrity check passed separately.

The final documentation-only follow-up corrects the cancellation contract in Background tasks. A full 37,906-entry source comparison confirms that only docs/automation/tasks.md changed after the runtime proof. The prior package contains the prior guide text; it is not relabelled as the documentation head. Runtime source, dependencies, test code and proof inputs are unchanged. pnpm docs:list, the full MDX check (752 files), and pinned formatting passed. The anchor audit resolved the changed task link; its one remaining failure is the external ClawHub-derived /clawhub/cli#package-transfer-name link, outside this diff. This separate mirror-anchor mismatch is retained as a follow-up, not reported as a passing full anchor audit.

The cancellation regression first failed on baseline because the real dispatch controller was not aborted. Three diagnostic cases separately failed for missing task errors, then passed after the producer-owned repair. Coverage includes delayed settlement, completion winning the race, changed task/session/controller/entry/lifecycle/authority, retained callbacks, replacement-owner cleanup, store reload, settlement timeout, and callback-secret redaction without changing JSON. Malformed-association cases are owner-boundary fault-injection tests, not seeded-row live demonstrations.

Verification commands and scope

Run in an isolated Linux environment with Node 24 and a private test cache; private artifact destinations are omitted below. This command is the current integrated-head suite.

OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs \
  src/gateway/server-methods/agent.test.ts \
  src/gateway/server-methods/tasks.test.ts \
  src/tasks/task-registry.test.ts \
  src/tasks/task-executor.test.ts \
  src/commands/tasks.test.ts \
  src/plugins/runtime/runtime-tasks.test.ts \
  src/plugins/runtime/runtime-taskflow.test.ts \
  src/gateway/chat-abort.test.ts \
  src/gateway/chat-abort.authority.test.ts \
  src/gateway/server-worker-placement-cancel.test.ts \
  src/gateway/server-methods/sessions-abort.test.ts \
  src/gateway/agent-turn/agent-run-execution-phase.owner.test.ts \
  src/gateway/server.agent-execution-shutdown.test.ts \
  src/gateway/exec-approval-manager.lifetime.test.ts \
  src/gateway/server.approval-request-lifetime.test.ts \
  src/gateway/server-in-process-execution-lifetime.test.ts \
  src/gateway/agent-turn/agent-content-phase.test.ts \
  src/gateway/server-methods/chat-send-attachments.cancel.test.ts \
  src/agents/command/lifecycle.test.ts \
  src/channels/turn/agent-run-terminal-outcome.test.ts \
  src/commands/agent.test.ts \
  src/commands/agent.acp.test.ts
  • Changed-file formatting and type-aware lint: no errors or warnings.
  • pnpm check:import-cycles: zero runtime value cycles.
  • git diff --check: passed.
  • Canonical package build and tarball inventory/import-graph integrity: passed.
  • All 37,906 tracked source files, symlinks, and executable modes matched the tested Git revision before build and provider execution.
  • Current package SHA256: d534c751d442d5a1d293460b7922bab0e936b3f33ae08c275fc3453c51cd868a.
  • Runtime-head CI passed: run 33942486912. Its independent P0 review is clean. The documentation follow-up receives fresh exact-head review and CI before landing.

ClawSweeper disposition: All three current rank-up moves are addressed: producer-owned diagnostics with tracking-enabled red/green tests; real cancellation and ownerless upgrade recovery; and integration with main's execution-lifetime owner. Store-reload and settlement-timeout controls cover the lifetime risks. The prior background-exec, exact-instance binding, and cancellation-reason findings are also addressed. The old malformed historical receipt is not relied upon.

The stored-data warning points to task-registry.process-state.ts, but runOwners is an in-process Map, not serialized state. It is not restored after restart. The real upgrade control demonstrates that a persisted old task does not regain cancellation authority. No durable field, schema, migration, or maintenance policy was added.

The 02:55 UTC review's external-helper inspection gap is resolved: the actual installed @openclaw/fs-safe 0.7.2 source and types were read directly. withTimeout races the original producer promise against a rejecting timer and clears that timer in finally; it does not synthesize completion or cancel the original promise. The settlement-deadline regression confirms that an unsettled producer cannot return cancellation success. The review reports no actionable code finding and itself confirms that no stored model was introduced; its repeated migration checklist is not an additional schema change.

The latest 03:49 UTC review's late P3 and rank-up move are addressed: the guide now documents the running Gateway requirement, exact-run and approval shutdown, confirmed settlement, honest refusals and existing audit/maintenance recovery. Its independent access limitation for the helper and videos does not invalidate the retained inspected source, recordings and real results.

Size and ownership: production +249/−93 (net +156); tests/support +449/−96 (net +353); docs +4/−2, relative to the integration base. Two reset-only lines in a production file are classified as test support; moved abort construction is neutral in the net count. The new capability binds a durable task to its live producer and confirmed completion, neither of which a task row or run ID alone provides. Private producer diagnostics preserve the existing terminal result while delayed settlement prevents false cancellation success. Duplicate CLI result handling was removed, and abort-operation construction was moved without a compatibility alias.

Original report and contributor work: @peter3n. The original commits remain in the branch ancestry. AI-assisted repair and verification.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M labels Aug 3, 2026
@peter3n
peter3n marked this pull request as ready for review August 3, 2026 01:40
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 4, 2026, 11:49 PM ET / September 5, 2026, 03:49 UTC.

ClawSweeper review

What this changes

Makes ordinary Gateway task cancellation stop the exact agent run, wait for completion, and preserve its final diagnostic.

Merge readiness

⛔ Blocked before merge - 3 items remain

This remains a useful fix: current main and the latest release retain the false-success cancellation path. Prior runtime findings are addressed; one operator-documentation mismatch remains.

Priority: P1
Reviewed head: ac9113aec97e32230207cc68bbff3f87d1970218

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent runtime repair with strong supplied before/after evidence and one small documentation correction.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The captured body ties packaged, authenticated Gateway runs to the changed producer: CLI/API cancellation stops foreground commands, stale approvals cannot execute, unrelated work completes, and restart recovery refuses ownerless authority. These supplied observed results satisfy the changed path; linked recordings were not independently reopened because DNS failed.
Patch quality 🐚 platinum hermit (4/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured body ties packaged, authenticated Gateway runs to the changed producer: CLI/API cancellation stops foreground commands, stale approvals cannot execute, unrelated work completes, and restart recovery refuses ownerless authority. These supplied observed results satisfy the changed path; linked recordings were not independently reopened because DNS failed.
Evidence reviewed 11 items Pinned introduced change: Reviewed the merge-base-to-head changes. The relevant runtime files are unchanged since the previous reviewed head; the supplied test merge is stale and was not used to infer removals from current main.
Current-main defect remains: Ordinary CLI tasks bypass runtime cancellation and reach the registry-only cancellation update; the CLI also still excludes those tasks from Gateway dispatch.
Latest-release behavior: The supplied latest release, v2026.9.1, also contains the ordinary-CLI bypass. This is not an already-shipped repair.
Findings 1 actionable finding [P3] [P3] Update the documented CLI task cancellation contract
Security None None.

How this fits together

The task ledger records work executed by the Gateway. CLI and API cancellation requests now reach the live execution owner, which aborts the run and its approvals before confirming the task outcome.

flowchart TD
  A[CLI or API cancellation] --> B[Task access check]
  B --> C[Task ledger]
  C --> D{Exact live owner exists?}
  D -->|No| E[Refuse with diagnostic]
  D -->|Yes| F[Abort run and approvals]
  F --> G[Wait for producer completion]
  G --> H[Report confirmed outcome]
Loading

Before merge

  • [P3] Update the documented CLI task cancellation contract (P3) - The new ordinary-CLI branch in src/tasks/task-registry-cancel.ts now invokes the live owner, while this paragraph still describes cancellation as a registry-only update with no runtime handle. That leaves operators with the wrong explanation for actual execution shutdown and refusal of ownerless tasks. Document the live Gateway requirement, confirmed settlement, and existing audit/maintenance recovery path. This is a late discovery: the paragraph and relevant runtime code are unchanged since the previous reviewed head.
  • Resolve merge risk (P2) - Reviewer limitation: the external timeout-helper source and linked recordings could not be independently opened here; their supplied inspection and runtime results remain supporting evidence.
  • Complete next step (P2) - Align the task cancellation documentation with live Gateway cancellation, confirmed completion, and ownerless-task recovery.

Findings

  • [P3] [P3] Update the documented CLI task cancellation contract — docs/automation/tasks.md:244
Agent review details

Security

None.

PR surface

Source +158, Tests +351. Total +509 across 28 files.

View PR surface stats
Area Files Added Removed Net
Source 18 251 93 +158
Tests 10 447 96 +351
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 28 698 189 +509

Review metrics

Metric Value Why it matters
Production versus test growth Production net +156; tests/support net +353 After separating reset-only support and neutral moves, production growth establishes exact live ownership and confirmed settlement while removing duplicate CLI result handling.

Stored data model

Persistent data-model change detected: serialized state: src/tasks/task-registry.process-state.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep producer-owned cancellation with matching operator guidance; durable task rows alone cannot supply the live-owner binding or completion join that justify the production growth.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep producer-owned cancellation with matching operator guidance; durable task rows alone cannot supply the live-owner binding or completion join that justify the production growth.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: current main and v2026.9.1 skip live cancellation for ordinary CLI tasks and can mark them cancelled anyway. The supplied before/after runs corroborate this; this read-only review did not execute them.

Is this the best way to solve the issue?

Yes for the runtime repair: the producer owns both exact-run authority and actual completion. Registry-only updates cannot establish cancellation, and session-wide abort would target unrelated work; the operator documentation still needs alignment.

Full review comments:

  • [P3] [P3] Update the documented CLI task cancellation contract — docs/automation/tasks.md:244
    The new ordinary-CLI branch in src/tasks/task-registry-cancel.ts now invokes the live owner, while this paragraph still describes cancellation as a registry-only update with no runtime handle. That leaves operators with the wrong explanation for actual execution shutdown and refusal of ownerless tasks. Document the live Gateway requirement, confirmed settlement, and existing audit/maintenance recovery path. This is a late discovery: the paragraph and relevant runtime code are unchanged since the previous reviewed head.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is correct
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against cc7261dfacce.

Labels

Label justifications:

  • P1: The existing cancellation command can report success while agent commands continue executing.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured body ties packaged, authenticated Gateway runs to the changed producer: CLI/API cancellation stops foreground commands, stale approvals cannot execute, unrelated work completes, and restart recovery refuses ownerless authority. These supplied observed results satisfy the changed path; linked recordings were not independently reopened because DNS failed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured body ties packaged, authenticated Gateway runs to the changed producer: CLI/API cancellation stops foreground commands, stale approvals cannot execute, unrelated work completes, and restart recovery refuses ownerless authority. These supplied observed results satisfy the changed path; linked recordings were not independently reopened because DNS failed.

Evidence

Acceptance criteria:

  • [P1] pnpm docs:list.
  • [P1] pnpm docs:check-mdx.
  • [P1] pnpm docs:check-links:anchors.
  • [P1] git diff --check.

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head changes. The relevant runtime files are unchanged since the previous reviewed head; the supplied test merge is stale and was not used to infer removals from current main. (ac9113aec97e)
  • Current-main defect remains: Ordinary CLI tasks bypass runtime cancellation and reach the registry-only cancellation update; the CLI also still excludes those tasks from Gateway dispatch. (src/tasks/task-registry-cancel.ts:125, cc7261dfacce)
  • Latest-release behavior: The supplied latest release, v2026.9.1, also contains the ordinary-CLI bypass. This is not an already-shipped repair. (src/tasks/task-registry-cancel.ts:125, ad6fe23aecb9)
  • Execution owner and final effect: The producer validates the captured controller, session, operational instance, lifecycle, and delegated authority immediately before canonical abort. It awaits the original completion promise and requires a cancelled terminal outcome before returning success. (src/gateway/agent-turn/agent-run-dispatch.ts:465, ac9113aec97e)
  • Caller, approval, and sibling boundaries: The existing Gateway requester-session write check precedes cancellation. Canonical abort releases delegated authority and cancels bound approvals; background-exec, ACP, cron, and subagent cancellation retain their existing runtime branches. (src/gateway/server-methods/tasks.ts:292, ac9113aec97e)
  • Regression coverage: Inspected cases cover delayed settlement, completion winning cancellation, store reload, settlement timeout, and changed task scope, session, entry, controller, lifecycle, or authority. Additional registry tests fence retained callbacks and protect replacement owners. These tests were read, not executed during this review. (src/gateway/server-methods/agent.sessions-and-models.test-utils.ts:1580, ac9113aec97e)

Likely related people:

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

Rank-up moves

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

  • Update the task cancellation guide to explain live execution shutdown, confirmation, and ownerless-task recovery.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-08-03T01:45:49.871Z sha 749bfba :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-04T21:18:15.127Z sha 749bfba :: needs real behavior proof before merge. :: [P1] Route CLI task cancellation through the Gateway | [P1] Use the canonical exact-run abort path | [P2] Keep pre-restart lane age unknown
  • reviewed 2026-08-19T09:23:34.556Z sha 9e675b3 :: needs real behavior proof before merge. :: [P1] Preserve background-exec cancellation routing | [P1] Bind the task to the exact active run before aborting | [P2] Honor the supplied cancellation reason
  • reviewed 2026-09-04T23:57:02.592Z sha b2a5bbc :: needs real behavior proof before merge. :: [P2] Preserve terminal diagnostics when deferring task finalization
  • reviewed 2026-09-05T02:13:53.689Z sha bbe8c78 :: blocked before merge. :: none
  • reviewed 2026-09-05T02:55:21.768Z sha 43eaf98 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 4, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Aug 19, 2026
…cel-session-lanes

# Conflicts:
#	src/gateway/health/types.ts
#	src/gateway/server-methods/tasks.test.ts
#	src/gateway/server-methods/tasks.ts
#	src/process/command-queue.ts
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui commands Command implementations labels Aug 19, 2026
@peter3n

peter3n commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Aug 19, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Aug 20, 2026
…aw#118358)

Preserve contributor ancestry while integrating current main. Route ordinary task cancellation through the producer-bound abort owner and confirm actual settlement before reporting success. Keep background command cancellation with its existing owner.

Co-authored-by: Ayaan Zaidi <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added size: L and removed app: web-ui App: web-ui size: M labels Sep 4, 2026
…enclaw#118358)

Integrate current main's received-work lifetime owner. Return the same producer completion promise used by task cancellation so Gateway shutdown joins execution and its cleanup.

Co-authored-by: Ayaan Zaidi <[email protected]>
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Sep 4, 2026
…8358)

Carry the producer's redacted terminal diagnostic with the existing private result metadata. Preserve the SDK outcome carrier and JSON response shape while finalizing tracked failures and timeouts.

Cover store reload, cancellation settlement timeout, and diagnostic propagation. Direct ownerless cancellation to task audit without changing reconciliation policy.

Co-authored-by: Ayaan Zaidi <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 5, 2026
…law#118358)

Use the existing deferred helper for the configured TypeScript library and complete the content-phase Gateway context fixture. Keep product behavior and assertions unchanged.

Co-authored-by: Ayaan Zaidi <[email protected]>
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 5, 2026
Integrate current main and migrate its new cancellation test to the canonical abort-operations module. Preserve main attachment cleanup behavior and source credit.

Co-authored-by: Ayaan Zaidi <[email protected]>
Replace the stale registry-only description with exact live-run cancellation, settlement confirmation, and existing ownerless-task recovery guidance.

Co-authored-by: Ayaan Zaidi <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Sep 5, 2026
@obviyus
obviyus merged commit 0d84b12 into openclaw:main Sep 5, 2026
212 checks passed
@obviyus

obviyus commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Thanks @peter3n!

Landed in 0d84b12e65e1, with Peter retained as primary author and Ayaan credited as co-author.

Proof: real packaged Gateway and CLI cancellation, real agent/tool work, approval cleanup, stale-approval refusal, and completed unrelated and subsequent work.

  • Bug: cancellation could change the task record while its command kept running.
  • Fix: the live producer owns exact-run abort and confirms actual settlement.
Before After
CLI/API reported cancellation while the same command continued. The selected tool aborts, later work stops, and the task reports its real outcome.
A task record alone stood in for execution ownership. Missing or stale ownership refuses cancellation without stopping replacement work.

Runtime proof and all 777 focused tests passed at ac9113ae. The final a11633d9 changes only the guide; it has a fresh clean P0 review and green exact-head CI.

The late documentation finding is fixed. The unrelated ClawHub mirror-anchor mismatch remains recorded in the PR evidence; it is not represented as a passing full anchor audit.

vincentkoc added a commit to LiuwqGit/openclaw that referenced this pull request Sep 5, 2026
* origin/main:
  fix(gateway): keep webhook ingress retryable during hot reload (openclaw#138627)
  fix: restore Gateway restarts after Git updates (openclaw#138781)
  fix(gateway): stop repeated teardown after WebSocket failures (openclaw#138818)
  fix(gateway): abort exact live runs when cancelling tasks (openclaw#118358)
  refactor(memory): share typed embedding-cache writes (openclaw#138827)
  fix(a2a): preserve tasks while reserving commands for users (openclaw#138731)
  feat: tune inbound batching without reconnecting channels (openclaw#138780)
steipete added a commit that referenced this pull request Sep 5, 2026
Require offline CLI cancellation to fail visibly without mutating persisted
state. Exercise authenticated RPC and CLI cancellation against a real held
provider request, preserve cancellation provenance, and verify later heartbeat
work succeeds. Follow up the execution ownership repair in #118358.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
…18358)

Bind ordinary Gateway-owned tasks to their exact live producer, use the canonical abort owner, and confirm actual settlement before reporting cancellation. Preserve background-command ownership, cancellation reasons, requester access, and unrelated work.

Remove the incoming monitoring expansion and duplicate CLI result handling. Retain the contributor's original ancestry and current-main execution-lifetime ownership.

Carry the producer's redacted failure and timeout diagnostics through task settlement without changing the existing SDK outcome carrier or JSON response.

Verified with real packaged Gateway and CLI red/green, real model/tool execution, approval cleanup and stale-approval refusal, concurrent and subsequent work, background-command cancellation, and retained crash/upgrade recovery. Runtime validation passed all 777 focused tests across 22 files, including the new main caller and the command case previously blocked by disk capacity. The final guide-only correction leaves those runtime inputs unchanged and documents the verified cancellation and recovery behavior.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
…#139135)

Require offline CLI cancellation to fail visibly without mutating persisted
state. Exercise authenticated RPC and CLI cancellation against a real held
provider request, preserve cancellation provenance, and verify later heartbeat
work succeeds. Follow up the execution ownership repair in openclaw#118358.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

2 participants