Problem
After the Coven Cave desktop shell crashes or its Next/Turbopack dev server stops, the surviving Tauri WebView can keep requesting a stale dynamic chunk. The user sees a client-side ChunkLoadError, for example:
Failed to load chunk /_next/static/chunks/src_0wgfj9g._.js
from src/components/chat-settings-view.tsx
Next.js 16.2.9 (Turbopack)
A related failure mode is the native shell remaining open at 127.0.0.1 after its loopback server has exited, displaying ERR_CONNECTION_REFUSED.
This was reproduced in the PR integration worktree after an interrupted scripts/dev-app.sh session. The Tauri window survived while no loopback port was listening. A clean coordinated relaunch restored the app: the server listened on 127.0.0.1:3003, Tauri logged its dev-server origin, and GET / 200 succeeded.
Why this matters
A developer can be left with a visually running desktop app that cannot recover by refreshing, while the original cause is no longer visible. The chunk name implicates a client import but is not evidence that the corresponding feature component caused the crash.
Requested work
- Upgrade the pinned Next.js patch from
16.2.9 to 16.2.11 in a focused maintenance change, keeping React and Tauri versions unchanged unless a compatibility requirement is discovered.
- Audit
scripts/dev-app.sh and the Tauri dev lifecycle so the shell does not outlive an unavailable loopback server.
- Define crash recovery behavior:
- detect an unavailable dev-server origin before/after WebView initialization;
- show a Cave-owned recovery state or retry/reload path instead of a raw browser
ERR_CONNECTION_REFUSED page;
- avoid stale Turbopack dynamic-chunk references after server restart;
- ensure wrapper interruption cleans up the owned Next dev server and Tauri process tree.
- Add focused regression coverage for a server crash/restart while the desktop shell is open.
Reproduction
- Start the desktop shell with
bash scripts/dev-app.sh.
- Interrupt or otherwise terminate the loopback dev server while allowing the Tauri window to remain open.
- Navigate to a dynamically loaded settings/chat surface or refresh the existing view.
- Observe either a
ChunkLoadError for an old /_next/static/chunks/ asset or 127.0.0.1 refused to connect.
- Relaunching the entire server + Tauri pair resolves the symptom.
Acceptance criteria
Context
This is not attributable to PRs #3819, #3820, #3821, #3823, #3825, #3826, #3828, or #3830: none changes src/components/chat-settings-view.tsx.
Problem
After the Coven Cave desktop shell crashes or its Next/Turbopack dev server stops, the surviving Tauri WebView can keep requesting a stale dynamic chunk. The user sees a client-side
ChunkLoadError, for example:A related failure mode is the native shell remaining open at
127.0.0.1after its loopback server has exited, displayingERR_CONNECTION_REFUSED.This was reproduced in the PR integration worktree after an interrupted
scripts/dev-app.shsession. The Tauri window survived while no loopback port was listening. A clean coordinated relaunch restored the app: the server listened on127.0.0.1:3003, Tauri logged its dev-server origin, andGET / 200succeeded.Why this matters
A developer can be left with a visually running desktop app that cannot recover by refreshing, while the original cause is no longer visible. The chunk name implicates a client import but is not evidence that the corresponding feature component caused the crash.
Requested work
16.2.9to16.2.11in a focused maintenance change, keeping React and Tauri versions unchanged unless a compatibility requirement is discovered.scripts/dev-app.shand the Tauri dev lifecycle so the shell does not outlive an unavailable loopback server.ERR_CONNECTION_REFUSEDpage;Reproduction
bash scripts/dev-app.sh.ChunkLoadErrorfor an old/_next/static/chunks/asset or127.0.0.1 refused to connect.Acceptance criteria
16.2.11patch and relevant install/build gates pass.pnpm lint, targeted tests, andpnpm buildpass on Windows.Context
This is not attributable to PRs #3819, #3820, #3821, #3823, #3825, #3826, #3828, or #3830: none changes
src/components/chat-settings-view.tsx.