Feat/ask user with form#84
Conversation
- Persist pending form messages as thread messages on run.input_requested - Finalize form messages (submitted/dismissed) on input submission - Expire pending forms on terminal run end (completed/cancelled/failed) - Add AskUserFormMessageCard component for editable and read-only views - Route form-mode input-request events through message stream instead of overlay - Widen web message types to support AskUserFormContent tagged union Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…assthrough - normalizeInputRequest now preserves display_mode field from SSE events - Add display_mode to AgentInputRequestData type - Create optimistic form message in message store on form-mode input-request - Remove setAwaitingInput for form mode (form card handles all input) - Rewrite AskUserFormMessageCard from wizard to unified scrollable form - Update display_mode description in tool spec Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: daac5bab85
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const doSubmit = useCallback(() => { | ||
| if (!allValid || submitting || disabled) return | ||
| setSubmitting(true) | ||
| onSubmit(values) | ||
| }, [allValid, submitting, disabled, onSubmit, values]) |
There was a problem hiding this comment.
Reset submitting state after ask-user form submission returns
Set submitting back to false when onSubmit settles (including failures), otherwise a transient API error leaves the form permanently disabled for that message and the user cannot retry or dismiss without a full reload. This path is reachable because onSubmit is invoked asynchronously but never awaited or finalized here.
Useful? React with 👍 / 👎.
| jsonb_set(content_json, '{status}', to_jsonb($5::text)), | ||
| '{answers}', COALESCE(to_jsonb($6::jsonb), 'null'::jsonb) | ||
| ), | ||
| '{submitted_at}', COALESCE(to_jsonb($7::text), 'null'::jsonb) |
There was a problem hiding this comment.
Align SQL placeholders with bound args in form status update
This statement references $7 (submitted_at) but tx.Exec only passes six arguments, so PostgreSQL will fail the update at runtime (bind message supplies 6 parameters, but prepared statement requires 7). As written, pending ask-user form messages cannot be transitioned to expired in this code path.
Useful? React with 👍 / 👎.
| json_set(content_json, '$.status', json_quote($5)), | ||
| '$.answers', COALESCE($6, json('null')) | ||
| ), | ||
| '$.submitted_at', COALESCE(json_quote($7), json('null')) |
There was a problem hiding this comment.
Fix SQLite placeholder mismatch in form status update query
The desktop/SQLite variant has the same placeholder bug: query uses $7 while only six values are bound. That causes the status/answers/submitted_at update to fail at runtime, so pending ask-user form records are not marked as expired in desktop execution.
Useful? React with 👍 / 👎.
- Move form-mode ask_user from message flow to input area during filling; submitted/dismissed forms appear in chat flow only via message sync - Remove "Submitted"/"Dismissed" status badge from submitted form view - Fix SelectField/OneOfSelectField dropdown clipping by using createPortal + position:fixed with auto up/down direction, outside click dismiss, and scroll-close to prevent misalignment - Extract shared PopoverSelect component to eliminate duplication between SelectField and OneOfSelectField Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… hasRunContinued check The input-request deduplication logic only checked for tool-result or terminal events to determine if an input had been answered. After a user submits a form, the run may continue with assistant-delta or tool-call events before any tool-result arrives. When switching threads causes SSE reconnect and event replay, the input-request would be reprocessed because no tool-result was found after it. Fix: relax hasRunContinued to check for any subsequent event, since input-request is a blocking point and no events can follow it unless the user has already responded. Also includes skill updates: - feat(skill): add ecommerce detail-page image generation flow - chore(skill): rename display_name to 电商图生成助手 - feat(skill): generate prompts in user's chosen language (zh/en) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add locale strings for Yes/No, Hide/Show answers, select placeholders, and form buttons in AskUserFormMessageCard component. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
In AskUserFormMessageCard review view, place field labels above instead of inside the highlighted value containers. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
When an ask_user form is active (status=pending and runId matches activeRunId), skip rendering the form card in MessageList. The editable form is already shown via pendingFormInput at the bottom. The message history now displays the prompt text as a normal assistant bubble instead, avoiding two identical forms on screen. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
重构了问询表单的渲染逻辑,确保活跃表单仅在底部输入区域展示,同时新增了对应的测试用例验证该行为。
整页的表单,用于较为具体的用户需求或者信息提交。区别于审核模式会将提交内容保留在 chat 历史记录中显示