Skip to content

fix(qa): clean leaked Gateway and plugin roots after startup failures - #119494

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-gateway-startup-cleanup-20260805
Aug 5, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-gateway-startup-cleanup-20260805

Conversation

@steipete

@steipete steipete commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a problem where an early QA Gateway startup failure left its temporary workspace on disk, and a failure while staging bundled plugins also leaked a separate runtime directory outside that workspace.

Why This Change Was Made

Start the existing Gateway startup cleanup scope immediately after allocating its workspace, and register the canonical bundled-plugin staging root before any fallible staging or host-version lookup. The same lifecycle owner now cleans early, partial, and post-staging failures without adding a fallback, changing packaged-plugin behavior, or altering runtime configuration.

User Impact

Repeated QA Gateway startup failures no longer accumulate abandoned temporary workspaces or bundled-plugin staging directories.

Evidence

  • An authentic pre-fix regression starts the real QA Gateway against a repository without a CLI entry and demonstrates the leaked workspace.
  • Two additional real-startup regressions fail inside bundled-plugin staging and after successful staging but before host-version parsing; both assert the external staged root and Gateway workspace are empty afterward.
  • Trusted Blacksmith Testbox aggregate passed 916 tests across 28 files; real Gateway scenario execution also passed after the lifecycle repair.
  • Production delta: 142 additions / 138 deletions (+4 net) across the canonical startup and staged-root owners; the large balanced movement widens the existing owner scope and does not add a parallel cleanup path.
  • Independent structured review found no accepted actionable findings; Testbox run: https://github.com/openclaw/openclaw/actions/runs/30973152491

@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. labels Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 1:35 AM ET / 05:35 UTC.

ClawSweeper review

What this changes

The PR starts QA Gateway cleanup immediately after workspace allocation and records the staged bundled-plugin root before fallible staging so startup failures remove both temporary locations.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open: current main still leaks QA temporary roots on pre-startup and partial-staging failures, while this PR repairs the lifecycle owner coherently. No actionable patch defect was found; the protected maintainer label and pending exact-head validation require maintainer handling.

Priority: P2
Reviewed head: f31b3e77c48d82f9f815544ef63fc2df47e5b22c
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The repair is a coherent, focused lifecycle fix with direct fault-boundary coverage and linked runtime evidence.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The PR body provides linked Testbox evidence and describes after-fix real startup failure scenarios that exercise the actual Gateway lifecycle and assert both allocated roots are removed.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR body provides linked Testbox evidence and describes after-fix real startup failure scenarios that exercise the actual Gateway lifecycle and assert both allocated roots are removed.
Evidence reviewed 6 items Current-main leak: Current main allocates the temporary root before resolving a repository CLI, but does not enter the cleanup try block until later; CLI discovery can throw first.
Existing lifecycle owner: The established cleanup helper already removes the workspace and an optional staged root, so expanding that owner scope is preferable to a new cleanup path.
Exact-head repair: The PR enters cleanup immediately after allocation and registers the canonical staged-root path before staging and host-version resolution can fail.
Findings None None.
Security None None.

How this fits together

QA Lab launches an isolated Gateway in a temporary workspace and sometimes stages bundled plugins in a repository artifact directory. Startup preparation feeds Gateway launch and RPC readiness, and failure handling must remove every root allocated by that lifecycle.

flowchart LR
  A[QA scenario] --> B[Allocate workspace]
  B --> C[Register startup cleanup]
  C --> D[Stage bundled plugins]
  D --> E[Resolve runtime and start Gateway]
  E --> F[Gateway RPC ready]
  D --> G[Startup failure]
  E --> G
  G --> H[Remove workspace and staged root]
Loading

Decision needed

Question Recommendation
After the branch is refreshed and exact-head checks complete, should this protected QA lifecycle repair be landed? Land after exact-head validation: Keep the owner-level cleanup repair and merge once the refreshed head is clean and its required checks pass.

Why: The maintainer label requires explicit human handling even though the current source and focused regressions support the repair.

Before merge

  • Resolve merge risk (P1) - GitHub reports the branch behind main and several checks remain in progress, so landing needs an exact-head validation refresh after any rebase.
  • Complete next step (P2) - The protected maintainer label and pending exact-head validation make this a human merge-review item rather than an automated repair candidate.
Agent review details

Security

None.

PR surface

Source +4, Tests +52. Total +56 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 142 138 +4
Tests 1 52 0 +52
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 194 138 +56

Review metrics

Metric Value Why it matters
Production vs test LOC production +4 net (+142/-138), tests +52 The small production increase centralizes existing cleanup ownership while the added lines exercise three pre-startup and staging failure boundaries.

Stored data model

Persistent data-model change detected: serialized state: extensions/qa-lab/src/gateway-child.test.ts, vector/embedding metadata: extensions/qa-lab/src/gateway-child.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the single QA Gateway lifecycle owner, refresh the branch against main if needed, and land once exact-head checks confirm the targeted cleanup regressions.
  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 single QA Gateway lifecycle owner, refresh the branch against main if needed, and land once exact-head checks confirm the targeted cleanup regressions.

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

Yes—current main has a source-defined path: invoke the repository-CLI mode with no CLI entry, or fail bundled-plugin staging after its external root is created. This read-only review did not execute the path.

Is this the best way to solve the issue?

Yes—the PR expands the existing Gateway lifecycle cleanup boundary and derives the same staged-root path before fallible work; a second cleanup wrapper would duplicate ownership and miss early exits.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The bug leaks temporary QA artifacts during startup failures but does not indicate a production Gateway outage or user data loss.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides linked Testbox evidence and describes after-fix real startup failure scenarios that exercise the actual Gateway lifecycle and assert both allocated roots are removed.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body provides linked Testbox evidence and describes after-fix real startup failure scenarios that exercise the actual Gateway lifecycle and assert both allocated roots are removed.

Label justifications:

  • P2: The bug leaks temporary QA artifacts during startup failures but does not indicate a production Gateway outage or user data loss.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body provides linked Testbox evidence and describes after-fix real startup failure scenarios that exercise the actual Gateway lifecycle and assert both allocated roots are removed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides linked Testbox evidence and describes after-fix real startup failure scenarios that exercise the actual Gateway lifecycle and assert both allocated roots are removed.

Evidence

What I checked:

Likely related people:

  • steipete: Authored this repair and several prior merged QA Gateway startup, process-cleanup, and teardown-evidence changes. (role: recent QA Gateway lifecycle contributor; confidence: high; commits: f31b3e77c48d, 5783c3a80e85, 4dc67161eee7; files: extensions/qa-lab/src/gateway-child.ts, extensions/qa-lab/src/gateway-child.test.ts)
  • vincentkoc: Recent merged history covers child spawn failures, orphaned runtimes, and child-runtime isolation in the same owner area. (role: adjacent QA Gateway lifecycle contributor; confidence: medium; commits: 8e375242bed2, 7d6e45ef7c43, 63e6bb026ca7; files: extensions/qa-lab/src/gateway-child.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the branch only if needed, then let required checks validate the exact merge head.

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
steipete merged commit 57122c9 into main Aug 5, 2026
131 of 140 checks passed
@steipete
steipete deleted the codex/autoqa-gateway-startup-cleanup-20260805 branch August 5, 2026 05:48
@steipete

steipete commented Aug 5, 2026

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

extensions: qa-lab 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: M 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