Repository navigation
fix(ui): Control UI floods agent.identity.get while the Gateway restarts - #165443
Conversation
Keep rejected identity requests in the shared per-agent cache until the read retry deadline, honoring Gateway retry hints and preserving the last displayed identity during failed refreshes. Reconnect and explicit invalidation retire the cooldown. Evict settled failures under the existing cache bound. Regression proof: the original owner issued 41 requests for 40 repeated updates, while the fix issues one per retry window. Identity tests pass (12 cases, 2.86 s command wall time); focused consumers pass (63 cases). No Gateway protocol or drain-policy changes.
|
🦞👀 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. Reviewed October 5, 2026, 4:28 AM ET / 08:28 UTC. ClawSweeper reviewWhat this changesThe Control UI shares failed agent-name and avatar requests until a retry deadline, honors Gateway retry hints, and documents reconnect recovery. Merge readiness✅ Ready for maintainer review This remains a useful, focused repair: current main still immediately evicts failed identity requests, and the verified merge result preserves the proposed fix. No blocking correctness findings were identified. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI’s identity cache shares Gateway reads between the sidebar and chat. It supplies agent names and avatars while connection and roster changes invalidate outdated results. flowchart TD
A[Sidebar updates] --> C[Shared identity cache]
B[Chat identity reads] --> C
C --> D{Retry deadline reached?}
D -->|No| E[Reuse cached request]
D -->|Yes| F[Gateway identity read]
F --> C
G[Reconnect or invalidation] --> C
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +10, Tests +123, Docs +6. Total +139 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep retry pacing in the shared identity cache while preserving successful-read freshness, displayed identities, and immediate reconnect invalidation. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the path: rejected identity reads are evicted on current main and sidebar updates request them again. The PR reports a live storm and failing baseline regressions; this review did not execute them. Is this the best way to solve the issue? Yes, the patch repairs the shared request owner with the existing retry helper and retains connection-generation safeguards, avoiding separate sidebar and chat retry implementations. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a9f4080f9749. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Keep rejected identity requests in the shared per-agent cache until the read retry deadline, honoring Gateway retry hints and preserving the last displayed identity during failed refreshes. Reconnect and explicit invalidation retire the cooldown. Evict settled failures under the existing cache bound. Regression proof: the original owner issued 41 requests for 40 repeated updates, while the fix issues one per retry window. Identity tests pass (12 cases, 2.86 s command wall time); focused consumers pass (63 cases). No Gateway protocol or drain-policy changes.
What Problem This Solves
Fixes: the Control UI floods the Gateway with
agent.identity.getwhile the Gateway is draining for a restart or finishing post-crash admission, because every sidebar render re-sends the rejected read immediately.User Impact
User impact: an open Control UI tab no longer hammers a restarting Gateway; agent names and avatars keep their last loaded values while a refresh fails, and identity reads resume promptly after reconnect. No protocol or drain-policy change.
Why This Change Was Made
The identity cache deleted an entry as soon as its request was rejected. The sidebar requests identities on every update, so the next render issued a fresh request at once. The cache now keeps the rejected request shared until a retry deadline, backing off from 500 ms to 5 s with the existing
resolveGatewayReadRetryDelayMshelper (which honors longer GatewayretryAfterMshints). Successful reads keep their TTL; reconnect and explicit invalidation still clear the entry.Evidence
Live: during a 315 s Gateway drain, one Control UI tab sent 65 rejected
agent.identity.getrequests in ~80 s, in bursts of up to 7 per second (UNAVAILABLE … unavailable during gateway restart).Regression (fake clock, no sleeps or Gateway boots):
Consumers also pass:
assistant-identity.node.test.ts,chat-avatar.test.ts,control-ui-agent-avatar.test.ts,control-ui-session-summary.test.ts(63 tests).pnpm tsgo:ui,pnpm tsgo:test:ui, targeted oxlint,pnpm docs:check-links, andgit diff --checkpass.No visual change. Production +27/−17; tests +124/−1; docs +6.
Siblings checked
sessions.catalog.listandmodels.listalready pace/coalesce.sessions.describe(failed reads evicted immediately),sessions.messages.unsubscribe(short fixed retries), andboard.get(refresh notifications can wake backoff) have separate owners and are left for follow-ups.