Skip to content

fix(qa): cancellation is ignored during command cleanup - #133143

Merged
steipete merged 2 commits into
mainfrom
codex/qa-20260830-posix-signals
Aug 30, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/qa-20260830-posix-signals

Conversation

@steipete

@steipete steipete commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #133142

What Problem This Solves

Fixes an issue where QA operators canceling a native test command could see the command continue successfully when its leader had already exited but descendant cleanup was still pending. SIGINT and SIGTERM were also lost after a timeout entered cleanup.

Why This Change Was Made

Record parent cancellation independently from the first command outcome in the shared POSIX settlement owner, then re-raise it after cleanup. Remove redundant timer forwarding and cancellation wrappers in that same owner. The leader exit code, timeout/error result, cleanup escalation, and Windows behavior remain unchanged. Replacing the frozen command outcome would lose the result consumed by the native, QA CLI, and Matrix CLI callers.

User Impact

QA cancellation remains effective throughout command cleanup. This is internal QA tooling; no production gateway behavior, configuration, provider, plugin API, or persistent state changes.

Evidence

  • Before: the extended native lifecycle regression passed the running-command case but failed the exited and timed-out cases because the parent SIGTERM was never re-raised.
  • After: 44 tests passed across the native command lifecycle, POSIX settlement/process-group owner, and Matrix CLI/stream-error sibling tests, including real child cleanup and Windows taskkill coverage.
  • Real native wrapper process proof: after a leader exit, both SIGINT and SIGTERM previously produced controller exit 0 and executed the continuation. With the repair, both controllers terminate by the requested signal after owned process-group cleanup.
  • Independent source and real-process verification covered active/finished commands, exit 0/7, spawn/pipe errors, timeout, and cancellation after timeout. Mandatory structured autoreview found no actionable findings.
  • Full check:changed passed on the final source, including extension/test typechecks, lint, owner guards, and import-cycle checks. Formatting and git diff --check passed.
  • Production LOC: +10/-14 (net -4; independently owned cancellation plus simpler timer lifecycle); tests: +59/-36 (existing case expanded into a table). No compatibility branch or new option.

Focused command:

OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs extensions/qa-lab/src/test-file-scenario-command-lifecycle.test.ts extensions/qa-lab/src/posix-command-settlement.test.ts extensions/qa-lab/src/posix-process-group.test.ts extensions/qa-lab/src/live-transports/matrix/scenarios/scenario-runtime-cli.test.ts extensions/qa-lab/src/live-transports/matrix/scenarios/scenario-runtime-cli-stream-error.test.ts

CI note: the first exact-head run (33298447673) failed because the current main merge tree imported getPluginToolSideEffectOwnerKey from its former module. The canonical main repair #133155 fixes that import. This branch is refreshed onto that repaired base at fba60c7a091ee637f10e1ea62ceabe0075a787be; the complete patch identity and source/test bytes are unchanged. All 44 focused tests and the real native SIGINT/SIGTERM before/after proof passed again, fresh structured autoreview is clean, and the independent verifier bound its verdict to this exact head. The final separate read-only review also found no actionable findings. Fresh exact-head CI 33299847607 passed. Native preparation and merge gates passed without changing the reviewed head. Merged as bed5daf176f6d7552b27b7c87d33e7d201dd82f6, verified on canonical main; the linked issue is closed.

@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 30, 2026 07:06
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 3:48 AM ET / 07:48 UTC.

ClawSweeper review

What this changes

The PR makes POSIX QA command cleanup preserve a parent SIGINT or SIGTERM received after command exit or timeout, then re-raise it after cleanup while keeping the recorded command result.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

The patch is correct: it retains cancellation independently of the already-frozen command result and re-raises it after owned cleanup. Keep this maintainer-authored, protected PR open for normal maintainer landing review and completion of the exact-head checks still running in the captured context.

Priority: P2
Reviewed head: fba60c7a091ee637f10e1ea62ceabe0075a787be

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary fix with targeted coverage and no identified correctness or security defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The changed production owner is the POSIX QA command-settlement layer, exercised through the native lifecycle entrypoint and table-driven regression cases; the PR body also reports a real wrapper-process before/after run. The external-contributor proof gate is not applicable because the repository state identifies this as a MEMBER-authored PR.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The changed production owner is the POSIX QA command-settlement layer, exercised through the native lifecycle entrypoint and table-driven regression cases; the PR body also reports a real wrapper-process before/after run. The external-contributor proof gate is not applicable because the repository state identifies this as a MEMBER-authored PR.
Evidence reviewed 6 items Introduced owner-boundary repair: The settlement owner now records parent cancellation independently and re-raises it only after cleanup and stdio drain; this preserves an earlier exit or timeout primary outcome.
Current-main defect mechanism: Before this PR, settlement derived the re-raised signal only from a parent-signal primary; once exit or timeout had frozen primary, a later parent cancellation was not retained.
Caller and sibling boundary: The affected native lifecycle caller enables parent-signal forwarding, while the QA CLI and Matrix scenario callers share cleanup but do not opt into parent forwarding, so their returned-result behavior remains unchanged.
Findings None None.
Security None None.

How this fits together

QA Lab starts native scenario commands and owns their process-group cleanup. The settlement layer records a terminal command result, drains inherited stdio, cleans descendants, then returns the result or re-raises a parent interruption.

flowchart LR
  A[QA scenario command] --> B[POSIX settlement]
  B --> C[Freeze command outcome]
  C --> D[Drain stdio and clean process group]
  D --> E[Re-raise parent signal]
  E --> F[QA controller stops]
Loading

Before merge

  • Resolve merge risk (P1) - The captured exact-head CI context still has build-artifacts and changed-extension-config checks in progress; landing should wait for their terminal results.
Agent review details

Security

None.

PR surface

Source -4, Tests +23. Total +19 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 10 14 -4
Tests 1 59 36 +23
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 69 50 +19

Review metrics

Metric Value Why it matters
Production versus test LOC production -4, tests +23 The bug fix simplifies the settlement owner while expanding focused lifecycle coverage for two previously untested terminal states.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #133142
Summary: This PR is the explicit candidate fix for the open QA cancellation report and changes the owner named in that report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the shared settlement-owner repair and its three-state regression coverage, then land once normal maintainer review and exact-head checks are complete.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the shared settlement-owner repair and its three-state regression coverage, then land once normal maintainer review and exact-head checks are complete.

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

Yes, source establishes the failure: current main freezes an exit or timeout primary and later derives cancellation only from that primary. The linked report also supplies a concrete native-process ordering, though this read-only review did not execute target code.

Is this the best way to solve the issue?

Yes. Storing cancellation in the shared settlement owner repairs all opted-in parent-signal flows without replacing the result that downstream callers consume; consumer-side handling would split that lifecycle invariant.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: Cancellation can be ignored during an internal QA command-cleanup window, but the report establishes no production gateway, credential, or user-message impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The changed production owner is the POSIX QA command-settlement layer, exercised through the native lifecycle entrypoint and table-driven regression cases; the PR body also reports a real wrapper-process before/after run. The external-contributor proof gate is not applicable because the repository state identifies this as a MEMBER-authored PR.

Evidence

What I checked:

Likely related people:

  • unknown: The blamed commit carries this line unchanged from a recorded parent; no introducing author is attributed. (role: carried-forward source line; confidence: low)

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 (1 earlier review cycle)
  • reviewed 2026-08-30T07:18:00.925Z sha 532981e :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/qa-20260830-posix-signals branch from 532981e to fba60c7 Compare August 30, 2026 07:42
@steipete
steipete merged commit bed5daf into main Aug 30, 2026
119 checks passed
@steipete
steipete deleted the codex/qa-20260830-posix-signals branch August 30, 2026 07:51
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
)

* fix(qa): honor cancellation while command cleanup is pending

* refactor(qa): remove redundant settlement timer wrappers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: qa-lab maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

[Bug]: QA cancellation is ignored after a command leader exits

1 participant