Skip to content

fix(exec): safely cancel pending node approvals - #115373

Merged
steipete merged 3 commits into
mainfrom
codex/stress-node-detached-cancellation
Jul 28, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/stress-node-detached-cancellation

Conversation

@steipete-oai

@steipete-oai steipete-oai commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users cancelling a node-hosted command while approval was pending could leave an unhandled background rejection, start the remote command after cancellation, emit a denial after the run was already cancelled, or report a completed command as denied when notification delivery failed.

Why This Change Was Made

Refactor node-specific approval reasoning and bounded follow-up delivery into the existing node owner's small internal helper. Classify the canonical run-abort error; check cancellation before approval consumption, before failure notices, after final policy, and during gateway dispatch; pass the existing signal without changing operator approval scopes; observe both detached task and callback failures; retry a failed approval notice at most once; and never report a started or completed node command as approval-denied. The primary node owner remains below the enforced 700-line threshold. No approval policy, run identity, gateway protocol, configuration, workflow, or permissions are changed.

User Impact

Cancelled node commands stop without starting remote side effects, emitting stale messages, or causing process-level unhandled rejections. Successful commands remain successful even if follow-up delivery fails; genuine approval-request failures keep their existing truthful notices.

Evidence

  • Fail-first proof on main 430de2299c484116d14693af70cff64643f01619: immediate and delayed unhandled rejections; real remote execution during final-policy cancellation; independently detached failure-callback rejection; spurious notices after cancellation; and false denial after successful execution.
  • node scripts/run-vitest.mjs src/agents/bash-tools.exec-host-node.test.ts src/agents/bash-tools.exec-host-node.cancellation.test.ts src/agents/bash-tools.exec-host-node-phases.cancellation.test.ts src/agents/bash-tools.exec-host-shared.test.ts src/agents/bash-tools.exec-approval-request.test.ts: 5 files, 127 tests passed.
  • Existing detached gateway cancellation sibling regressions: 2 tests passed.
  • Stress: 32 concurrent pending approval cancellations, zero dispatches, zero unhandled rejections.
  • node scripts/run-oxlint.mjs --tsconfig tsconfig.json src/agents/bash-tools.exec-host-node.ts src/agents/bash-tools.exec-host-node-followup.ts src/agents/bash-tools.exec-host-node.test.ts src/agents/bash-tools.exec-host-node.cancellation.test.ts: all four files pass exact type-aware CI lint.
  • Effective module sizes: node owner 683/700, node-specific helper 73/700; no lint exemptions.
  • Fresh final full-change independent autoreview: clean; patch is correct.
  • Targeted oxfmt --check and git diff --check: passed.

@steipete
steipete marked this pull request as ready for review July 28, 2026 18:41
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: L maintainer Maintainer-authored PR labels Jul 28, 2026
@steipete
steipete merged commit 740ce39 into main Jul 28, 2026
190 of 192 checks passed
@steipete
steipete deleted the codex/stress-node-detached-cancellation branch July 28, 2026 19:30
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 28, 2026
…etwork-none

* origin/main: (74 commits)
  fix(ui): make Control UI ownership and permissions reliable (#115364)
  feat(system-agent): host memory import in Ask OpenClaw (#115376)
  fix(chat): preserve literal Markdown image examples (#113904)
  refactor(chat): keep web and terminal sessions synchronized (#115377)
  fix(ui): order model picker by provider strength (#115380)
  feat(ui): make Memory settings a destination page with live overview and dreams (#115383)
  docs(security): fix warning line wrap (#115388)
  fix(memory-core): avoid cubic MMR similarity rescans (#113359)
  fix(discord): preserve code-leading reasoning chunks (#103166)
  fix(slack): protect outbound hooks from previews
  fix(ui): keep explicit navigation ahead of chat canonicalization (#115366)
  fix(exec): safely cancel pending node approvals (#115373)
  fix: make Code Mode reliable across gateway and provider lifecycles (#115379)
  perf(ui): debounce event-driven session list refreshes and right-size child paging (#115374)
  feat(talk): support GPT-Live realtime voice over ChatGPT OAuth (#115226)
  feat(system-agent): guide gateway configuration in Ask OpenClaw (#115363)
  fix(agents): make overflow recovery append-only via branch-and-reappend (#115271) (#115310)
  fix(macos): bound websocket ping so a dropped pong cannot orphan its continuation (#115362)
  fix(codex): isolate native hook relay startup (#115078)
  fix(ci): stop reviving superseded pull request workflows (#115378)
  ...

# Conflicts:
#	CHANGELOG.md
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 29, 2026
* fix(exec): safely cancel pending node approvals

* test(exec): satisfy detached node cancellation lint

* refactor(exec): isolate bounded node approval followups

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants