Repository navigation
perf(gateway): keep publication recovery off the readiness path - #180128
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 SummaryThis 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. |
c74384e to
5783db6
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c74384e154
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
5783db6 to
2e3cc89
Compare
Run publication retries in the existing tracked background reconciliation operation. Preserve startup placement authority recovery and shutdown drainage while making Gateway readiness independent of Git/network recovery delays.
2e3cc89 to
2f357f1
Compare
|
Codex review: needs maintainer review before merge. What this changesMoves pending GitHub publication recovery into tracked background reconciliation so it no longer blocks Gateway readiness. Example: A pending publication waits on a local Git read delayed by 10 seconds.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it addresses a verified startup dependency with a focused change, and no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway placement sidecar restores placement authority during startup, then maintains placements and retries durable GitHub publications through lifecycle-tracked operations. flowchart TD
A[Gateway startup] --> B[Publication confirmation invalidation]
B --> C[Workspace and placement recovery]
C --> D[Gateway readiness]
C --> E[Tracked retirement and publication recovery]
E --> F[Existing Git and GitHub publication owners]
E --> G[Shutdown drain]
Technical reviewBest possible solution: Retain the existing reconciliation owner and shutdown drain while confirming the readiness improvement against the recorded performance acceptance rule. Do we have a high-confidence way to reproduce the issue? Current main directly awaits publication recovery during startup, and the supplied regression reports a base failure at that boundary; no target code was executed during this read-only review. Is this the best way to solve the issue? The runtime change is the smallest complete repair: it relocates the existing recovery call into an already tracked operation without adding ownership, caches, or a parallel publication path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 902a9a0af238. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +90, Docs +26, Other +236. Total +352 across 7 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel 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 Reviewed October 21, 2026, 10:07 PM ET / October 22, 2026, 02:07 UTC. |
|
The paired campaign is complete: three groups with five fresh boots per side (15 per build), including the v5.2 third group for mixed-sign RSS and shutdown results. The body now contains all group means, absolute/relative deltas, sample counts, latency spread, equal-work completion checks, exclusions, and limitations. Across all three groups, ready improved 23.684 → 12.958 seconds and first sessions.list RPC improved 23.780 → 13.051 seconds. Sampled process-tree CPU fell 6.83%; peak RSS rose 4.39 MiB (0.12%). Shutdown rose 164.65 ms (18.97% of the pooled baseline), below the declared rejection threshold. The 3.762-second plugin-metadata shutdown sample remains included; v5.2 uses the absolute mean. Every accepted boot completed recovery and exited cleanly without forced termination. Exact-head CI run 39708232280 passed all 38 executed jobs, including its CI gate. Duplicate same-head run 39708232491 was canceled immediately. The separate aggregate selects that higher-numbered canceled run, which explains its red CI-only projection; dependency and security-sensitive review statuses both passed. This is an unrelated aggregate-status defect, not a failing test. The successful run and canceled duplicate are both linked in the body; no CI rerun is needed. Landing is under the standing authorization for identified unrelated CI status failures. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…claw#180128) * perf(gateway): keep publication recovery off the readiness path Run publication retries in the existing tracked background reconciliation operation. Preserve startup placement authority recovery and shutdown drainage while making Gateway readiness independent of Git/network recovery delays. * fix(perf): seed a valid publication identity profile * test(perf): audit offline startup publication fixture writes * test(perf): compare completed startup work in publication benchmark
What Problem This Solves
Pending GitHub publication recovery can delay Gateway readiness and agent dispatch while local Git commands or GitHub requests wait. Three observed boots reached ready in 21.63, 96.51, and 36.54 seconds; publication recovery accounted for 6.38, 81.38, and 21.17 seconds respectively.
User Impact
The Gateway can become ready and admit agent dispatch while pending publication recovery continues. Required placement authority recovery and personal-publication confirmation invalidation still finish before dispatch opens. Publication effects retain their existing authority, durable recovery, and shutdown-drain contracts. No configuration, schema, or migration changes are required.
Why This Change Was Made
Publication retries now run in the existing tracked background reconciliation operation after session retirement, instead of blocking placement-runtime startup. A retirement failure postpones the initial retry to the existing scheduled recovery sweep. Runtime production code has no net line growth (6 added, 6 removed); no cache, owner, or parallel implementation is introduced.
The startup benchmark can seed a real pending publication and delay one read-only local Git command. It records that both builds actually reach and complete this boundary, and retains missing requester authority so the synthetic request cannot publish externally.
Evidence
The regression fails on the original code because startup remains pending during held publication recovery; it passes with the fix and also verifies that shutdown drains the held recovery. All 191 focused tests pass: 48 across startup, startup cleanup, startup maintenance, recovery events, and publication runtime; 43 startup-benchmark tests; and 100 credential-writer-guard tests. The runtime regression fails on base; the fixture-guard regression also fails before its repair. Changed-file formatting and lint pass. Independent review is clean through P2 on the full final patch. Broad validation belongs to PR CI.
CI caught two fixture writer edges that needed explicit review. The historical fixture is created in a new exclusive root before Gateway launch. The guard now permits only its private helper to insert one shared publication and execute one exact SQL literal removing requester authority from that synthetic request. Other callers, duplicate writes, changed predicates/values, and appended SQL remain rejected. No production authority bypass was introduced.
Paired measurements
Three concurrent groups, five fresh boots per side per group (15 per build). Group 2 swaps the interleaved CPU placement; group 3 resolves the two mixed-sign metrics under v5.2. Every boot passed ready/RPC, exact plugin inventory, delayed-publication completion, common post-ready completion milestones, and clean shutdown without a forced kill.
Workload: eight agents, 4,096 sessions, 128 MiB inert payload, and 44 loaded plugins (17 bundled plus 27 synthetic). A pending publication waits 10 seconds at a real read-only local Git boundary. Separate network namespaces and missing historical requester authority prevent external publication. Fresh process/state roots use a warm host filesystem cache.
The original swapped groups improve ready by 10.762 seconds (44.80%) and first RPC by 10.767 seconds (44.63%) on the mean paired delta; sampled CPU improves 5.48%. RSS (+26.58, −41.35 MiB) and shutdown (+35.77, −110.81 ms) initially had opposite signs and were treated as inconclusive, not adverse.
After the required third group, the absolute mean across all three groups is:
Shutdown is the measured tradeoff: the final absolute mean rises 164.65 ms, or 18.97% of the pooled baseline, below the 20% rejection threshold; the original swapped groups were +3.65% and −14.35%, so they also do not meet the both-groups rejection rule. One candidate shutdown took 3.762 seconds versus 0.537 seconds on its paired baseline; its trace attributes 3.316 seconds to plugin-metadata closure. That sample remains included. The v5.2 decision uses the absolute mean rather than the mean of relative deltas.
All gating metrics pass. The third group is decided on absolute means; no metric was rejected on a tiny-baseline relative mean. Completion time is additional context. The rejection rule is a ≥20% adverse paired mean or ≥10% adverse in both swapped groups, with mixed signs or >5× baseline differences requiring the third group.
Latency spread and low-sample tails
Each cell has n=5. Values are median [minimum, maximum] in seconds. The maximum is also the nearest-rank p95 at n=5; these tails are context only, below the 200-sample p95 gate minimum. No p99 gate is inferred.
The runtime removes the readiness dependency without abandoning work: representative pair 1-7 reduced worker-environment startup from 10.579 seconds to 11.5 ms while publication recovery still took 10.806 seconds and completed after ready. Required placement authority remains ahead of dispatch, and shutdown still joins publication recovery.
Protocol and limits: the shared guard is unchanged (2,500 ms production loop maximum, load 60, dirty pages 2 GiB); all measured pairs use slot B with baseline on even CPUs 64–94 and candidate on odd CPUs 65–95, reversed for group 2. Group 1 acquired the lock per boot; groups 2 and 3 held it across their five boots. No accepted measurement was interrupted by the guard. Preparation and fixtures were sequential under the prescribed low-priority CPU/IO limits.
CPU/RSS cover equal completed work: delayed Git read, initial post-ready database maintenance, and final handler prewarm must all finish before teardown. The initial ready/publication-only window permitted unequal background initialization, so its resource samples were excluded before this campaign. Setup failures (missing fixture identity/launcher, bypassed delay wrapper, and wrong plugin count) and the canceled preliminary run are also excluded. Accepted cohorts are group 1 indices 7–11, and groups 2/3 indices 1–5. Sampled process-tree CPU has whole-second resolution; RSS is sampled every 100 ms. No cold production page-cache experiment, real GitHub latency experiment, or per-collection GC measurement was performed.
The builds compare pinned base
a928225b43b17e78661a3bf9ef3a12d959724387with this runtime patch. Later rebases and the final current-main check did not change the affected startup/publication owners; current-head CI supplies broad validation. Production behavior awaits the next approved deployment/boot.Reproduction uses the committed benchmark with fresh roots, identical plugin JSON, a common start epoch, separate baseline/candidate entries and the CPU/guard/lock arrangement above:
Exact-head CI run 39708232280 passed all 38 executed jobs. Same-second duplicate 39708232491 was canceled immediately. The separate security-review aggregate selects the highest run ID, skipping only wholly skipped runs, and therefore projects that canceled duplicate as a CI failure. The exact publisher source at
5c5be9edb3855812a302c9807b1edfbb4e180154confirms that selection. Its security workflow succeeded; no CI rerun or branch update was requested to chase this unrelated aggregate status.Live signal after an approved deployment: readiness should precede completion of
sidecars.worker-environments.publications; placement authority recovery must still precede dispatch, and agent RPCs should not return the startup-unavailable error after ready. Publication recovery and its warnings may finish later. No production Gateway was changed or restarted.