Repository navigation
fix(qa): keep leases when Gateway startup teardown fails - #131740
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 4:40 PM ET / 20:40 UTC. ClawSweeper reviewWhat this changesThe branch gives QA Gateway startup a lifecycle owner that survives failed startup, releases transport leases only after confirmed shutdown, migrates QA callers, and strengthens CodeQL network-boundary routing. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open for maintainer review: the central lease-ownership repair is source-supported and no discrete patch defect was established, but this maintainer-labelled PR has incomplete introduction evidence and running exact-head checks. Priority: P1 Review scores
Verification
How this fits togetherQA Lab launches isolated Gateways for source-checkout scenarios and may hold shared transport credentials while they run. The Gateway lifecycle result controls whether transport cleanup may release those credentials and remove runtime artifacts. flowchart LR
A[QA suite] --> B[Gateway lifecycle owner]
B --> C[Gateway process group]
C --> D{Shutdown confirmed?}
D -->|Yes| E[Release transport lease]
D -->|No| F[Retain lease and artifacts]
B --> G[QA callers and fixtures]
Decision needed
Why: The protected maintainer label requires human handling, and incomplete introduction evidence prevents an automated complete-diff merge conclusion. Before merge
Agent review detailsSecurityNone. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single pre-start lifecycle owner and its explicit shutdown result, then land only after a maintainer has covered the omitted introduced hunks and the exact-head required checks are green. Do we have a high-confidence way to reproduce the issue? Yes. The source provides a concrete POSIX process-group fault path: the integration test uses an actual spawned descendant and local credential broker, then asserts no release after denied termination; it was not rerun in this read-only checkout. Is this the best way to solve the issue? Yes for the central defect. Moving ownership before the awaited startup closes the missing-handle gap in fetched main, while the cleanup plan consumes the owner-recorded terminal result instead of inferring liveness from handle absence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5e5b3d5136d0. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
c3e4e89 to
3647070
Compare
|
Final source: This updates the existing proof and supersedes prior resolved inventory/CI blockers. The original bug was an ownership gap: QA created the ready Gateway handle only after startup, then inferred that no handle meant no process. Failed startup could return a credential lease while a Gateway descendant remained alive. The lifecycle owner now exists before startup, registers each spawn synchronously, and survives startup failure, retries, replacement and finalization. Only Process and operator proof. Real suite cleanup and the credential HTTP client were exercised against a disposable leader/descendant and synthetic loopback broker on macOS and Linux. Before: release while the descendant lived. After: no release and continued heartbeat when termination was denied; the normal control releases after confirmed termination. Signal-zero probes remained real. Linux QA passed 217 files / 3,019 tests. The private-QA build at OPENCLAW_BUILD_PRIVATE_QA=1 node --import ./scripts/tsx.mjs scripts/build-all.mtsOPENCLAW_ENABLE_PRIVATE_QA_CLI=1 node openclaw.mjs qa suite --provider-mode mock-openai --scenario channel-chat-baseline --concurrency 1 --output-dir .artifacts/qa-e2e/startup-lease-fix/operator-smoke-87vZGF/suiteThe parsed summary asserted no reply to unmentioned chatter and Integration and security gates. Nine commits were replayed patch-identically onto pinned main Full CodeQL exposed a stale exact JSONL socket owner after the macOS companion cancellation/JSONL owner refactor (#131650); its classification was corrected without widening allowance. The PR now escalates sensitive changes to semantic analysis in the same pull-request run, covers configured net-policy and TS/MTS/JS/MJS sources, runs real fixtures with all five raw-socket and two managed-proxy expected rows, and enforces SARIF findings. Distinct JS/TS fixture stems, both explicit MTS options, duplicate-scan registration and whitespace-tolerant exact owner/function assertions retain coverage. The late missing-patch finding is fixed. Attribution correction: Actual YAML Bash plus real jq reproduced four red cases before the workflow edit. Afterward, 190 tests passed with two intentional skips, including 39 selector/findings cases; scoped types/type-aware lint and full workflow sanity passed. Fresh isolated Codex review found no actionable P0/P1 defects. OcPath CI follow-through. The prior CI shard failed only three wall-clock budgets: 959.96/800 ms, 4753.43/2000 ms and 992.67/400 ms; 449 other files / 5,896 tests passed. Original-host CPU samples are unavailable. No particular host-contention or dependency cause is asserted. The demonstrated measurement flaw is that off-CPU scheduling delays count against synchronous compute. The minimum-of-three workaround in #122994, authored and merged by @steipete, retained that flaw. The private helper now uses current-worker A fresh SharedArrayBuffer plus bounded 250 ms Final local commands ran under Node 24 with isolated allowlisted HOME/state/config and no inherited live credentials: node scripts/run-vitest.mjs extensions/oc-pathnode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions-test.tsbuildinfoOPENCLAW_OXLINT_SKIP_PREPARE=1 node scripts/check-changed.mjs -- extensions/oc-path/src/oc-path/tests/scenarios/perf-determinism.test.tsnode node_modules/oxfmt/bin/oxfmt --check extensions/oc-path/src/oc-path/tests/scenarios/perf-determinism.test.tsgit diff --checkAll passed. The scoped gate includes extension types and type-aware lint: 263 rules, zero warnings/errors. Supported prerequisite separation reused usable declarations; it did not weaken type policy. Fresh isolated Codex review of the complete helper/owners/contracts and red/green proof found no P0/P1 defects. Prior full and fixture reviews still cover unchanged code. Review disposition and limits. ClawSweeper's latest exact-head review at August 28, 20:40 UTC reports no actionable correctness or security findings; the previous review explicitly accepted the selector repair. Its Rank-up requests are exact-head green checks and inspection of 35 files omitted from its supplied input. The combined-scope parent checkpoint is complete under the existing maintainer fix/test/land authorization: the complete 115-file introduced diff, pinned base, patch-identical stack and full/fixture reviews were inspected. No schema or persisted-data change exists; the bot's truncated-input marker is not a discovered migration. Live main rules and active secops maintainer membership were reverified: linear history and openclaw/ci-gate (strict=false), with no independent approval rule. The explicit parent checkpoint approved this exact source head for native landing under the existing maintainer authorization. Runtime +1,104/−1,193 (net −89); tests/support +2,204/−455 (net +1,749); tooling/guards +41/−34 (net +7); docs +32. Latest OcPath commit alone: tests +24/−22. No public configuration, schema, dependency, protocol or broker TTL change. No live credentialed channel/model, Windows, live Linux UID-controller or parent/host-loss durability proof is claimed. Earlier local declaration preparation timed out at its unchanged 300000 ms limit; later complete extension types and supported type-aware lint reuse passed. That earlier full local gate is not claimed successful. Selector guard setup needed an external isolated temp root for unchanged CommonJS fixtures and the repository-pinned actionlint fix; temporary writable Go-cache cleanup was rerun successfully. No assertions or rules were relaxed. Named follow-ups remain the 29 original root-QA lint diagnostics (including two unchanged supplemental E2E HTTP callbacks) and GitHub's 3,000-file API-cap policy. Separate adapter/transcript work remains separate. The previously approved suppression inventory is resolved. The final OcPath shard passed all 12 benchmark/determinism cases; the full shard passed 450 files / 5,902 tests, with one file / 57 tests intentionally skipped. No retry or threshold increase was needed. |
|
Merged via squash.
|
…1740) * fix(qa): keep leases when Gateway startup teardown fails Retain a synchronous QA child owner through startup, replacement, and explicit finalization. Release Gateway-backed transport leases only after authoritative process settlement, independently of cleanup diagnostics. Preserve failure artifacts and primary fixture errors. Fixes openclaw#131643 * test(qa): keep fixture cleanup inside plugin boundaries * test(qa): retain integrated fixture owners and stop observations * ci: follow renamed local JSONL socket owner in CodeQL * test(qa): record reviewed cleanup error suppressions * test(ci): exercise PR-native network semantic review Route sensitive changes into the existing semantic gate and restore configured net-policy coverage. Add actual query fixtures, including an intentional red checkpoint for JavaScript-family raw clients before the follow-up predicate repair. PR remains draft until semantic proof and final CI pass. * fix(ci): classify supported JavaScript network sources Preserve the existing directory and owner boundaries across TS, MTS, JS, and MJS. Hosted semantic regression 33190472078 failed on exactly the three missing executable rows; expected findings and test exclusions remain unchanged. * test(ci): isolate network fixtures and retain guard coverage Use independent fixture stems and explicit MTS extractor inputs while preserving every expected finding. Scan the semantic fixture root for duplicates and keep the exact socket-owner assertion insensitive to formatting. * test(qa): return confirmed stop in WhatsApp cleanup fixture * test(qa): own Discord attachment gateway before startup * ci: fail closed on unavailable CodeQL diff metadata * test(oc-path): measure synchronous worker CPU budgets
Closes #131643 — QA Lab releases leases after unconfirmed Gateway startup cleanup.
What Problem This Solves
Fixes an issue where source-checkout QA runs could return a shared transport credential lease after Gateway startup failed, even while a descendant of that Gateway remained alive. The real suite cleanup path and lease client reproduced this against a disposable process group and synthetic loopback broker: the old code released with the leader gone but its descendant still running.
Why This Change Was Made
Create the Gateway lifetime owner before awaiting startup and register every spawn before acceptance/readiness. That same owner survives failed startup, retry, replacement and explicit finalization, and returns
never-spawned,confirmed-stoppedorunconfirmedindependently of cleanup diagnostics. Standard suites, manual lanes, shared live-lane startup and private QA fixtures no longer infer termination from a missing ready handle.The refactor removes the success-only startup factories, reuses conservative POSIX liveness, serializes concurrent stops, permits a later stop to retry unconfirmed termination, and preserves failure artifacts until explicit finalization. Fixture cleanup preserves both operation and cleanup errors while attempting all owned cleanup phases. Existing transport
cleanup/cleanupAfterGatewayStopcontracts remain unchanged.User Impact
A failed QA startup cannot release its Gateway-backed lease without authoritative shutdown confirmation. Unconfirmed termination retains lease heartbeat and runtime ownership; unrelated diagnostic errors do not masquerade as live processes. Normal npm Gateway behavior is unchanged: this is private source-checkout QA infrastructure, and the private facade callers migrate together.
No public configuration option, dependency, SQLite schema, persisted-state format, broker TTL or protocol change. Telegram's conditional quarantine is not generic protection, and there is no new durability guarantee after parent/host loss. Discord/WhatsApp adapter phase repairs and transcript work remain separate.
Evidence
Final source:
822c20f2cca. Exact-head gates: CI 33208608685 and PR-native CodeQL 33208608680. Both completed successfully: CI 172 successful jobs / 16 intentional skips; PR-native CodeQL includes actual semantic query tests, analysis and fail-on-findings. Network semantic job.Complete final proof, commands, contracts, review dispositions and limits.
CI follow-through and review disposition
Nine prior commits replayed patch-identically, with no conflicts, onto pinned main
4788f764f578b28c6ab26ee19b941a940632ffe0after actual merge-tree failures. Subsequent Discord, selector and OcPath repairs did not rebase for drift. Private-QA imports remain within plugin boundaries; newly landed executable callers of removed startup APIs were migrated. The final fixture integrations retain synchronous ownership and cleanup before startup awaits.Necessary CodeQL follow-through corrects the renamed JSONL socket owner from the macOS companion cancellation/JSONL owner refactor (#131650), escalates sensitive diffs into same-PR semantic work, covers configured net-policy and JS/TS-family sources, retains real query fixtures (5 raw + 2 managed rows, distinct stems and both MTS options), registers duplicate-scan targets and permits formatting whitespace in the exact owner assertion. No query scope, action pin, permission or timeout is weakened.
The late missing/null-patch finding is addressed at the metadata owner.
.patch // ""was pre-existing, not introduced here. GitHub's optional-patch contract was inspected directly; a live first-100-file read had patches for all entries, so no actual omission or precise omission threshold is claimed. One successful snapshot replaces three requests and duplicate scans; explicit absent/null monitored-source metadata selects full analysis. The adjacent shard detector propagates API/parse failures. Ordinary/excluded cases and exact contract/Codex triggers are preserved.ClawSweeper's latest exact-head review at August 28, 20:40 UTC reports no actionable findings; its previous review explicitly accepted the selector repair. Its remaining Rank-up moves are final exact-head green CI and maintainer inspection of files omitted from its limited input. The complete 115-file introduced diff, pinned base and retained full/fixture reviews were inspected, and the combined-scope parent checkpoint is now complete under the existing maintainer fix/test/land authorization; no schema/persistence change is hidden in the omitted input. The latest OcPath delta has its own fresh isolated review and boundary regression.
Runtime +1,104/−1,193 (net −89); tests/support +2,204/−455 (net +1,749); tooling/guards +41/−34 (net +7); docs +32. Most files are mechanical private-QA caller migration and focused regression/semantic fixtures. Latest test-only OcPath repair is +24/−22.
Limits: no live credentialed channel/model, Windows, live Linux UID-controller or host-loss durability proof. Original process/CLI proof remains at its recorded source identity, not a new local rebuild. Earlier declaration preparation hit the unchanged 300000 ms timeout; subsequent complete extension types and supported type-aware lint reuse passed, and normal hosted preparation passed on this exact head. No successful full local gate is claimed for that earlier timeout. Named follow-ups: 29 original root-QA lint diagnostics outside canonical lint shards (including two unchanged supplemental callback errors), and GitHub's 3,000-file API-cap policy. Separate adapter/transcript work is not closed here. The narrow suppression inventory decision is approved and resolved.
AI-assisted implementation and independent review.
Release-note context: QA Lab retains Gateway ownership and transport leases through failed startup until shutdown is confirmed, while preserving failure artifacts and diagnostic errors. Docs: https://docs.openclaw.ai/concepts/qa-e2e-automation.
The final OcPath shard passed all 12 benchmark/determinism cases; the full shard passed 450 files / 5,902 tests, with one file / 57 tests intentionally skipped. No retry or threshold increase was needed.