Skip to content

fix(test): reap handoff fixture parents after setup errors - #190353

Merged
vincentkoc merged 1 commit into
mainfrom
fix/test-handoff-parent-cleanup-20261101
Nov 1, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/test-handoff-parent-cleanup-20261101

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes leaked parent processes when managed-update handoff test setup rejects after spawning its parent.

User Impact

No runtime or configuration change. Failed handoff fixture setup now finishes child cleanup before reporting the setup error.

Why This Change Was Made

The boundary fixture created its real parent before entering the existing cleanup block. Move that block to parent creation so file, profile, runtime, and state preparation share the same cleanup owner. This preserves normal systemd and launchd handoffs without adding another cleanup path.

Production delta: 0 lines. Test/support delta: +35 lines, including formatter reflow. The separate 35-line test-budget allocation covers one regression that observes the actual child close event; its own cleanup also reaps the child on the broken baseline. No changelog entry is needed for this test-only repair.

Evidence

  • Real Blacksmith Testbox baseline: the new regression failed with closed === false after the asynchronous setup error. The test's fallback cleanup reaped that child.
  • Same Testbox and frozen source base: regression plus existing systemd restoration and launchd terminal-parent cases passed, 3/3 selected, 68 unselected. Vitest wall time 27.20s; test command 83.76s including required runtime preparation. The process lifetime needs a real child; mocked cleanup cannot establish reaping.
  • The combined test command then failed because it referenced a nonexistent formatter script. The existing targeted formatter/linter commands were run separately; no passing test was rerun merely to change the combined exit status.
  • Targeted repository formatter/parity and oxlint passed (0 warnings/errors); diff whitespace check passed. Testbox was stopped after completed proof.
  • Full-context local autoreview of base b2bfad1071b0cac22de5c80c19c28a0cce37216d through this exact candidate: scoped-clean through P0–P2, no actionable findings (correctness confidence 0.92). Independent lifecycle source review also found no cleanup gap. Signed published head: c519dbfcb38e3c76ae3eac0972f68cf2121d162f.
  • Proof uses isolated fixtures and emulated service commands. It does not mutate or qualify a live systemd/launchd Gateway.

@vincentkoc vincentkoc self-assigned this Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 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.

@vincentkoc
vincentkoc marked this pull request as ready for review November 1, 2026 13:31
@vincentkoc
vincentkoc enabled auto-merge (squash) November 1, 2026 13:42
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR extends the existing fixture cleanup block to cover setup failures after parent-process creation.

Example: The systemd boundary fixture's prepareState callback rejects with "fixture setup rejected".

  • Before: Setup rejects before registering cleanup, leaving the real parent process running.
  • After: The existing cleanup owner reaps the parent before setup reports the error.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused and source-supported lifecycle repair with meaningful real-process regression claims, assessed through test-boundary evidence.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test-support repair is outside the ordinary contributor proof gate; its reported isolated Testbox regression observes a real parent close, while no shipped Gateway behavior changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Developers and CI workers can retain a real parent process after managed-handoff fixture setup fails.
Reason: The maintainer-authored repair closes a concrete resource-lifecycle gap while preserving existing handoff behavior.

Merge readiness

✅ Ready for maintainer review

Keep this PR: it repairs a concrete test-fixture process leak still present on main, with no actionable correctness or security findings.

Priority: P2
Reviewed head: c519dbfcb38e3c76ae3eac0972f68cf2121d162f

Before merge

None.

Findings

None.

Agent review details

How this fits together

Managed-update tests create a real parent process and generated handoff helpers around emulated service commands; the boundary fixture prepares their environment, observes outcomes, and cleans up child processes.

flowchart TD
  A[Lifecycle test] --> B[Boundary fixture]
  B --> C[Real parent process]
  B --> D[Environment and state preparation]
  D --> E[Generated handoff helper]
  B --> F[Existing cleanup owner]
  F --> C
  F --> E
Loading

Technical review

Best possible solution:

Keep parent creation followed immediately by registration of the existing cleanup owner, with all subsequent setup inside its try/finally.

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

Current-main source shows setup rejection bypassing cleanup after spawning a real parent; the body reports a matching failing baseline, but this read-only review executed no target code.

Is this the best way to solve the issue?

This is the smallest complete repair: extend the existing lifecycle owner rather than add another cleanup path, and retain one regression for the observable child-close contract.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Verified introduced change: The pinned introduced diff moves setup into the existing try/finally immediately after parent creation and cleanup registration; it adds no production owner or runtime behavior. (src/infra/update-managed-service-handoff-boundary.test-support.ts:114, c519dbfcb38e)
  • Current-main failure path: Fetched main creates the parent before file writes, profile preparation, runtime preparation, and prepareState, while cleanup registration follows those operations; any rejection there bypasses the cleanup block. (src/infra/update-managed-service-handoff-boundary.test-support.ts:111, 9a0ec72eb9ef)
  • Meaningful regression: The added regression preserves the real parent factory, injects an asynchronous setup rejection, and checks the parent's actual close notification before rejection settles; fallback cleanup also reaps the baseline child. (src/infra/update-managed-service-handoff-lifecycle.test.ts:126, c519dbfcb38e)
  • Reported boundary validation: The full PR body reports the regression failing on the baseline and passing with systemd-restoration and launchd-terminal-parent cases on an isolated Testbox; these are test-boundary results, not live Gateway qualification. (c519dbfcb38e)
  • Related work has a distinct boundary: fix(ci): cover PostgreSQL managed update handoffs #190336 explicitly identifies this PR as separate parent-cleanup work; that PR addresses PostgreSQL conformance selection, observation, and recovery-entrypoint use.
  • Feature history and policy: History across current and earlier test paths identifies Peter Steinberger's parent-fixture extraction and lifecycle refactors, plus Vincent Koc's prior handoff repairs. Extended content history encountered an unavailable promisor object; GitHub commit patches independently verified the relevant extraction and recent contribution. Root policy was applied; no scoped ancestor AGENTS.md or maintainer-notes directory exists for these paths. (AGENTS.md:1, 9a0ec72eb9ef)

Likely related people:

  • Vincent Koc: Raw commit 1034356 adds src/infra/update-managed-service-handoff-boundary.test-support.ts:34 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 103435694bef; files: src/infra/update-managed-service-handoff-boundary.test-support.ts)

PR surface

Tests +35, Other +2. Total +37 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 82 47 +35
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 3 84 47 +37

Labels

Label changes:

  • add P2: Failed fixture setup can leak real processes during developer and CI testing, with no installed-runtime behavior change.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Failed fixture setup can leak real processes during developer and CI testing, with no installed-runtime behavior change.
  • 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.

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 execution lanes are retired.

Reviewed November 1, 2026, 8:47 AM ET / 13:47 UTC.

@vincentkoc
vincentkoc merged commit 87ba257 into main Nov 1, 2026
201 checks passed
@vincentkoc
vincentkoc deleted the fix/test-handoff-parent-cleanup-20261101 branch November 1, 2026 13:57
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

1 participant