Skip to content

fix(test): join Windows Gateway process trees during cleanup - #150245

Closed
steipete wants to merge 1 commit into
mainfrom
ci-burden/windows-cron-identity-cleanup
Closed

steipete wants to merge 1 commit into
mainfrom
ci-burden/windows-cron-identity-cleanup

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Related: #150244 addresses the same reported main-run failure.

What Problem This Solves

The Windows cron process-identity test intermittently fails during Gateway cleanup after its cron assertions complete. Main run 35128973442, job 104906301242, reported termination-indeterminate after taskkill /F returned 255 in 63 ms, before Node observed exit or output closure.

User Impact

This fixes test infrastructure. Default Windows Gateway fixtures finish cleanup only after every owned process has exited and output has closed. Existing production callers retain their behavior.

Why This Change Was Made

The existing terminator already uses /T. Its nonzero result immediately rejects cleanup, and its direct-child fallback cannot certify descendant termination. The discarded command output does not establish the precise Windows reason for status 255. The scheduled system event runs inside the existing Gateway; source inspection found no cron-spawned Gateway to repair.

Use the existing Windows Job supervisor for fixture launch and cancellation, extending it to direct executable/argv launches so the reported PID remains the actual Gateway PID. The fixture exposes output closure only after that owner confirms zero active processes and completed output. Root exit preserves authority to stop remaining descendants. Startup and shutdown retain their existing budgets; deadline expiry rejects both joins and retains failed fixture state. Custom command prefixes keep their existing launch contract, including deliberate delayed-writer fixtures.

The supervisor's existing output relay moved unchanged into a sibling module to satisfy the line-cap ratchet.

Evidence

The temporary workflow runs only src/gateway/gateway-cron-process-identity.windows.test.ts on blacksmith-8vcpu-windows-2025, with five repetitions, fail-fast: false, and a 15-minute timeout per job. Its workflow bytes are identical before and after the fix.

Revision Windows matrix Result
Before 35132548572 5/5 passed
After 35136546518 5/5 passed

The baseline did not reproduce the intermittent failure. Both runs’ logs confirm one executed, passing test in every repetition; the fifth baseline job spent about 25 minutes waiting for a runner.

Focused regressions failed before the corresponding repairs: raw Windows Job routing, bounded cleanup settlement, and fixture termination observations. Final macOS proof passed 142 tests across the owner and fixture files, with 55 platform skips. Existing unknown-tree, held-output, and retired-PID controls remain enforced. Native literal-argv, exact-PID, and ignored-stdio descendant coverage was added to the existing Windows command test file for regular Windows CI.

node scripts/check-changed.mjs, scoped oxfmt, git diff --check, and pnpm check:line-cap-ratchet --base origin/main passed. The requested independent Codex branch review returned scoped-clean at P0/P1 with no findings for 6940009355d5bbf90c6398e3dc178002d760e323.

Initial sibling checks found no overlapping fix. A later check identified the concurrent repair in #150244. #150010 remains unrelated; #148692 only corrected the error wording.

The temporary proof branch was deleted after both matrices completed.

Use the existing Windows Job supervisor for default Gateway fixture launches,
with direct argv and the actual Gateway PID. Join native tree extinction and
output closure instead of relying on taskkill's snapshot-based exit status.
Keep custom command-prefix fixtures on their existing cleanup contract.

Preserve the startup and shutdown budgets through asynchronous admission and
cleanup. Reject both owner joins on deadline and retain failed fixture state.
Keep root-exit, held-output, unknown-tree, and late-receipt controls intact.

Regression context: main run 35128973442, Windows job 104906301242.
@clawsweeper

clawsweeper Bot commented Sep 16, 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 size: L maintainer Maintainer-authored PR labels Sep 16, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 16, 2026, 3:11 PM ET / 19:11 UTC.

ClawSweeper review

What this changes

Windows Gateway test fixtures now use the existing Windows Job supervisor to launch executables directly and wait for owned processes and output to finish during cleanup.

Merge readiness

⛔ Blocked before merge - 3 items remain

The cleanup repair remains useful: current main and the latest release still use taskkill for these fixtures. No blocking defect was identified in the introduced changes, and this maintainer-authored PR is protected from automatic closure.

Priority: P2
Reviewed head: 6940009355d5bbf90c6398e3dc178002d760e323

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-based repair with relevant native Windows evidence and useful failure-path coverage; no blocking correctness finding was identified.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The reported native Windows Gateway cron test exercises the changed fixture launcher and cleanup owner, with five successful after-fix runs whose changed-file blobs match this head. Run metadata was verified; raw log access was blocked by the reviewer environment. This supports the exercised lifecycle, without claiming reproduction of the intermittent failure or execution of the additional literal-argv case.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The reported native Windows Gateway cron test exercises the changed fixture launcher and cleanup owner, with five successful after-fix runs whose changed-file blobs match this head. Run metadata was verified; raw log access was blocked by the reviewer environment. This supports the exercised lifecycle, without claiming reproduction of the intermittent failure or execution of the additional literal-argv case.
Evidence reviewed 8 items Introduced ownership boundary: The pinned merge-base-to-head diff adds direct Windows Job launches, optional cleanup deadlines, and fixture lifecycle integration; the output relay is extracted without changing its behavior.
Fixture completion contract: The wrapper preserves the actual command PID and publishes output closure only after both command completion and native Job extinction succeed. Rejection leaves closure unconfirmed.
Current-main necessity and integration overlap: Current main retains the taskkill fixture path. It separately extracted service-child-output-relay.ts and added pending-cleanup diagnostics; these are base changes, not removals introduced by this PR.
Findings None None.
Security None None.

How this fits together

Gateway tests launch isolated OpenClaw processes and must stop them before releasing fixture state. The Windows Job supervisor owns the process tree and reports root exit, output completion, and confirmed tree termination separately.

flowchart TD
  A[Gateway test fixture] --> B{Custom launch command?}
  B -->|Yes| C[Existing process launcher]
  B -->|No on Windows| D[Windows Job supervisor]
  D --> E[Gateway and descendants]
  E --> F[Root exit and output completion]
  D --> G[Confirmed tree termination]
  F --> H[Release fixture state]
  G --> H
Loading

Before merge

  • Resolve merge risk (P1) - The conflicting branch has no verified merge result; integration must reconcile the independently extracted output relay and main's newer cleanup diagnostics.
  • Resolve merge risk (P1) - The original intermittent taskkill failure was not reproduced in the reported baseline matrix, so its precise native cause remains unconfirmed.
  • Complete next step (P2) - Resolve the main-branch conflict using one shared output relay, preserve the newer cleanup diagnostics, and validate the integrated Windows cleanup path.
Agent review details

Security

None.

PR surface

Source +35, Tests +362. Total +397 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 4 138 103 +35
Tests 6 404 42 +362
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 542 145 +397

Review metrics

Metric Value Why it matters
Production versus test growth Production net +35 lines; tests and test support net +362 lines Production growth supports direct native argv and bounded cleanup; most growth supplies fixture integration and regression coverage.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep one Windows Job owner responsible for fixture descendants and cleanup confirmation, while retaining main's shared output relay and diagnostic improvements.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep one Windows Job owner responsible for fixture descendants and cleanup confirmation, while retaining main's shared output relay and diagnostic improvements.

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

No high-confidence reproduction of the intermittent native failure is established: all five baseline repetitions passed. Source inspection confirms that an indeterminate taskkill result immediately fails fixture cleanup.

Is this the best way to solve the issue?

Yes. Extending the existing Job supervisor preserves native process ownership after root exit and avoids inventing another descendant census or termination owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a3a09980e942.

Labels

Label changes:

  • add P2: This is a bounded Windows test-infrastructure reliability repair without an established urgent user-facing regression.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The reported native Windows Gateway cron test exercises the changed fixture launcher and cleanup owner, with five successful after-fix runs whose changed-file blobs match this head. Run metadata was verified; raw log access was blocked by the reviewer environment. This supports the exercised lifecycle, without claiming reproduction of the intermittent failure or execution of the additional literal-argv case.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The reported native Windows Gateway cron test exercises the changed fixture launcher and cleanup owner, with five successful after-fix runs whose changed-file blobs match this head. Run metadata was verified; raw log access was blocked by the reviewer environment. This supports the exercised lifecycle, without claiming reproduction of the intermittent failure or execution of the additional literal-argv case.

Label justifications:

  • P2: This is a bounded Windows test-infrastructure reliability repair without an established urgent user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The reported native Windows Gateway cron test exercises the changed fixture launcher and cleanup owner, with five successful after-fix runs whose changed-file blobs match this head. Run metadata was verified; raw log access was blocked by the reviewer environment. This supports the exercised lifecycle, without claiming reproduction of the intermittent failure or execution of the additional literal-argv case.
  • proof: sufficient: Contributor real behavior proof is sufficient. The reported native Windows Gateway cron test exercises the changed fixture launcher and cleanup owner, with five successful after-fix runs whose changed-file blobs match this head. Run metadata was verified; raw log access was blocked by the reviewer environment. This supports the exercised lifecycle, without claiming reproduction of the intermittent failure or execution of the additional literal-argv case.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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.

@steipete

Copy link
Copy Markdown
Contributor Author

Superseded by #150244, which targets the same gateway-cron-process-identity.windows.test.ts cleanup failure (termination-indeterminate after a nonzero taskkill status bypassed the closure wait at test/helpers/openclaw-test-instance.ts:542). Closing this alternative to avoid two competing fixes; the Windows Job-ownership approach here (5/5 before and after on a throwaway Windows matrix) stays on the branch for reference.

@steipete steipete closed this Sep 16, 2026
@steipete
steipete deleted the ci-burden/windows-cron-identity-cleanup branch September 16, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. 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.

1 participant