app-builder: conversation is permanently wedged after a server restart (unknown_session not recovered)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, react, typescript
Direzione di ricerca
Start in sdk/app-builder/src/app/app-builder.tsx at the restore flow around lines 345–390 and the manual Retry flow around lines 861 and 890; read how missing_api_key is handled and how requestSession accepts a session ID. Check the server response in src/app/api/sessions/route.ts to confirm the unknown_session code. Done when both flows clear the stale session and request a fresh one, and retry no longer repeats the 404 after a server restart.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What
In app-builder, after the server process recycles (e.g. you restart pnpm dev) and you reload the page, the restored conversation gets permanently stuck on a session error. The on-screen "Retry" doesn't help; only "Change API key" or creating a new conversation recovers.
Why
Sessions are an in-process Map on the server (sdk/app-builder/src/lib/app-builder/server.ts:159) — only the API key is persisted client-side, not sessions. On reload, the client restores conversation.session.id from localStorage and re-sends that stale id:
- restore sends
restoredSessionId = activeConversation.session?.id(app-builder.tsx:345-349), and the manual Retry does the same (:861,:890). - the server no longer has that session →
restoreSessionthrowsUnknownAppBuilderSessionError(server.ts:241-244), which the route maps to HTTP 404 withcode: "unknown_session"(src/app/api/sessions/route.ts:71-79).
The client's restore catch (app-builder.tsx:365-390) only special-cases isMissingApiKeyError (which matches code === "missing_api_key" only, :3863-3865). An unknown_session error falls through to the generic branch, which sets sessionError but never clears the dead conversation.session. Retry reuses the same stale id → the same 404. The conversation is wedged.
This is exactly the restart-the-demo path, so it hits in normal local use.
Suggested fix
Treat code === "unknown_session" as a cache miss, next to the existing missing_api_key handling: drop conversation.session and mint a fresh one by calling requestSession(validSavedApiKey, undefined, …) (no stale sessionId). Same for the manual Retry path (retrySavedApiKey).
I filed this as an issue rather than a PR because the fix sits in the restore/retry React flow and I couldn't run app-builder to verify the retry doesn't loop; happy to send a PR if you'd like. Found on main @ e1c3f64.
- Lingua principale
- TypeScript
- Stelle
- 4.2k
- Fork
- 503
- Merge medio
- 3g 23h
- PR unite (30g)
- 1
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cursor/cookbook
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Python SDK: cloud agents with a named environment fail with "env.name cannot be combined with repos"Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
-
No CI: a typecheck matrix over the examples would have caught #60 and #61Forse già presa @deanrie l’ha presa 36 giorni fa. Aperta
Difficoltà 3/5 Mezza giornata Idoneità per principianti 50/100
-
Human-IA generativeAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
-
App Builder passes local.envVars, which @cursor/sdk ignoresForse già presa @rajarshidattapy l’ha presa 82 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
Tutte le issue di cursor/cookbook
Issue simili
-
P2
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
bug ready-for-human
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
LucasSantana-Dev/Lucky#3150 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue priority: low size: XS
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
area: testing bug priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
snapotter-hq/SnapOtter#5099 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
EveryInc/compound-engineering-plugin#2091 ·
I maintainer di solito rispondono entro 1 giorno