Repository navigation
Description
Bug
Clicking the "+" button in the sidebar to open a new project shows nothing — no dialog, no error message.
Root Cause
Three compounding issues:
1. Stale client bundle after redeployment
When the server is redeployed with a new build, all Vite chunk hashes change (e.g. dialog-select-directory-utHQcNsA.js → dialog-select-directory-CRC4imRH.js). Browser tabs that were open before the redeployment still have the old main JS bundle loaded, which tries to dynamically import chunks with old hashes that no longer exist on the server.
2. Silent failure via void import(...) pattern
The dynamic imports in layout.tsx use the void import(...) pattern which discards the promise. When the import fails (404 on stale chunk), the rejection becomes an unhandled promise rejection — no error dialog, no console message visible to the user, no recovery mechanism.
// layout.tsx:1507 — the failing code
void import("@/components/dialog-select-directory").then((x) => {
if (dialogDead || dialogRun !== run) return
dialog.show(/* ... */)
})3. SPA fallback masks the 404
In instance.ts (embedded UI path), the catch-all route falls back to index.html for any missing path, including .js chunk files:
embeddedWebUI[path.replace(/^\//, "")] ?? embeddedWebUI["index.html"] ?? nullThis means a missing .js chunk actually returns HTML content instead of a proper 404, causing a confusing MIME type error rather than a clean import failure.
4. No cache-busting headers on HTML
Neither instance.ts nor server.ts set Cache-Control headers on HTML responses, so browsers may cache stale index.html that references old chunk hashes.
Why tests didn't catch this
- E2E tests always start fresh with the current build — they never test "old client + new server" scenarios
- The
void import(...)anti-pattern silently swallows errors as unhandled rejections — no test asserts on this - The SPA fallback bug in
instance.tsactually masks the 404 — making it even harder to detect during development - No integration test verifies behavior when a lazy chunk returns 404
Fix
- Fix SPA fallback in
instance.ts: Only fall back toindex.htmlfor extensionless routes (matchingserver.tsbehavior), so stale.jsrequests properly 404 - Add
Cache-Control: no-cacheto HTML responses: Bothinstance.tsandserver.tsnow set cache headers on HTML, ensuring browsers revalidate on each navigation - Global stale-module detection in
entry.tsx: Listen forunhandledrejectionevents matching dynamic import failures and show a persistent "new version available" overlay with a Reload button — covers all 15+ dynamic import sites across the app
Activity
github-actions commentedon Apr 11, 2026
This issue has been automatically closed.
fix: handle stale chunks after redeployment in serve mode
OpenCodeEngineer commentedon Apr 11, 2026
Fix PR created: dzianisv#151
Changes:
instance.ts: Fixed SPA fallback to only returnindex.htmlfor extensionless routes (stale.jschunks now properly 404 instead of returning HTML)instance.ts+server.ts: AddedCache-Control: no-cacheon HTML responsesentry.tsx: Added global stale-module detection with persistent reload promptCommit: 61e215c
dzianisv commentedon Apr 12, 2026
Fix deployed and verified on remote server (100.108.64.76:4096).
Three bugs fixed:
Stale Vite chunks after redeployment (original issue) — SPA fallback in
instance.tswas returning HTML for missing.jschunks instead of 404. Also addedCache-Control: no-cacheon HTML and global stale-module detection overlay inentry.tsx.ReferenceError: vcs is not definedin session.tsx — regression from commitb04367638which removed the[vcs, setVcs]store declaration but left all usages.ReferenceError: displayText is not definedin message-part.tsx — regression from commit206845687which addeddisplayText()references without defining the variable.Verified on live deployment:
Cache-Control: no-cache.jsassets return proper 404PR: dzianisv#151
Commits:
61e215c93,862e032aa,3185fd29eOpenCodeEngineer commentedon Apr 12, 2026
Follow-up deployment update (in progress). A separate prompt execution regression caused immediate stop after submit on hosted serve. Fix commits on PR #151: 970531f (tool init guard), 8b76a40 (restore instruction system/resolve helpers), bd3a255 (copilot small-model fallback adjustment). PR: dzianisv#151. Current status: deployed to 100.108.64.76:4096 and prompt submit no longer stops immediately.
dzianisv commentedon Apr 12, 2026
Status update: merged and deployed. PR dzianisv#151 merged into dzianisv/dev at commit e7cf75f, and the remote serve host (100.108.64.76:4096) is now running that revision. Current status: merged.