Repository navigation
fix(ui): back off unavailable session PR polling - #114266
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 2:36 AM ET / 06:36 UTC. ClawSweeper reviewWhat this changesThis PR makes the Control UI browser gateway client suppress or back off session pull-request RPC calls after the gateway reports that the session-PR surface is unavailable, and routes sidebar and chat callers through that shared method. Merge readiness⛔ Blocked until real behavior proof is added - 3 items remain Keep this PR open for human merge review. The shared browser-client gate is a coherent fix for an availability failure that current main does not yet contain, and the related gateway cache PR addresses a separate server-cost concern; however, this PR still has no after-fix connected-gateway evidence showing that request volume is bounded and that the UI recovers as intended. The protected Likely related people: Priority: P1 Review scores
Verification
How this fits togetherThe Control UI fetches per-session pull-request summaries from a gateway RPC for sidebar indicators and chat suggestions. The browser gateway client is the shared boundary between those UI refreshes and the server-side session-PR provider, so it can prevent each caller from independently retrying an unavailable service. flowchart LR
Sidebar[Sidebar PR indicators] --> Client[Browser gateway client]
Chat[Chat PR suggestions] --> Client
Client --> Gate{Availability and retry gate}
Gate --> RPC[Session PR gateway RPC]
RPC --> Provider[Session PR provider]
Gate --> UI[Null summary or PR summary]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +75, Tests +319. Total +394 across 11 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the shared client-side gate, then add redacted connected-gateway proof showing a failed session-PR provider produces one bounded request wave, the expected suppression/backoff behavior, and summary recovery after the intended reset path before a maintainer decides to merge. Do we have a high-confidence way to reproduce the issue? No high-confidence live reproduction was established in this read-only review. The source and report describe a credible loop through the advertised RPC callers, but the available evidence is pre-fix journal output rather than a reproducible current connected-gateway scenario. Is this the best way to solve the issue? Yes, provisionally: centralizing availability control in the shared browser gateway client is narrower and less drift-prone than separately patching sidebar and chat callers. The remaining requirement is live proof that its latch, retry, and reset semantics match real gateway behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 054495d16dd6. 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 (3 earlier review cycles)
|
The sidebar PR indicators iterated worktree rows sequentially; each ~68ms UNAVAILABLE reply immediately advanced to the next row, hammering controlUi.sessionPullRequests at ~14 calls/second forever (the method is advertised while its runtime dependency is down, so the advertised-method gate never stopped it). Route all callers through GatewayBrowserClient.requestSessionPullRequests: a non-retryable UNAVAILABLE latches until the next socket hello; retryable failures back off 30s doubling to 5min, honoring longer server retry hints. A generation counter keeps concurrent rows from multiplying one outage wave.
Type the PR-indicator request mocks with real signatures instead of bare vi.fn shells, and keep GatewaySessionPullRequestsParams module-local until a second consumer exists.
992ff25 to
0ace42f
Compare
|
Merged via squash.
|
* fix(ui): back off unavailable session PR polling The sidebar PR indicators iterated worktree rows sequentially; each ~68ms UNAVAILABLE reply immediately advanced to the next row, hammering controlUi.sessionPullRequests at ~14 calls/second forever (the method is advertised while its runtime dependency is down, so the advertised-method gate never stopped it). Route all callers through GatewayBrowserClient.requestSessionPullRequests: a non-retryable UNAVAILABLE latches until the next socket hello; retryable failures back off 30s doubling to 5min, honoring longer server retry hints. A generation counter keeps concurrent rows from multiplying one outage wave. * fix(ui): satisfy test-types and knip lanes Type the PR-indicator request mocks with real signatures instead of bare vi.fn shells, and keep GatewaySessionPullRequestsParams module-local until a second consumer exists. * test(ui): route hydration stubs through the PR latch wrapper * chore(ui): drop unused ControlUiSessionPullRequests re-export * test(ui): stub the PR latch wrapper in sidebar and clobber fixtures
What Problem This Solves
A connected Control UI client hammers the gateway with
controlUi.sessionPullRequestsat ~11–14 calls per second, sustained for minutes, every reply failing. Production journal on team.openclaw.ai (2026-07-27 03:05 UTC, one connection, back-to-back):Mechanism: the sidebar PR indicators iterate worktree session rows sequentially, and every caller gates only on
isGatewayMethodAdvertised(...). The method is advertised while its runtime dependency is down (src/gateway/server-methods/control-ui.ts:68answers UNAVAILABLE), so each ~68ms failure immediately advances to the next row — an unbounded poll loop the advertised-method gate can never stop.Why This Change Was Made
Availability is a property of the connection, not of each call site, so the gate lives in
GatewayBrowserClient.requestSessionPullRequests()and every caller (sidebar indicators viasession-menu-work.ts, chat suggestions) routes through it:retryAfterMshints.null; consumers already handle the absent-summary case.One shared helper instead of per-callsite patches, matching how other optional gateway surfaces are consumed.
User Impact
No more request-spam floods against gateways whose session-PR provider is unavailable (each flood burned ~70ms of gateway work per call, 14×/s, per client). Indicators quietly resume when the surface recovers or the client reconnects.
Evidence
app-sidebar-session-pr-indicators.ts(sequential row iteration) andchat-pane-suggestions.ts.ui/src/api/gateway.node.test.ts(257 lines): permanent-unavailable latch, retryable backoff with server hint, concurrent-row generation guard, reconnect reset, response ordering.session-menu-work.test.ts,app-sidebar-session-pr-indicators.test.ts,chat-pane-pull-requests.test.ts,chat-pane.test.ts— all green (focused rerun after squash: 1 shard, passed).git diff --checkclean.gpt-5.6-sol, xhigh): clean, "patch is correct (0.91)".