fix(gateway): stop stale control ui auth retry loops#81771
Conversation
30a276d to
934f67c
Compare
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. for source-level reproduction: current browser and Node clients can keep reconnecting on Real behavior proof Next step before merge Security Review detailsBest possible solution: Land this or an equivalent maintainer-reviewed patch that preserves one-shot trusted device-token recovery, stops stale token-mismatch reconnect loops without a queued fallback, keeps the current 100-message cap, and closes #72139 after validation. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current browser and Node clients can keep reconnecting on Is this the best way to solve the issue? Yes, the PR direction is the narrow maintainable fix: gate reconnects on an actually queued trusted fallback and add UI-local bounded render budgeting. The safer landing path is maintainer validation rather than automated cleanup or a separate repair PR. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 365c986a5b2a. |
934f67c to
d969255
Compare
|
Pre-merge verification for head Local focused proof after rebasing on latest node scripts/run-vitest.mjs ui/src/ui/gateway.node.test.ts src/gateway/client.test.ts ui/src/ui/chat/build-chat-items.test.ts
# 4 files passed, 127 tests passed
node scripts/run-vitest.mjs src/gateway/reconnect-gating.test.ts ui/src/ui/controllers/chat.test.ts ui/src/ui/views/chat.test.ts
# 4 files passed, 115 tests passed
pnpm exec oxfmt --check --threads=1 CHANGELOG.md ui/src/ui/gateway.ts ui/src/ui/gateway.node.test.ts ui/src/ui/chat/history-limits.ts ui/src/ui/chat/build-chat-items.ts ui/src/ui/chat/build-chat-items.test.ts src/gateway/client.ts src/gateway/client.test.ts
# all matched files use the correct format
git diff --check
# cleanGitHub proof on
Known proof gaps:
|
Summary
AUTH_TOKEN_MISMATCHunless a trusted cached device-token retry is actually queued.tool_result.content, while preserving the current 100-message cap.Behavior addressed
A stale Control UI token no longer keeps reconnecting every backoff interval when there is no cached device-token fallback to try. Slow/large chat history rendering is also capped by raw tool-output payload size so a dashboard tab is less able to starve channel sockets.
Real environment tested
Local Codex worktree on macOS, Node v24.13.0, pnpm v10.33.2, focused Vitest through the repo
node scripts/run-vitest.mjswrapper.Exact steps or command run after this patch
node scripts/run-vitest.mjs ui/src/ui/gateway.node.test.ts src/gateway/client.test.ts ui/src/ui/chat/build-chat-items.test.ts node scripts/run-vitest.mjs src/gateway/reconnect-gating.test.ts ui/src/ui/controllers/chat.test.ts ui/src/ui/views/chat.test.ts pnpm exec oxfmt --check --threads=1 CHANGELOG.md ui/src/ui/gateway.ts ui/src/ui/gateway.node.test.ts ui/src/ui/chat/history-limits.ts ui/src/ui/chat/build-chat-items.ts ui/src/ui/chat/build-chat-items.test.ts src/gateway/client.ts src/gateway/client.test.ts git diff --checkEvidence after fix
git log -1 --show-signature.Observed result after fix
AUTH_TOKEN_MISMATCHwhen local storage has no trusted device token to retry, instead of creating another WebSocket.onReconnectPausedfor the same no-fallback token mismatch case.What was not tested
pnpm check:changedthrough Testbox was not completed.node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --timing-json --shell -- "pnpm check:changed"failed because.github/workflows/crabbox-hydrate.ymldoes not contain a Blacksmith testbox step, then the wrapper hung and was stopped.