Answer Claude questions in your own words, or dismiss them

Claude's question forms now accept a free-text answer beside the
offered options and can be dismissed. A dismissal tells Claude the
operator will reply in the chat instead, the card's button reads
Dismiss, and the composer takes the keyboard so the reply can be typed
at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 00:02:59 +00:00
parent 4c82a9637e
commit bfccf39671
5 changed files with 52 additions and 6 deletions
+6 -2
View File
@@ -625,7 +625,7 @@ func (c *Chat) Answer(ctx context.Context, request protocol.ChatAnswerRequest) e
deny := request.Action == "cancel" || request.Action == "decline"
var response any
if deny {
response = map[string]any{"behavior": "deny", "message": "The operator declined to answer"}
response = map[string]any{"behavior": "deny", "message": "The operator dismissed the question and will reply in the chat instead; wait for their message."}
} else {
answers := map[string]string{}
for index, question := range form.questions {
@@ -837,7 +837,10 @@ func (s *session) receiveQuestion(p *process, requestID string, request toolRequ
s.receivePermission(p, requestID, toolRequest{ToolName: "AskUserQuestion", Input: request.Input})
return
}
form := protocol.ChatForm{ID: requestID, SessionID: s.id, Kind: "question", Title: "Claude asked a question"}
// Claude's question tool always takes an answer of the operator's own
// beside its options, and a dismissed question goes back as a denial, so
// every field accepts free text and the form can be declined.
form := protocol.ChatForm{ID: requestID, SessionID: s.id, Kind: "question", Title: "Claude asked a question", Actions: []string{"accept", "decline"}}
questions := make([]string, 0, len(payload.Questions))
for index, question := range payload.Questions {
questions = append(questions, question.Question)
@@ -846,6 +849,7 @@ func (s *session) receiveQuestion(p *process, requestID string, request toolRequ
Title: question.Question,
Type: "string",
Required: true,
Custom: true,
}
if question.Header != "" {
form.Title = question.Header
+7 -2
View File
@@ -6,6 +6,7 @@ import (
"encoding/json"
"os"
"path/filepath"
"slices"
"strings"
"testing"
"time"
@@ -224,13 +225,17 @@ func TestQuestionBecomesAFormAndAnswerReturnsToCLI(t *testing.T) {
if form.Kind != "question" || len(form.Fields) != 1 || len(form.Fields[0].Options) != 2 {
t.Fatalf("form: %+v", form)
}
if err := chat.Answer(context.Background(), protocol.ChatAnswerRequest{SessionID: session.ID, FormID: form.ID, Answers: map[string]any{"q0": "Alpha"}}); err != nil {
// The operator may answer in their own words or dismiss the question.
if !form.Fields[0].Custom || !slices.Contains(form.Actions, "decline") {
t.Fatalf("a Claude question must take a custom answer and a dismissal: %+v", form)
}
if err := chat.Answer(context.Background(), protocol.ChatAnswerRequest{SessionID: session.ID, FormID: form.ID, Answers: map[string]any{"q0": "Neither, use the cache"}}); err != nil {
t.Fatal(err)
}
waitFrame(t, frames, "answered tool", func(frame protocol.ChatEventFrame) bool {
return frame.Kind == protocol.ChatEventTool && frame.Part != nil && frame.Part.State != nil &&
frame.Part.State.Status == protocol.ChatToolCompleted && len(frame.Part.State.Content) == 1 &&
strings.Contains(frame.Part.State.Content[0].Text, "Alpha")
strings.Contains(frame.Part.State.Content[0].Text, "Neither, use the cache")
})
waitStepEnded(t, frames)
if forms, _ := chat.Forms(context.Background(), session.ID); len(forms) != 0 {