Repository navigation
fix(gateway): flush startup diagnostics before readiness - #192383
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: needs maintainer review before merge. What this changesThis PR flushes buffered startup diagnostics before dispatch readiness and after post-attach completion. Example: A startup collector reads the diagnostics timeline immediately after /readyz returns HTTP 200.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it supplies a useful diagnostics-visibility repair missing from current main, with no actionable correctness or security findings; required CI remains unresolved. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherGateway startup prepares request handling and sidecars, emits diagnostic spans through a buffered process-wide writer, and publishes readiness consumed by health probes and startup collectors. flowchart LR
A[Gateway startup] --> B[Request runtime preparation]
B --> C[Flush diagnostics writer]
C --> D[Dispatch readiness]
D --> E[Post attach completion]
E --> F[Flush diagnostics writer]
F --> G[Non deferred sidecar readiness]
Technical reviewBest possible solution: Retain the two existing-writer flushes at the startup publication boundaries without adding another lifecycle or buffering owner. Do we have a high-confidence way to reproduce the issue? Source establishes that readiness can publish while previously emitted events await the scheduled writer flush; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch uses the existing synchronous flush owner at the two relevant startup boundaries, preserves deferred readiness semantics, and adds no competing state or abstraction. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 44eaed3d95d7. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +8, Tests +31, Other +2. Total +41 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 4, 2026, 5:10 PM ET / 22:10 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Readiness is the performance collector's evidence boundary. Flush the batched timeline events for request-runtime spans before dispatch readiness can make /readyz green. Forward-port of f617488 from release/2026.10.10.
The post-attach span ends inside startupTrace.measure(), but its timeline event is batched. Flush it before sidecar readiness can make /readyz green. The release regression test is not ported: main's minimal test Gateway starts with sidecars ready (release-only 591153e gates /readyz on post-attach), so its readiness can precede the post-attach span there. Forward-port of 166d761 from release/2026.10.10.
1ec9d31 to
02fc9fb
Compare
Carry the final reviewed changes from #191830, #192378, #192379, #192380, #192383, #192385, and #192386. Preserve #191838's existing file-transfer import fix. Adapt Gateway readiness to the release owner and include the narrow SQLite cold-admission prerequisite from #192586. Do not carry #192387: its Goal expectation depends on main-only Stop-to-paused behavior absent from this release. Retain regression allocations without changing the shared baseline.
…2383) * fix(gateway): flush startup evidence before readiness Readiness is the performance collector's evidence boundary. Flush the batched timeline events for request-runtime spans before dispatch readiness can make /readyz green. Forward-port of f617488 from release/2026.10.10. * fix(gateway): flush startup timeline before readiness The post-attach span ends inside startupTrace.measure(), but its timeline event is batched. Flush it before sidecar readiness can make /readyz green. The release regression test is not ported: main's minimal test Gateway starts with sidecars ready (release-only 591153e gates /readyz on post-attach), so its readiness can precede the post-attach span there. Forward-port of 166d761 from release/2026.10.10. * test(ci): scope startup forward-port regression allocation * test(gateway): snapshot startup evidence without another async gap
Problem
Startup performance collectors can miss terminal timeline events when readiness becomes green before buffered evidence is flushed.
Solution
Flush diagnostics at request-runtime readiness and post-attach completion.
Independent split of #191830, directly against
main; no sibling PR is required. Original release provenance is preserved in commit bodies. Scope excludes every other forward-port group.Evidence
34007820fa2ccompleted. Its async-read finding was addressed by using the already-importedreadFileSyncfor the readiness snapshot; no test-side flush is added.oxlint --type-aware, and diff checks passed. Freshnode scripts/run-vitest.mjs src/gateway/server-startup-minimal-boot.test.ts --maxWorkers=1: 4/4 passed on the repaired head. Initial attempts failed dependency setup; matching package-local links resolved the setup failure.Reviewed candidate:
1ec9d31f55e4.Split CI status
Additional broad Gateway CI failures: the Goal authority test still expects
active(the independent correction is #192387), and the Template Add authority test rejects its downloaded package manifest. The Template Add failure is inherited fixture/schema drift, not caused by this startup split:src/gateway/server-templates-add-authority.e2e.test.ts:92declaresopenclaw.template: "template.json", whilesrc/templates/reader.ts:105requires a package-relativeCLAW.md. Executing the realreadTemplateManifestFileowner with that fixture returnsinvalid_package_metadata;readVerifiedArtifactSourceconverts this into the exact CI error,Downloaded Template package manifest is invalid.The fixture, reader, and artifact-error owner are byte-identical between base34007820fa2cand candidate1ec9d31f55e4(verified Git blob identities). No unrelated fixture repair is included. A fresh full Gateway replay was attempted but stopped before Vitest because declaration preparation rejects this worktree’s shared dependency install (Declaration input escapes checkout); no passing full replay is claimed. Focused startup verification remains 4/4.Exact-head CI attribution audit
Audited 2026-11-04 at
1ec9d31f55e42638c3ef59a28572af67a4de37e0. Failed job logs were inspected individually, not inferred from their names.The MCP failures are inherited from base
34007820fa2c:src/agents/mcp-metadata.ts,agent-bundle-mcp-materialize.ts, andagent-bundle-mcp-types.tshave identical Git blob IDs at base and PR head. The missingMcpCatalogToolexport and consequent optional-property errors propagate through SDK declarations into boundary/build/lint/type lanes.The test-line ratchet is also inherited: this PR offsets its exact positive test-line delta, and its job still exceeds the adjusted ceiling by the same 47 lines already present at base (6,444,916 vs 6,444,869). No baseline increase or unrelated repair is included.
The changed-test shard also hits two inherited fixtures: the Goal cancellation expectation still says active instead of paused (independent correction #192387), and Template Add names
template.jsonalthough the reader requiresCLAW.md. The Template fixture, reader, and artifact-error owner are byte-identical to base; direct owner execution reproducesinvalid_package_metadata, mapped to the exact CI error. Full Gateway replay was blocked during declaration preparation; no full passing replay is claimed.Cancelled dispatch jobs are orchestration cancellations, not passing tests or additional source defects. CI remains red; this section explains the failures rather than claiming green.
Rebase onto current main
Rebased onto
a1f99240c8367a0e012b401bed71831a3cc65026, including merged Goal-test correction #192387. New candidate:02fc9fbcf4faace8ae1f7b00b813f779f30a2f57. This PR still targets main independently.Verified the complete rebased tree equals the previous PR patch integrated with that main snapshot. No new behavior was added during rebase. Prior test and CI attribution sections remain evidence for their named old revisions; fresh CI on this head is pending, not claimed green.