Repository navigation
fix(gateway): share GitHub options preparation during reconnects - #173589
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. |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4bd57923a1
ℹ️ 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".
|
Codex review: needs maintainer review before merge. What this changesThis PR shares pending GitHub publication metadata preparation across overlapping requests while preserving caller-specific authorization and cleanup. Example: Three overlapping requests ask for publication options for session main.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses repeated preparation still present on main, and no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherGateway publication-options and status RPCs combine session metadata, caller permissions, GitHub identity, and publication receipts into an authorized response. flowchart TD
A[Control UI requests] --> B[Gateway RPC handlers]
B --> C[Pending session preparation]
C --> D[Session read worker]
E[Committed metadata receipts] --> C
C --> F[Caller authorization and visibility]
F --> G[Publication options response]
Technical reviewBest possible solution: Retain pending-only sharing around the existing metadata owner, preserving independent authorization and receipt-driven invalidation. Do we have a high-confidence way to reproduce the issue? Main visibly performs separate preparations for overlapping requests; the reported regression fails before sharing and passes afterward, but this review ran no target code. Is this the best way to solve the issue? The patch addresses duplicate preparation at its existing owner without caching completed results or sharing caller permissions, and the added tests protect meaningful lifetime contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 86118fa4f875. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +68, Tests +81. Total +149 across 2 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 15, 2026, 8:56 PM ET / October 16, 2026, 00:56 UTC. |
* commit '56c315156f4542f197a2b7f727681ba3f41c21b5': (23 commits) fix(ui): remove stale Lit cleanup from model catalog tests refactor(tests): consolidate iMessage discovery checks (#173624) fix(auto-reply): retire older collect cancellation after admission fix(memory): avoid rebuilding initially empty indexes after restart (#173622) fix(test): preserve subprocess runtime identity (#173446) perf(sessions): batch transcript index reconciliation (#173620) fix(gateway): share GitHub options preparation during reconnects (#173589) perf(control-ui): open the composer model picker without list-wide work (#173275) fix: finish compile-cache cleanup after short CLI commands exit (#173603) refactor(ui): finish native shell rendering (#171554) fix: preserve standalone CLI profiles and settle Doctor shutdown (#173154) refactor: centralize agent memory host typing (#173619) fix: camera fallback picker opens away from the attachment button (#173618) refactor: deduplicate existing CI runner routing with YAML anchors (#172670) fix(ai): preserve multiline Google replies and report malformed streams (#173612) refactor(tests): remove duplicate speech policy test (#173606) refactor(ui): simplify page rendering and derivations (#173608) fix(release): Linux channel promotion fails after a withdrawn Windows companion (#173615) fix(update): wait for native Gateway ownership before restarting (#173588) test(sessions): admit schema probe fixture writes behind maintenance ...
…nclaw#173589) * fix(gateway): share GitHub options preparation during reconnects * fix(gateway): isolate options preparation across config revisions * perf(gateway): reuse prepared sessions for publication receipt reads * perf(gateway): coalesce pending publication observations
* fix(ci): share the iOS screenshot build * fix(ci): preserve the screenshot artifact container on download * merge: integrate main for iOS screenshot workflow conflicts * style(ci): format the combined screenshot evidence changes * docs(ci): name the combined screenshot capture * fix(ios): expose screenshot simulator creation errors * Merge main at 56c3151 to include the UI test cleanup fix * commit '56c315156f4542f197a2b7f727681ba3f41c21b5': (23 commits) fix(ui): remove stale Lit cleanup from model catalog tests refactor(tests): consolidate iMessage discovery checks (#173624) fix(auto-reply): retire older collect cancellation after admission fix(memory): avoid rebuilding initially empty indexes after restart (#173622) fix(test): preserve subprocess runtime identity (#173446) perf(sessions): batch transcript index reconciliation (#173620) fix(gateway): share GitHub options preparation during reconnects (#173589) perf(control-ui): open the composer model picker without list-wide work (#173275) fix: finish compile-cache cleanup after short CLI commands exit (#173603) refactor(ui): finish native shell rendering (#171554) fix: preserve standalone CLI profiles and settle Doctor shutdown (#173154) refactor: centralize agent memory host typing (#173619) fix: camera fallback picker opens away from the attachment button (#173618) refactor: deduplicate existing CI runner routing with YAML anchors (#172670) fix(ai): preserve multiline Google replies and report malformed streams (#173612) refactor(tests): remove duplicate speech policy test (#173606) refactor(ui): simplify page rendering and derivations (#173608) fix(release): Linux channel promotion fails after a withdrawn Windows companion (#173615) fix(update): wait for native Gateway ownership before restarting (#173588) test(sessions): admit schema probe fixture writes behind maintenance ... Co-authored-by: Vincent Koc <[email protected]>
* fix(ci): share the iOS screenshot build * fix(ci): preserve the screenshot artifact container on download * merge: integrate main for iOS screenshot workflow conflicts * style(ci): format the combined screenshot evidence changes * docs(ci): name the combined screenshot capture * fix(ios): expose screenshot simulator creation errors * Merge main at a11e38b to include the UI test cleanup fix * commit 'a11e38b8bb1eb58aaf392a0eab458dbb47aad30f': (23 commits) fix(ui): remove stale Lit cleanup from model catalog tests refactor(tests): consolidate iMessage discovery checks (openclaw#173624) fix(auto-reply): retire older collect cancellation after admission fix(memory): avoid rebuilding initially empty indexes after restart (openclaw#173622) fix(test): preserve subprocess runtime identity (openclaw#173446) perf(sessions): batch transcript index reconciliation (openclaw#173620) fix(gateway): share GitHub options preparation during reconnects (openclaw#173589) perf(control-ui): open the composer model picker without list-wide work (openclaw#173275) fix: finish compile-cache cleanup after short CLI commands exit (openclaw#173603) refactor(ui): finish native shell rendering (openclaw#171554) fix: preserve standalone CLI profiles and settle Doctor shutdown (openclaw#173154) refactor: centralize agent memory host typing (openclaw#173619) fix: camera fallback picker opens away from the attachment button (openclaw#173618) refactor: deduplicate existing CI runner routing with YAML anchors (openclaw#172670) fix(ai): preserve multiline Google replies and report malformed streams (openclaw#173612) refactor(tests): remove duplicate speech policy test (openclaw#173606) refactor(ui): simplify page rendering and derivations (openclaw#173608) fix(release): Linux channel promotion fails after a withdrawn Windows companion (openclaw#173615) fix(update): wait for native Gateway ownership before restarting (openclaw#173588) test(sessions): admit schema probe fixture writes behind maintenance ... Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
Concurrent
sessions.github.optionscalls after reconnect independently prepare the same session, then shared-receipt lookup prepares it again. These ordered metadata reads queue behind session discovery and cause options timeouts. Related: #173534.Change and Ownership
Share only pending durable-session preparation, keyed by published configuration identity/revision, requested agent, and session key. Each caller keeps independent cancellation, live permissions, and disposal; the last waiter releases the existing retained predicate. Incognito actors keep their caller-owned path. Settlement removes the pending entry: there is no completed cache, TTL, retry, schema change, or new configuration.
Carry that prepared read into receipt lookup instead of acquiring the session again. Both options and publication actions reuse their held owner. Standalone receipt/status reads still acquire their own owner; shared-state observation remains on readers. Identity, workspace, and disclosure checks still run around asynchronous observation. Identical durable observations share only their pending worker result. Publication, worktree-registry, repository-workspace, and database lifecycle owners clear pending entries on change; settlement evicts the entry. Private actors and maintenance contexts retain separate reads.
Production delta against the task base: +120 lines; tests: +158 lines. Growth preserves independent cancellation/release and coalesces two distinct pending operations without keeping completed snapshots. The 150-reader regression demonstrates why removing repeated acquisition also requires coalescing the resulting observation fanout. Removing ordered acquisition would lose the snapshot/invalidation boundary. The simplification removes repeated acquisition rather than layering another snapshot cache beside the existing owner.
Reproduction and Measurement
The exact #173534 parent (
086fc5ca52d2) and merge (6574349e132d) each use freshly generated synthetic state: 5,000 sessions, 6,000 retained runs, 200 approvals, 100 cron jobs, 12 projects, and 1,500 MiB logical transcript text (4.64 GB agent database). The existing restart driver pairs 150 clients, interrupts 30 held model requests, and measures five minutes of reconnect polling. Same fixture shape and command for every variant; authorized isolated Linux sandbox with CPU/memory/I/O limits and loopback ports. No production state is used.3403dc4d8fa8)All baseline timeouts occur during the initial burst. This matched pair does not reproduce the earlier 2→55 count; the earlier report used a different baseline. It does reproduce duplicate ordered session preparation. Correlating request trace IDs with slow agent reservations finds 173 slow ordered reads for the merge run: 989,289 ms cumulative queue wait versus 39 ms execution (maximum 7,796 ms queue versus 3 ms execution). This identifies preparation queuing, not execution in the shared-state reader pool. An intermediate sharing-only run still had 111 timeouts; tracing it exposed the redundant receipt preparation removed in the final change.
The final burst has zero timeouts and zero capacity failures. All 150 clients connect. All-attempt p99 improves 2.82× versus the merge; successful-only p99 includes formerly failing slow startup requests and must not be interpreted without the timeout count. Options-attributed slow ordered reservations fall from 173 to 3, with cumulative queue wait 989,289 → 5,656 ms. A borrowed-session-only intermediate run exposed reader fanout (54 timeouts plus 34 capacity failures); it is not the final candidate. The 150-reader regression reproduced 150 observation submissions before coalescing, then one afterward, with new reads after publication and workspace-owner changes.
Secondary Latency Control
The original driver sleeps after each response. Shared completion therefore clusters later polls: median in-flight
sessions.listcalls at arrival rise from 5 on the merge to 21 with the fix; requests per occupied 10 ms bin rise 7.01 → 31.19. Other RPCs have zero errors, but their original-run p99 rises: list 76.51 → 283.33 ms; catalog 81.27 → 289.31 ms; projects 81.81 → 289.76 ms. Warm main-thread CPU falls 605.49 → 485.68 ms per approximately five-second sample (~20%).An additional two-minute fixed-cadence control compared the exact parent and fix using their already-recovered synthetic fixtures. It staggers 150 clients evenly over the existing five-second poll interval and samples the final minute. This isolates per-request latency from response-driven cohort synchronization; it is separate from the original five-minute reconnect result above. Each method completed 1,799 requests in the sampled minute, with zero errors on both versions:
This control finds no meaningful per-request regression; the 0.11 ms projects p99 difference and 0.44 ms options median difference are noise-scale in a single paired run. The original driver remains the reconnect proof. Its higher sibling latency is consistent with the measured response-driven synchronization, not additional CPU work. These are single paired samples, not statistical confidence intervals.
Proof and Review
Focused regression coverage proves one preparation for overlapping readers, independent cancellation/disposal, archive invalidation, fresh subsequent reads, and config revision separation even when the same config object is republished. The original sharing and revision tests failed before their respective fixes. A real retained-session regression fails when borrowed custody is ignored and passes when released custody is rejected.
Focused checks: authorization 8 passed; shared receipt reads 35 passed, plus the expanded workspace-invalidation regression passed after review; RPC/actions 47 passed; session lookup 14 passed. CI caught a stale three-argument mock expectation after adding the prepared-read argument; the failing file passes after repair. Changed-file oxfmt, core lint, and diff checks passed. An initial test import loaded production code before harness mocks; moving the import inside the test corrected all six fixture failures. One intermediate test invocation rejected source formatting changes during its compiled-worker run; final verification uses stable source.
PR CI owns broad validation; no Testbox/Crabbox was allocated and no broad local suite/typecheck/build was invoked. Focused test commands perform their normal worker-artifact preparation. Earlier authorization-only head CI passed; the borrowed-read head exposed the alias-routing mock expectation above. Exact-head CI run 38833983805 passed on
3403dc4d8fa80ab24910d22453217f6542faa4be, including broad tests, types, and lint. The required CI gate is checked before merge.Independent subagent review (autoreview route unavailable): no actionable P0/P1/P2 findings, including review of the config-revision repair and borrowed snapshot lifetime. The autoreview helper refused the provider route because it did not match operator configuration; configuration was not changed.