Fix: keep generation retryable and don't disable local actions when offline#78
Fix: keep generation retryable and don't disable local actions when offline#78deepfates wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46fed5feed
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| await page.route("**/api/generate", async (route) => { | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: "text/event-stream", | ||
| body: 'data: {"content":" The connection returned."}\n\ndata: [DONE]\n\n', | ||
| }); |
There was a problem hiding this comment.
Delay the success mock until after reconnect
When this e2e runs, the /api/generate route is registered before context.setOffline(true), so the offline A-button click still matches this handler and is fulfilled with the 200 SSE body from the test process instead of producing the expected fetch failure. That makes the Network error assertion time out (or at least skips the intended offline error path); register the success mock only after setOffline(false), or have the route abort while the context is offline.
Useful? React with 👍 / 👎.
Motivation
navigator.onLinecheck and a generation error short-circuit created a silent dead-end that prevented retries after transient failures.Description
navigator.onLinepreflight fromuseTextGenerationso the client attempts the real/api/generatefetch and surfaces network failures via the existing error path (client/interface/hooks/useTextGeneration.ts).isOfflineis true and instead disable only while a generation is actively in-flight (client/interface/Interface.tsx).client/interface/hooks/useStoryTree.ts).tests/e2e/offline-controls.e2e.ts).Testing
bun run lint, which completed successfully.bun test ./server ./client— full suite passed (155 tests).bun run build— build succeeded.bunx playwright test tests/e2e/offline-controls.e2e.tsbut execution was blocked in this environment because Playwright’s Chromium binary could not be downloaded (CDN download returned HTTP 403), so the new e2e regression could not be executed here.Codex Task