Repository navigation
fix: keep Gateway runtime checks off the main thread - #197975
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR makes Gateway runtime checks and child-failure diagnosis asynchronous while preserving existing recovery and synchronous caller contracts. Example: An executable check stalls during GET /readyz.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses an existing Gateway availability problem, resolves the previous finding, and has no newly identified correctness or security blockers. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe child-runtime viability owner supplies executable availability and failure diagnoses to Gateway readiness, health, startup, process supervisors, and database workers; the existing lifecycle owner handles recovery. flowchart TD
A[HTTP probes and health RPCs] --> B[Runtime viability owner]
C[Child process failures] --> B
B --> D[Asynchronous executable observations]
D --> E[Publish current runtime facts]
E --> F[Readiness and diagnostic responses]
E --> G[Existing lifecycle recovery]
C --> H[Native close and cleanup ownership]
Technical reviewBest possible solution: Use the existing runtime viability owner for asynchronous observations while preserving synchronous compatibility paths and native-close cleanup ownership. Do we have a high-confidence way to reproduce the issue? Current-main source directly connects readiness to synchronous executable access and failure diagnosis to synchronous runtime probes; this read-only review did not execute a reproduction. Is this the best way to solve the issue? The change repairs the blocking observations at their existing owner and carries prepared facts through consumers without adding a cache, recovery manager, configuration option, or stored format. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4fcfbb5cacde. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +315, Tests +667, Other +200. Total +1182 across 65 files. Added test files: 4. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 12, 2026, 9:40 PM ET / November 13, 2026, 02:40 UTC (Revision 2). |
Integrate the known main prerequisite for worker-environment fixture and wrapper inventory repairs. Move readiness contracts to the existing health type owner, retain the Windows diagnostic in native tooling, and prove held runtime I/O through real HTTP clients. Preserve unclaimed yielded-child continuation in the restart fixture.
The requested transport evidence is also now present in The body records current proof, the exact-main inherited export failures, and the unresolved SPA/resume observations. Four-pass Codex P2 review of the complete candidate is scoped-clean with static/partitioned-context limitations retained. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…penclaw#195406) Backport of c1e55e2. Release adaptation: retain synchronous release cleanup and its live authority callbacks. Include maintenance database gate and preactivation rollback regression. Exclude documentation and test-allocation metadata. Later async runtime probe repair openclaw#197975 is independent. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit aa2e94a1a07793071600de47831d990a0b0ae590)
What Problem This Solves
Fixes Gateway-wide stalls when a runtime executable lookup blocks during readiness checks or child-process failure diagnosis.
User Impact
Gateway readiness, health, startup, and recovery can wait for filesystem I/O without blocking unrelated requests. Missing or replaced runtimes still trigger the existing unavailable-runtime and recovery behavior. Public synchronous APIs retain their contracts.
Why This Change Was Made
The existing child-runtime owner now prepares physical facts asynchronously and carries them to publication, where callers also consult current logical state. Native asynchronous diagnosis stays separate from the failing command runner. Child processes retain independent physical-close settlement, so delayed or rejected diagnosis cannot release cleanup custody early. The broker shares one terminal diagnosis while preserving its already-ready failure behavior. No new cache, configuration, schema, or recovery manager is introduced.
This is an availability tradeoff, not a speedup. On a synthetic real-HTTP readiness workload (44 channels, 176 accounts), measured median overhead was approximately 0.013 ms wall, 8.15 µs main-thread CPU, 27.32 µs parent-process CPU, and 2658 sampled allocation bytes per request. All medians increased; loaded-host A/A variability and paired increases are retained below. Production code grows 315 lines to preserve the named synchronous interfaces and separate physical-close from asynchronous diagnosis. One import-time executable stat and explicit synchronous SDK/OOM/SQLite entry points remain.
Evidence
fs.promises.accesscompletion is held,/readyzremains pending and concurrent/healthzreturns 200. Changing drain state before release produces/readyz503 withgateway-draining. This exercises the production HTTP server/router/request lifetime; it is not a full model/plugin startup claim. The existing main-thread fs spy also passes.pnpm check:changed --staged --base 2035b073completed 39/40 stages: all types, lint, format, ratchets and other guards passed. Its dead-export stage reproduces identically on clean exact2035b073: a test-only trusted-proxy helper export introduced by feat(identity): accept co-author credit from trusted-proxy headers #196867 (f4f290c52) and eight live lazy-UI capability exports introduced by feat(ui): add optional inline command trail #197466 (d90d52cc). These are separate main regressions, not suppressed or treated as noise; no unrelated UI rewrite is included here.pnpm deadcode:unused-filespasses with zero production/full-tree entries.2035b073is scoped-clean; it was static with partitioned supplied context, not four independent complete-context executions. Prior owner 131-case, restart/startup and Windows/Workshop proofs remain explicitly scoped to their recorded predecessor source.accessSync2→0 for two requests, cached-health 2 sync→1 async observation, and diagnosed failureaccessSync1 +statSync1→0 sync with asynchronous observations. These are owner API-call counts, not kernel syscall counts.The main integration is pinned to
2035b073for two named CI prerequisites: thecreateWithRequestproducer and merged #197976 protocol inventory repair. Two missed fixture migrations are repaired with exact-parent red/green evidence: #197875 (9ecae401) omitted the artifact API fixture, and #195420 (924a3bc9) intentionally preserved unclaimed yielded work after requester completion while the restart fixture still expected failure. The corrected yield case positively joins requester completion and then proves a later real turn resumes and completes the same child. No timeout or authoritative status was weakened.Two failures remain investigated uncertainties. An unchanged SPA fallback test timed out on its first HTML request in the initial multi-file run; candidate and exact-parent isolated replays passed at the original timeout. CI also failed the partial-shutdown resume case with unavailable principal facts; its original selector passed once on exact CI main parent
20237d956and once on the integrated candidate. Neither passing comparison is presented as a fix, flaky diagnosis, or inherited-failure proof.Measurement scope and integration notes
Thirty separated timing/allocation rows used five rotated A1/B/A2 triplets, each with 5 warm requests and 60 measured requests. macOS Node 26.12.1; load 15.55–18.42. Pooled A→B medians per 60 requests: wall 9.403979→10.165292ms, main CPU 9.246→9.735ms, parent CPU 15.923→17.562ms, sampled allocation 2456500→2615984bytes. Paired increases reached 28.78% wall, 24.75% main CPU, 22.04% parent CPU. A/A ranges were −56.22% to +15.13% wall, −53.13% to +13.36% main CPU, −50.51% to +11.27% parent CPU, and −3.31% to +2.84% allocation. All 30 owned process groups drained naturally; no repeated or discarded rows. Allocation is sampled main-isolate V8 allocation, not total native/worker memory. Parent CPU excludes the source compiler child; setup/import and failure-probe costs are outside the window. The matched frozen source campaign measures this owner delta; exact-main correctness is qualified separately.
Overlapping open work observed during preparation: #157693 readiness cleanup projection/raw readiness fixture, #181390 health observedAt, and #196773 schema child-close waiters. No unrelated peer features were transplanted. Future composition must retain prepared-readiness fixtures and independent physical-child-close settlement.