Repository navigation
Conversation
…ails setAIResponseStatus ignores updates while the AI menu is closed, so a programmatic invokeAI that failed resolved like success. Reject with that error when the call starts with the menu closed. Calls that start with the menu open still resolve and store the error for the menu. Co-authored-by: Rahul Kashyap <itisrmk@users.noreply.github.com>
|
@cursoragent is attempting to deploy a commit to the TypeCell Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/diagram-block
@blocknote/mantine
@blocknote/math-block
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
@blocknote/xl-typst-exporter
commit: |
Summary
Programmatic
invokeAIcalls that fail while the AI menu is closed now reject with the same error the menu would have stored. Calls that start with the menu open still resolve and show that error in the menu.Rationale
invokeAIcaught transport failures, tool-execution failures (result.ok === false), and thrown errors, then only calledsetAIResponseStatus({ status: "error" }). That method returns immediately whenaiMenuState === "closed", so the error was logged and discarded. The promise resolved, the menu stayed"closed", and a caller could not tell an HTTP 500 or a failed tool call from success.The reporter asked for a result the caller can observe: reject, or return
{ ok: false, error }. Rejecting keeps the return typePromise<void>and makes the failure visible to existingawait/try/catchcallers.Changes
packages/xl-ai/src/AIExtension.ts: ifinvokeAIstarts with the menu closed, both failure paths reject with the error that would have been stored (chat.error,result.error, or the thrown value). The menu-open path still callssetAIResponseStatusand resolves.packages/xl-ai/src/AIExtension.test.ts: covers a transport error, a tool-execution error, and a thrown request, plus both failure paths while the menu is open.Impact
Callers that invoke AI without opening the menu can
catchthe failure and close the forked review themselves. Menu-driven calls start with the menu open, so they still resolve and render the error state.Testing
invokeAI, the three closed-menu tests resolved instead of rejecting.vp test --run src/AIExtension.test.ts: 5 passed.vp lint --type-aware --type-checkandvp fmton the touched files: passed.Closes #3275
Summary by CodeRabbit