[bugfix] : fix error hadling - #22
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5f9efb4. Configure here.
| // stream must remain running when this send settles after supersession. | ||
| if (streamGenerationAtStart === streamGenerationRef.current) { | ||
| setIsRunning(false); | ||
| } |
There was a problem hiding this comment.
Stuck running after pre-turn failure
High Severity
sendTurn sets isRunning before pre-turn work, then clears it only when streamGenerationRef is unchanged. load also bumps that counter, so a pre-turn failure after a concurrent load can skip the clear and leave the composer permanently busy with no stream to recover it.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 5f9efb4. Configure here.
| return await step(); | ||
| } catch (error) { | ||
| onErrorRef.current?.(error); | ||
| throw new TrueFoundryPreTurnError(phase, error); |
There was a problem hiding this comment.
Duplicate pre-turn error callbacks
Medium Severity
runPreTurnStep already invokes onError before throwing TrueFoundryPreTurnError, but callers such as trySendCollectedRequiredActions and onEdit also report the rejection. Pre-turn failures therefore surface twice to consumers.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 5f9efb4. Configure here.
| const text = getTurnMessageText(message); | ||
| if (text.length > 0 && composer.getState().text.length === 0) { | ||
| composer.setText(text); | ||
| } |
There was a problem hiding this comment.
Attachments lost on send failure
Medium Severity
Pre-turn recovery only restores text via getTurnMessageText and composer.setText. Messages with attachments lose those files on failure, and attachment-only messages restore nothing because the text-length guard fails.
Reviewed by Cursor Bugbot for commit 5f9efb4. Configure here.


Note
Medium Risk
Touches core send-turn and
isRunningsemantics; behavior changes are intentional for UX but could affect consumers relying on prior error shapes or running-state timing.Overview
Pre-turn failures are now wrapped in
TrueFoundryPreTurnErrorwith aphase(session-initialization,session-resolution,session-loading,turn-headers) whensendTurnfails before the user message is projected or the turns API runs. Those steps go throughrunPreTurnStep, which still invokesonErrorand rethrows the typed error.isRunningis set at the start ofsendTurn(including session creation and other prep), and cleared in afinallyonly when no stream actually started—so the composer can exit a stuck busy state if prep fails, without clearing running state when a newer stream superseded the send.Composer recovery: On
TrueFoundryPreTurnErrorinonNew, the runtime puts the user's text back into the composer via newgetTurnMessageText(when the composer is empty).API:
getTurnMessageTextis extracted fromgetTurnMessageContent;TrueFoundryPreTurnErrorandPreTurnFailurePhaseare exported from the package index.Reviewed by Cursor Bugbot for commit 5f9efb4. Bugbot is set up for automated code reviews on this repo. Configure here.