[codex] Fix desktop stale WebSocket prompt timeout - #40168
[codex] Fix desktop stale WebSocket prompt timeout#40168Tamaz-sujashvili wants to merge 1 commit into
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for targeting a real stale-transport failure mode. Current apps/shared/src/json-rpc-gateway.ts:267-273 still rejects a timed-out RPC without closing the socket, while apps/desktop/src/app/gateway/hooks/use-gateway-request.ts:104-116 only reconnects for disconnected/closed errors.
Problems
- The Desktop submit implementation moved after this branch:
apps/desktop/src/app/session/hooks/use-prompt-actions.tsno longer exists on main. The active flow isapps/desktop/src/app/session/hooks/use-prompt-actions/submit.ts:337-381, which already has selected-session timeout recovery, andapps/desktop/src/hermes.ts:74-82, which givesprompt.submita 1,800,000 ms timeout. The proposed status path needs to be integrated with that current behavior. apps/desktop/src/lib/json-rpc-gateway.test.tsproves socket closure only. It does not exercise the accepted-submit/lost-response/reconnect path or guard against duplicate submission.
Suggested changes
- Port the behavior to the current submit pipeline and add an end-to-end unit regression for that sequence.
Automated hermes-sweeper review.
| @@ -320,7 +339,19 @@ export function usePromptActions({ | |||
| await syncImageAttachmentsForSubmit(sessionId, attachments, { | |||
There was a problem hiding this comment.
This submit hook was extracted on current main: the live path is now apps/desktop/src/app/session/hooks/use-prompt-actions/submit.ts:337-381, which already resumes and retries selected stored sessions after a timeout. Please port and reconcile this recovery there rather than applying the old-hook logic unchanged.
|
The still-relevant Desktop heartbeat and reconnect-recovery behavior from this PR has been adapted to the current shared gateway architecture in #83166. Tamaz Sujashvili is credited in the combined PR and as a co-author on the synthesized integration commit. This cross-link does not close or rewrite this PR. |
Fixes #40164.
Summary
prompt.submittimeout as accepted whensession.statusconfirms the backend turn is running.Root Cause
After idle time, the desktop WebSocket could become stale. The backend accepted
prompt.submit, but failed to send the response over the old socket, producingrequest timed out: prompt.submitin the renderer. Later sends hit the still-running backend and surfaced assession busy.Validation
npm --workspace apps/desktop run test:ui -- src/lib/json-rpc-gateway.test.tsnpm --workspace apps/desktop run type-checkscripts/run_tests.sh tests/test_tui_gateway_server.py -- -k session_lookup_rebinds_current_transport