Skip to content

Fix: restore new chat startup flow - #22

Open
xIGBClutchIx wants to merge 1 commit into
davej:mainfrom
xIGBClutchIx:fix/new-thread-prewarm-routing
Open

Fix: restore new chat startup flow#22
xIGBClutchIx wants to merge 1 commit into
davej:mainfrom
xIGBClutchIx:fix/new-thread-prewarm-routing

Conversation

@xIGBClutchIx

Copy link
Copy Markdown
Contributor

Summary

This restores responsive New chat startup in Pocodex by recognizing the current Codex bundle's new-conversation triggers and routing thread-prewarm-start responses back to the correct browser session instead of letting prewarm fall through to the timeout path.

What changed

  • update the bootstrap new-conversation trigger detection to handle both older New thread labels and newer New chat labels, including shortcut-suffixed sidebar text
  • preserve explicit ?thread= and initial-route deep links instead of overwriting them with the stored / route during bootstrap restore
  • forward thread-prewarm-start through the app-server bridge on the same thread/start sanitization path used for normal MCP requests
  • prefix prewarm request ids in the host routing layer so returning mcp-response messages resolve back to the originating browser session
  • add focused regression coverage in test/bootstrap-script.test.ts, test/app-server-bridge-workers.test.ts, and test/request-id.test.ts

Root cause

  • newer Codex bundles initiate New chat startup with a thread-prewarm-start request before the real thread handoff
  • Pocodex still relied on older New thread trigger text in parts of the bootstrap flow and only rewrote host request ids for mcp-request
  • that let stale thread restore state survive newer New chat controls and caused the prewarm response to be dropped instead of routed back to the browser
  • once the response was dropped, the bundle waited for its prewarm timeout and only then issued a second real thread/start, which produced the long startup stall

Impact

  • New chat no longer waits for the prewarm timeout before the real thread handoff can complete
  • explicit thread deep links and initial-route launches are preserved instead of being replaced by the stored root route
  • focused regression coverage now protects both the new-conversation trigger detection and the prewarm request-routing contract

Validation

  • pnpm run check:commit
  • pnpm exec vitest run test/request-id.test.ts test/app-server-bridge-workers.test.ts test/bootstrap-script.test.ts
  • live local verification on http://127.0.0.1:8796/ showed about 10.2s on a cold run and about 1.0s on the immediate retry instead of the prior ~30s stall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant