Repository navigation
[fix] canvas: send the draft to the API in the shape it accepts - #395
Merged
Merged
Conversation
FayeSpica
approved these changes
Nov 18, 2026
FayeSpica
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the fix!
I manually reproduced the draft save failure on main and verified on 45f1070e that drafts save while the assistant is replying and the next message sends successfully.
LGTM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Autosaving the composer fails with
422 请求字段无效,请检查必填项及字段格式。whenever the conversation the view holds was read while a reply was running.GET /assistantaddsactiveTurnIdwhile a chain is running. The view stores that object, and the draft autosave stripped onlymessagesbeforePUT /assistant/draft. BecauseDraftis declared withextra='forbid', the extra member is rejected — and sincesend()flushes the draft before posting the turn, the failed save also blocks sending the next message: the request never leaves the browser.The draft is now built from the fields the endpoint owns instead of forwarded wholesale, so members added to the read model later cannot break saving.
Refs #379.
Test plan
node --test tests/chatDrafts.test.ts— new case fails before the change (activeTurnIdpresent in the body) and passes afternode --test tests/*.test.ts— 838 passedtsc --noEmitcleanEvidence
Reproduced against a project that had a running reply:
PUT /assistant/draftwith the read model minusmessages→422 {"detail": "请求字段无效,请检查必填项及字段格式。", "code": "invalid_input"}; the same body withoutactiveTurnId→200. Verified on a real instance: the toast保存草稿失败,当前内容已保留:请求字段无效…appears on every keystroke and noPOST /assistant/messagesis ever sent.Labels
type:bug,area:canvas,area:agent— I do not have permission to set labels on this repository.Provider usage
No provider call is involved.
Bilingual check
No user-facing copy added or changed.