Skip to content

fix(qa): isolate gateway child supervisor state - #146397

Merged
steipete merged 1 commit into
mainfrom
codex/qa-child-supervision
Sep 12, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-child-supervision

Conversation

@steipete

@steipete steipete commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A QA runner launched under a native service manager passes supervisor markers into a Gateway child that QA owns directly. During a forced restart, that child can use native shutdown rules and exit expecting a supervisor to replace it, leaving the scenario waiting for a process that will never start. This caused the subagent-completion-direct-fallback smoke failure observed while validating #146129.

Why This Change Was Made

Remove the canonical supervisor hints after all QA environment overlays. Reuse the existing key list through the process SDK, and combine duplicate test-runner cleanup with the existing environment scrub. QA retains its own process identity and in-process restart control. The intentional restart-recovery scenarios and production supervisor deadlines stay intact.

Production is net −2 lines; tests +30 and SDK documentation +5.

Evidence

Both inherited-parent and runtime-overlay regressions failed before repair. They and seven existing environment-isolation cases pass afterward; independent P0–P2 review is clean.

Clean Linux proof on exact 40951697d477a419335fd0b7ca9325abc91119b2 passed the private-QA build, core/plugin/test types, all 104 Gateway-child tests, import-cycle, SDK export/surface, and lint checks. Source tree: d47b13f44eee3d832232bd610ce9d73360014c80. Testbox proof run.

The original failing smoke scenario ran with a synthetic parent INVOCATION_ID and completed with one pass and zero failures in 25.3 seconds. The actual Gateway launcher and its QA-owned descendants had no supervisor hints and retained OPENCLAW_NO_RESPAWN=1; the parent still had its injected marker. Captured Gateway logs show SIGUSR1 at 20:51:55.878 UTC, completed in-process restart at 20:51:55.945, and a new HTTP listener at 20:51:56.611. Post-restart completion was delivered without replay or unexpected payloads. There was no abandoned-cleanup deadline and no leftover owned process. The lease is stopped.

Private proof archive SHA-256: 52444447b4c1640f1201331bdfbf5437a4806c89d74c6f654e07afa4207d68e5. Check archive SHA-256: 77fb864586caf7607e24fb6eb4bf6dfa98e2a2cd95643486278f566e3bbd3392.

Proof-driver path, private artifact permissions, and successful-run log-retention assumptions were corrected without changing product code or weakening the original scenario. The final explicit signal → completed restart → new listener trace is retained.

The initial hosted CI run was blocked only by the current-main TLS sidecar array/variadic mismatch. Canonical repair #146412 is merged as b405e7f644106306d2d3965ecf22335fdbe15716. This branch was rebased patch-identically onto repaired main; the QA environment owner, restart helper/scenario, supervisor detection and Gateway run loop are unchanged from the live-tested base. Final integration CI passed on 9cafbfe122e71c19d2bd073aa2985edc9cfb0e7f: 119 successes, 15 skips, zero failures. CI run.

@clawsweeper

clawsweeper Bot commented Sep 12, 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 docs Improvements or additions to documentation extensions: qa-lab plugin: file-transfer size: XS maintainer Maintainer-authored PR labels Sep 12, 2026
@steipete
steipete marked this pull request as ready for review September 12, 2026 20:20
@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 Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 5:36 PM ET / 21:36 UTC (Revision 2).

ClawSweeper review

What this changes

QA Lab removes inherited service-manager and test-runner markers from its Gateway children, exposes the canonical supervisor-key list through the process SDK, and documents and tests that isolation.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix missing from current main. The updated restart and cleanup evidence addresses the previous review request; no blocking patch defect was found.

Priority: P2
Reviewed head: 9cafbfe122e71c19d2bd073aa2985edc9cfb0e7f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with useful regression coverage and recorded runtime recovery evidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): The captured Linux scenario exercised the actual QA Gateway launcher with an injected parent supervisor marker and recorded successful in-process restart, listener recovery, completion delivery, and process cleanup. Relevant production blobs match the tested revision; the cancelled hosted workflow is not counted as passing proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The captured Linux scenario exercised the actual QA Gateway launcher with an injected parent supervisor marker and recorded successful in-process restart, listener recovery, completion delivery, and process cleanup. Relevant production blobs match the tested revision; the cancelled hosted workflow is not counted as passing proof.
Evidence reviewed 8 items Current main still needs the fix: Fetched main retains the separate test-runner scrub and does not remove supervisor markers from QA children. The pinned introduced patch adds that missing isolation without changing production supervisor detection.
Scrubbing occurs at the existing environment owner: The builder copies the parent environment, applies runtime overrides, and finally removes canonical supervisor hints. Gateway setup consumes this builder, and the launcher passes its environment to the child. The two added cases cover parent inheritance and override injection while retaining QA process identity and no-respawn control.
Restart behavior belongs to OpenClaw: OpenClaw supervisor detection consumes these environment markers, and the Gateway run loop uses the result to choose native shutdown budgets. OPENCLAW_NO_RESPAWN independently preserves in-process respawning. The changed contract does not depend on Codex protocol or harness behavior.
Findings None None.
Security None None.

How this fits together

QA Lab launches isolated Gateway processes to exercise OpenClaw scenarios. Its environment builder combines parent settings and scenario overrides before the Gateway decides how to restart and shut down.

flowchart TD
  A[Parent environment] --> C[QA environment builder]
  B[Scenario overrides] --> C
  D[Canonical supervisor markers] --> E[Final environment scrub]
  C --> E
  E --> F[QA-owned Gateway child]
  F --> G[In-process restart and scenario completion]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -2, Tests +30, Docs +5. Total +33 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 8 10 -2
Tests 1 30 0 +30
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 43 10 +33

Review metrics

Metric Value Why it matters
Public SDK contract 1 additive export; 0 new subpaths or configuration options The existing process SDK exposes the canonical marker list without replacing existing plugin calls.

Technical review

Best possible solution:

Keep QA child isolation in the existing environment builder and share the canonical supervisor markers through the documented process SDK.

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

Yes: current-main source preserves inherited supervisor markers that affect Gateway shutdown budgets, and the captured evidence identifies the failing forced-restart scenario. This read-only review did not execute it.

Is this the best way to solve the issue?

Yes: removing parent-only markers after all overlays repairs the existing owner boundary while preserving production supervisor rules and intentional QA restart controls.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured Linux scenario exercised the actual QA Gateway launcher with an injected parent supervisor marker and recorded successful in-process restart, listener recovery, completion delivery, and process cleanup. Relevant production blobs match the tested revision; the cancelled hosted workflow is not counted as passing proof.

Label justifications:

  • P2: This repairs QA restart reliability for runners launched under service managers, with a bounded internal blast radius.
  • 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 (logs): The captured Linux scenario exercised the actual QA Gateway launcher with an injected parent supervisor marker and recorded successful in-process restart, listener recovery, completion delivery, and process cleanup. Relevant production blobs match the tested revision; the cancelled hosted workflow is not counted as passing proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured Linux scenario exercised the actual QA Gateway launcher with an injected parent supervisor marker and recorded successful in-process restart, listener recovery, completion delivery, and process cleanup. Relevant production blobs match the tested revision; the cancelled hosted workflow is not counted as passing proof.

Evidence

What I checked:

  • Current main still needs the fix: Fetched main retains the separate test-runner scrub and does not remove supervisor markers from QA children. The pinned introduced patch adds that missing isolation without changing production supervisor detection. (extensions/qa-lab/src/gateway-child-env.ts:20, 9b59fe4ef7da)
  • Scrubbing occurs at the existing environment owner: The builder copies the parent environment, applies runtime overrides, and finally removes canonical supervisor hints. Gateway setup consumes this builder, and the launcher passes its environment to the child. The two added cases cover parent inheritance and override injection while retaining QA process identity and no-respawn control. (extensions/qa-lab/src/gateway-child-env.ts:122, 9cafbfe122e7)
  • Restart behavior belongs to OpenClaw: OpenClaw supervisor detection consumes these environment markers, and the Gateway run loop uses the result to choose native shutdown budgets. OPENCLAW_NO_RESPAWN independently preserves in-process respawning. The changed contract does not depend on Codex protocol or harness behavior. (src/cli/gateway-cli/run-loop.ts:594, 9cafbfe122e7)
  • Prior proof request addressed: The captured PR body, sourceRevision 325aaf5a38c3375394812b504815ccfb6e21e60506f73a40c07829078f89c8f3, records the original Linux scenario with synthetic INVOCATION_ID: one pass, zero failures, stripped child markers, preserved parent marker, SIGUSR1 at 20:51:55.878 UTC, completed restart at 20:51:55.945, a new listener at 20:51:56.611, successful completion delivery, and no leftover owned process. Its private proof archive hash is 52444447b4c1640f1201331bdfbf5437a4806c89d74c6f654e07afa4207d68e5. This is recorded runtime evidence, not a reviewer-executed run. (40951697d477)
  • Proof continuity across the rebase: GitHub contents metadata and local blob identities match between the previously reviewed revision and this head for gateway-child-env.ts, supervisor-markers.ts, run-loop.ts, and process-runtime.ts. Direct local comparison of the older revision was unavailable, so GitHub blob identities supplied this check. (extensions/qa-lab/src/gateway-child-env.ts:20, 9cafbfe122e7)
  • SDK scope and compatibility: The maintainer-authored proposal explicitly discusses promoting the existing canonical list through the already registered process-runtime subpath. Documentation limits its use to plugin-owned isolated children after overrides; existing exports and signatures remain intact. (src/plugin-sdk/process-runtime.ts:3, 9cafbfe122e7)

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-12T20:29:13.025Z sha 4095169 :: blocked before merge. :: none

@steipete
steipete force-pushed the codex/qa-child-supervision branch from 4095169 to 9cafbfe Compare September 12, 2026 21:19
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 12, 2026
@steipete
steipete merged commit 82ab1e1 into main Sep 12, 2026
199 checks passed
@steipete
steipete deleted the codex/qa-child-supervision branch September 12, 2026 21:48
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: qa-lab maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. plugin: file-transfer proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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