@devries-cameron20 / t3code Mirror · read-only / commits / 7112697e8b
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 07:45 UTC

feat(threads): dismiss async questions without replying (#10431)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

Theo Browne committed Sep 6, 2026 at 17:16 UTC 7112697e8be2d6f231726a91eb565e00ddbeebec
18 files changed +369 -6
apps/mobile/src/features/threads/PendingUserInputCard.tsx
+14
@@ -66,6 +66,8 @@ export interface PendingUserInputCardProps {
66 customAnswer: string,
67 ) => void;
68 readonly onSubmit: () => Promise<unknown>;
69 + /** Closes an async question without a reply. Hidden for native callback questions. */
70 + readonly onDismiss: () => Promise<unknown>;
71 }
72
73 /**
@@ -338,6 +340,18 @@ export function PendingUserInputCard(props: PendingUserInputCardProps) {
340 Submit answers
341 </Text>
342 </Pressable>
343 + {props.pendingUserInput.dismissible ? (
344 + <Pressable
345 + accessibilityRole="button"
346 + className="items-center justify-center rounded-2xl px-4 py-2.5 active:opacity-70"
347 + disabled={props.respondingUserInputId === props.pendingUserInput.requestId}
348 + onPress={() => void props.onDismiss()}
349 + >
350 + <Text className="font-t3-bold text-sm text-foreground-muted">
351 + Dismiss without answering
352 + </Text>
353 + </Pressable>
354 + ) : null}
355 </Animated.View>
356 ) : null;
357 return (
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+2
@@ -158,6 +158,7 @@ export interface ThreadDetailScreenProps {
158 customAnswer: string,
159 ) => void;
160 readonly onSubmitUserInput: () => Promise<unknown>;
161 + readonly onDismissUserInput: () => Promise<unknown>;
162 readonly showContent?: boolean;
163 }
164
@@ -909,6 +910,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
910 onSelectOption={props.onSelectUserInputOption}
911 onChangeCustomAnswer={props.onChangeUserInputCustomAnswer}
912 onSubmit={props.onSubmitUserInput}
913 + onDismiss={props.onDismissUserInput}
914 />
915 ) : null}
916 </Animated.View>
apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+1
@@ -826,6 +826,7 @@ function ThreadRouteContent(
826 onSelectUserInputOption={requests.onSelectUserInputOption}
827 onChangeUserInputCustomAnswer={requests.onChangeUserInputCustomAnswer}
828 onSubmitUserInput={requests.onSubmitUserInput}
829 + onDismissUserInput={requests.onDismissUserInput}
830 />
831 </View>
832 </>
apps/mobile/src/lib/threadActivity.test.ts
+1
@@ -100,6 +100,7 @@ describe("pending user input answers", () => {
100 {
101 requestId: "interaction_1",
102 createdAt: requested.createdAt,
103 + dismissible: false,
104 questions: [nativeQuestion, singleSelectQuestion],
105 },
106 ]);
apps/mobile/src/state/use-selected-thread-requests.ts
+25
@@ -73,6 +73,10 @@ export function useSelectedThreadRequests() {
73 threadEnvironment.respondToUserInput,
74 "thread user input response",
75 );
76 + const dismissUserInput = useAtomCommand(
77 + threadEnvironment.dismissUserInput,
78 + "thread user input dismissal",
79 + );
80 const { selectedThread: selectedThreadShell } = useThreadSelection();
81 const selectedThread = useSelectedThreadDetail();
82 const userInputDraftsByRequestKey = useAtomValue(userInputDraftsByRequestKeyAtom);
@@ -170,6 +174,26 @@ export function useSelectedThreadRequests() {
174 selectedThreadShell,
175 ]);
176
177 + // Closes an async question without messaging the agent.
178 + const onDismissUserInput = useCallback(async () => {
179 + if (!selectedThreadShell || !activePendingUserInput) {
180 + return;
181 + }
182 +
183 + setRespondingUserInputId(activePendingUserInput.requestId);
184 + const result = await dismissUserInput({
185 + environmentId: selectedThreadShell.environmentId,
186 + input: {
187 + threadId: selectedThreadShell.id,
188 + requestId: activePendingUserInput.requestId,
189 + },
190 + });
191 + setRespondingUserInputId((current) =>
192 + current === activePendingUserInput.requestId ? null : current,
193 + );
194 + return result;
195 + }, [activePendingUserInput, dismissUserInput, selectedThreadShell]);
196 +
197 return {
198 activePendingApproval,
199 activePendingUserInput,
@@ -181,5 +205,6 @@ export function useSelectedThreadRequests() {
205 onSelectUserInputOption,
206 onChangeUserInputCustomAnswer,
207 onSubmitUserInput,
208 + onDismissUserInput,
209 };
210 }
apps/server/src/orchestration/Layers/OrchestrationEngine.ts
+2 -1
@@ -215,7 +215,8 @@ const makeOrchestrationEngine = Effect.gen(function* () {
215 // Command snapshots omit activities at startup and cap them while running.
216 // Read this request's durable state before deciding how to send the answer.
217 const userInputActivity =
218 - envelope.command.type === "thread.user-input.respond"
218 + envelope.command.type === "thread.user-input.respond" ||
219 + envelope.command.type === "thread.user-input.dismiss"
220 ? yield* projectionSnapshotQuery.getUserInputActivity(envelope.command)
221 : Option.none();
222 const eventBase = yield* decideOrchestrationCommand({
apps/server/src/orchestration/decider.ts
+45
@@ -1289,6 +1289,51 @@ export const decideOrchestrationCommand = Effect.fn("decideOrchestrationCommand"
1289 };
1290 }
1291
1292 + case "thread.user-input.dismiss": {
1293 + yield* requireThread({
1294 + readModel,
1295 + command,
1296 + threadId: command.threadId,
1297 + });
1298 + const request = userInputActivity;
1299 + if (request === undefined || request.kind !== "user-input.requested") {
1300 + return yield* new OrchestrationCommandInvariantError({
1301 + commandType: command.type,
1302 + detail: "This question has already been answered.",
1303 + });
1304 + }
1305 + // Only async questions can be dropped silently. A native callback
1306 + // question leaves the provider blocked until it gets a reply, so it
1307 + // still needs an answer or an interrupted turn.
1308 + if (!Predicate.isObject(request.payload) || request.payload.responseMode !== "message") {
1309 + return yield* new OrchestrationCommandInvariantError({
1310 + commandType: command.type,
1311 + detail: "This question needs an answer. Answer it or stop the turn.",
1312 + });
1313 + }
1314 + return {
1315 + ...(yield* withEventBase({
1316 + aggregateKind: "thread",
1317 + aggregateId: command.threadId,
1318 + occurredAt: command.createdAt,
1319 + commandId: command.commandId,
1320 + })),
1321 + type: "thread.activity-appended",
1322 + payload: {
1323 + threadId: command.threadId,
1324 + activity: {
1325 + id: EventId.make(`async-dismiss:${command.requestId}`),
1326 + kind: "user-input.resolved",
1327 + summary: "User input dismissed",
1328 + tone: "info",
1329 + turnId: request.turnId,
1330 + createdAt: command.createdAt,
1331 + payload: { requestId: command.requestId, responseMode: "message" },
1332 + },
1333 + },
1334 + };
1335 + }
1336 +
1337 case "thread.checkpoint.revert": {
1338 yield* requireThread({
1339 readModel,
apps/server/src/orchestration/decider.userInputDismiss.test.ts new
+142
@@ -0,0 +1,142 @@
1 +import {
2 + CommandId,
3 + EventId,
4 + ProjectId,
5 + ProviderInstanceId,
6 + ThreadId,
7 + ApprovalRequestId,
8 + type OrchestrationReadModel,
9 + type OrchestrationThreadActivity,
10 +} from "@t3tools/contracts";
11 +import * as NodeServices from "@effect/platform-node/NodeServices";
12 +import { expect, it } from "@effect/vitest";
13 +import * as Effect from "effect/Effect";
14 +
15 +import { decideOrchestrationCommand } from "./decider.ts";
16 +import { projectEvent } from "./projector.ts";
17 +
18 +const NOW = "2026-01-01T00:00:00.000Z";
19 +const threadId = ThreadId.make("thread-1");
20 +const requestId = ApprovalRequestId.make("question-1");
21 +
22 +function makeRequest(responseMode: "message" | undefined): OrchestrationThreadActivity {
23 + return {
24 + id: EventId.make(requestId),
25 + kind: "user-input.requested",
26 + summary: "Question",
27 + tone: "approval",
28 + turnId: null,
29 + createdAt: NOW,
30 + payload: {
31 + requestId,
32 + ...(responseMode === undefined ? {} : { responseMode }),
33 + questions: [{ id: "0", header: "Q", question: "Continue?", options: [] }],
34 + },
35 + };
36 +}
37 +
38 +function makeReadModel(
39 + activities: ReadonlyArray<OrchestrationThreadActivity>,
40 +): OrchestrationReadModel {
41 + return {
42 + snapshotSequence: 0,
43 + projects: [],
44 + threads: [
45 + {
46 + id: threadId,
47 + projectId: ProjectId.make("project-1"),
48 + title: "Thread",
49 + modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
50 + runtimeMode: "full-access",
51 + interactionMode: "default",
52 + branch: null,
53 + worktreePath: null,
54 + latestTurn: null,
55 + createdAt: NOW,
56 + updatedAt: NOW,
57 + archivedAt: null,
58 + settledOverride: null,
59 + settledAt: null,
60 + snoozedUntil: null,
61 + snoozedAt: null,
62 + pinnedAt: null,
63 + deletedAt: null,
64 + messages: [],
65 + proposedPlans: [],
66 + activities: [...activities],
67 + checkpoints: [],
68 + session: null,
69 + },
70 + ],
71 + updatedAt: NOW,
72 + };
73 +}
74 +
75 +const command = {
76 + type: "thread.user-input.dismiss" as const,
77 + commandId: CommandId.make("dismiss-1"),
78 + threadId,
79 + requestId,
80 + createdAt: NOW,
81 +};
82 +
83 +it.layer(NodeServices.layer)("user input dismiss decider", (it) => {
84 + it.effect("closes an async question without sending a message or starting a turn", () =>
85 + Effect.gen(function* () {
86 + const request = makeRequest("message");
87 + const readModel = makeReadModel([request]);
88 + const result = yield* decideOrchestrationCommand({
89 + command,
90 + readModel,
91 + userInputActivity: request,
92 + });
93 + const events = Array.isArray(result) ? result : [result];
94 + expect(events.map((event) => event.type)).toEqual(["thread.activity-appended"]);
95 + expect(events[0]?.payload).toMatchObject({
96 + threadId,
97 + activity: {
98 + kind: "user-input.resolved",
99 + summary: "User input dismissed",
100 + payload: { requestId, responseMode: "message" },
101 + },
102 + });
103 + const projected = yield* projectEvent(readModel, { ...events[0]!, sequence: 1 });
104 + expect(projected.threads[0]?.messages).toEqual([]);
105 + expect(projected.threads[0]?.latestTurn).toBeNull();
106 + }),
107 + );
108 +
109 + it.effect("rejects dismissing a native callback question", () =>
110 + Effect.gen(function* () {
111 + const request = makeRequest(undefined);
112 + const result = yield* decideOrchestrationCommand({
113 + command,
114 + readModel: makeReadModel([request]),
115 + userInputActivity: request,
116 + }).pipe(Effect.flip);
117 + expect(result).toMatchObject({
118 + _tag: "OrchestrationCommandInvariantError",
119 + detail: "This question needs an answer. Answer it or stop the turn.",
120 + });
121 + }),
122 + );
123 +
124 + it.effect("rejects dismissing a question that was already resolved", () =>
125 + Effect.gen(function* () {
126 + const resolved: OrchestrationThreadActivity = {
127 + ...makeRequest("message"),
128 + id: EventId.make("resolved"),
129 + kind: "user-input.resolved",
130 + };
131 + const result = yield* decideOrchestrationCommand({
132 + command,
133 + readModel: makeReadModel([makeRequest("message"), resolved]),
134 + userInputActivity: resolved,
135 + }).pipe(Effect.flip);
136 + expect(result).toMatchObject({
137 + _tag: "OrchestrationCommandInvariantError",
138 + detail: "This question has already been answered.",
139 + });
140 + }),
141 + );
142 +});
apps/web/src/components/ChatView.tsx
+30
@@ -1423,6 +1423,9 @@ export default function ChatView(props: ChatViewProps) {
1423 const respondToThreadUserInput = useAtomCommand(threadEnvironment.respondToUserInput, {
1424 reportFailure: false,
1425 });
1426 + const dismissThreadUserInput = useAtomCommand(threadEnvironment.dismissUserInput, {
1427 + reportFailure: false,
1428 + });
1429 const revertThreadCheckpoint = useAtomCommand(threadEnvironment.revertCheckpoint, {
1430 reportFailure: false,
1431 });
@@ -6960,6 +6963,32 @@ export default function ChatView(props: ChatViewProps) {
6963 [activeThreadId, environmentId, respondToThreadUserInput, setThreadError],
6964 );
6965
6966 + // Closes an async question without messaging the agent. The server records
6967 + // the dismissal so every client releases the composer.
6968 + const onDismissUserInput = useCallback(
6969 + async (requestId: ApprovalRequestId) => {
6970 + if (!activeThreadId) return;
6971 +
6972 + setRespondingUserInputRequestIds((existing) =>
6973 + existing.includes(requestId) ? existing : [...existing, requestId],
6974 + );
6975 + const result = await dismissThreadUserInput({
6976 + environmentId,
6977 + input: { threadId: activeThreadId, requestId },
6978 + });
6979 + if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
6980 + const error = squashAtomCommandFailure(result);
6981 + setThreadError(
6982 + activeThreadId,
6983 + error instanceof Error ? error.message : "Failed to dismiss the question.",
6984 + );
6985 + }
6986 + setRespondingUserInputRequestIds((existing) => existing.filter((id) => id !== requestId));
6987 + return result;
6988 + },
6989 + [activeThreadId, dismissThreadUserInput, environmentId, setThreadError],
6990 + );
6991 +
6992 const setActivePendingUserInputQuestionIndex = useCallback(
6993 (nextQuestionIndex: number) => {
6994 if (!activePendingUserInput) {
@@ -8055,6 +8084,7 @@ export default function ChatView(props: ChatViewProps) {
8084 onSelectActivePendingUserInputOption
8085 }
8086 onAdvanceActivePendingUserInput={onAdvanceActivePendingUserInput}
8087 + onDismissActivePendingUserInput={onDismissUserInput}
8088 onPreviousActivePendingUserInputQuestion={
8089 onPreviousActivePendingUserInputQuestion
8090 }
apps/web/src/components/chat/ChatComposer.tsx
+4
@@ -1284,6 +1284,7 @@ export interface ChatComposerProps {
1284 ) => Promise<unknown>;
1285 onSelectActivePendingUserInputOption: (questionId: string, optionValue: string) => void;
1286 onAdvanceActivePendingUserInput: () => void;
1287 + onDismissActivePendingUserInput: (requestId: ApprovalRequestId) => void;
1288 onPreviousActivePendingUserInputQuestion: () => void;
1289 onChangeActivePendingUserInputCustomAnswer: (
1290 questionId: string,
@@ -1384,6 +1385,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
1385 onRespondToApproval,
1386 onSelectActivePendingUserInputOption,
1387 onAdvanceActivePendingUserInput,
1388 + onDismissActivePendingUserInput,
1389 onPreviousActivePendingUserInputQuestion,
1390 onChangeActivePendingUserInputCustomAnswer,
1391 onProviderModelSelect,
@@ -4911,6 +4913,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
4913 questionIndex={activePendingQuestionIndex}
4914 onToggleOption={onSelectActivePendingUserInputOption}
4915 onAdvance={onAdvanceActivePendingUserInput}
4916 + onDismiss={onDismissActivePendingUserInput}
4917 />
4918 ) : !isComposerCollapsedMobile && showPlanFollowUpPrompt && activeProposedPlan ? (
4919 <ComposerPlanFollowUpBanner
@@ -4926,6 +4929,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
4929 questionIndex={activePendingQuestionIndex}
4930 onToggleOption={onSelectActivePendingUserInputOption}
4931 onAdvance={onAdvanceActivePendingUserInput}
4932 + onDismiss={onDismissActivePendingUserInput}
4933 />
4934 {!isChoiceOnlyPendingQuestion ||
4935 activePendingProgress?.activeQuestion?.multiSelect ? (
apps/web/src/components/chat/ComposerPendingUserInputPanel.test.tsx
+11 -2
@@ -20,17 +20,19 @@ const prompt: PendingUserInput = {
20 multiSelect: false,
21 },
22 ],
23 + dismissible: true,
24 };
25
25 -function renderPanel() {
26 +function renderPanel(pendingUserInput: PendingUserInput = prompt) {
27 return renderToStaticMarkup(
28 <ComposerPendingUserInputPanel
28 - pendingUserInputs={[prompt]}
29 + pendingUserInputs={[pendingUserInput]}
30 respondingRequestIds={[]}
31 answers={{}}
32 questionIndex={0}
33 onToggleOption={() => {}}
34 onAdvance={() => {}}
35 + onDismiss={() => {}}
36 />,
37 );
38 }
@@ -50,6 +52,13 @@ describe("ComposerPendingUserInputPanel", () => {
52 expect(markup).toMatch(new RegExp(`<div[^>]*\\sid="${controlledId}"`));
53 });
54
55 + it("offers dismiss only for async questions", () => {
56 + expect(renderPanel()).toContain("data-pending-user-input-dismiss");
57 + expect(renderPanel({ ...prompt, dismissible: false })).not.toContain(
58 + "data-pending-user-input-dismiss",
59 + );
60 + });
61 +
62 it("starts expanded so the question and its options are visible", () => {
63 const markup = renderPanel();
64
apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx
+27
@@ -17,6 +17,7 @@ interface PendingUserInputPanelProps {
17 questionIndex: number;
18 onToggleOption: (questionId: string, optionValue: string) => void;
19 onAdvance: () => void;
20 + onDismiss: (requestId: ApprovalRequestId) => void;
21 }
22
23 export const ComposerPendingUserInputPanel = memo(function ComposerPendingUserInputPanel({
@@ -26,6 +27,7 @@ export const ComposerPendingUserInputPanel = memo(function ComposerPendingUserIn
27 questionIndex,
28 onToggleOption,
29 onAdvance,
30 + onDismiss,
31 }: PendingUserInputPanelProps) {
32 if (pendingUserInputs.length === 0) return null;
33 const activePrompt = pendingUserInputs[0];
@@ -40,6 +42,7 @@ export const ComposerPendingUserInputPanel = memo(function ComposerPendingUserIn
42 questionIndex={questionIndex}
43 onToggleOption={onToggleOption}
44 onAdvance={onAdvance}
45 + onDismiss={onDismiss}
46 />
47 );
48 });
@@ -51,6 +54,7 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
54 questionIndex,
55 onToggleOption,
56 onAdvance,
57 + onDismiss,
58 }: {
59 prompt: PendingUserInput;
60 isResponding: boolean;
@@ -58,6 +62,7 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
62 questionIndex: number;
63 onToggleOption: (questionId: string, optionValue: string) => void;
64 onAdvance: () => void;
65 + onDismiss: (requestId: ApprovalRequestId) => void;
66 }) {
67 const progress = derivePendingUserInputProgress(prompt.questions, answers, questionIndex);
68 const activeQuestion = progress.activeQuestion;
@@ -198,6 +203,28 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
203 </span>
204 ) : null}
205 <ComposerBanner.ToggleIcon expanded={!isCollapsed} />
206 + {prompt.dismissible ? (
207 + // Sits inside the trigger button, so stop the click from toggling
208 + // the disclosure. Dismiss closes the question without a reply.
209 + <ComposerBanner.Dismiss
210 + render={<span role="button" tabIndex={0} />}
211 + aria-label="Dismiss question without answering"
212 + title="Dismiss question without answering"
213 + disabled={isResponding}
214 + data-pending-user-input-dismiss
215 + onClick={(event) => {
216 + event.preventDefault();
217 + event.stopPropagation();
218 + onDismiss(prompt.requestId);
219 + }}
220 + onKeyDown={(event) => {
221 + if (event.key !== "Enter" && event.key !== " ") return;
222 + event.preventDefault();
223 + event.stopPropagation();
224 + onDismiss(prompt.requestId);
225 + }}
226 + />
227 + ) : null}
228 </ComposerBanner.Actions>
229 </CollapsibleTrigger>
230 <CollapsiblePanel>
docs/user/providers-codex.md
+3 -1
@@ -54,7 +54,9 @@ contains a copied Codex setup. Use a fresh shadow directory and sign in again.
54 Codex can ask a question and keep working. Answer it in the thread's question
55 panel. The answer becomes a new message: it reaches the active turn, or starts
56 another turn if Codex has finished. Unanswered questions survive reconnects.
57 -This requires a Codex version that supports async questions.
57 +If you do not want to answer, dismiss the question from its panel. Dismissing
58 +closes it without sending anything to Codex. This requires a Codex version that
59 +supports async questions.
60
61 ## Approve app access
62
packages/client-runtime/src/operations/commands.ts
+12
@@ -50,6 +50,7 @@ export type StartThreadTurnInput = CommandInput<"thread.turn.start">;
50 export type InterruptThreadTurnInput = CommandInput<"thread.turn.interrupt">;
51 export type RespondToThreadApprovalInput = CommandInput<"thread.approval.respond">;
52 export type RespondToThreadUserInputInput = CommandInput<"thread.user-input.respond">;
53 +export type DismissThreadUserInputInput = CommandInput<"thread.user-input.dismiss">;
54 export type RevertThreadCheckpointInput = CommandInput<"thread.checkpoint.revert">;
55 export type StopThreadSessionInput = CommandInput<"thread.session.stop">;
56
@@ -320,6 +321,17 @@ export const respondToThreadUserInput: (input: RespondToThreadUserInputInput) =>
321 });
322 });
323
324 +export const dismissThreadUserInput: (input: DismissThreadUserInputInput) => CommandEffect =
325 + Effect.fn("EnvironmentCommands.dismissThreadUserInput")(function* (input) {
326 + const metadata = yield* timestampedCommandMetadata(input);
327 + return yield* dispatch({
328 + ...input,
329 + type: "thread.user-input.dismiss",
330 + commandId: metadata.commandId,
331 + createdAt: metadata.createdAt,
332 + });
333 + });
334 +
335 export const revertThreadCheckpoint: (input: RevertThreadCheckpointInput) => CommandEffect =
336 Effect.fn("EnvironmentCommands.revertThreadCheckpoint")(function* (input) {
337 const metadata = yield* timestampedCommandMetadata(input);
packages/client-runtime/src/pendingRequests.test.ts
+20 -1
@@ -282,7 +282,25 @@ describe("pending questions", () => {
282 payload: { requestId: "async-1", responseMode: "message", questions: [question] },
283 }),
284 ];
285 - expect(derivePendingRequests(activities).userInputs[0]?.questions).toEqual([question]);
285 + expect(derivePendingRequests(activities).userInputs[0]).toMatchObject({
286 + questions: [question],
287 + dismissible: true,
288 + });
289 + });
290 +
291 + it("only marks async questions as dismissible", () => {
292 + const question = {
293 + id: "0",
294 + header: "Question",
295 + question: "Continue?",
296 + options: [{ label: "Yes", description: "" }],
297 + multiSelect: false,
298 + };
299 + const native = makeActivity({
300 + kind: "user-input.requested",
301 + payload: { requestId: "native-1", questions: [question] },
302 + });
303 + expect(derivePendingRequests([native]).userInputs[0]?.dismissible).toBe(false);
304 });
305
306 it("preserves native choice values and the custom-answer restriction", () => {
@@ -378,6 +396,7 @@ describe("pending questions", () => {
396 {
397 requestId: "req-user-input-1",
398 createdAt: "2026-02-23T00:00:01.000Z",
399 + dismissible: false,
400 questions: [
401 {
402 id: "sandbox_mode",
packages/client-runtime/src/pendingRequests.ts
+8 -1
@@ -22,6 +22,8 @@ export interface PendingUserInput {
22 readonly requestId: ApprovalRequestId;
23 readonly createdAt: string;
24 readonly questions: ReadonlyArray<UserInputQuestion>;
25 + /** Async questions can be dismissed without a reply; native callbacks cannot. */
26 + readonly dismissible: boolean;
27 }
28
29 const isRequestId = Schema.is(ApprovalRequestId);
@@ -160,7 +162,12 @@ export function derivePendingRequests(activities: ReadonlyArray<OrchestrationThr
162 if (closedUserInputs.has(requestId)) continue;
163 const questions = parseQuestions(payload.questions);
164 if (questions.length === 0) continue;
163 - userInputs.set(requestId, { requestId, createdAt: activity.createdAt, questions });
165 + userInputs.set(requestId, {
166 + requestId,
167 + createdAt: activity.createdAt,
168 + questions,
169 + dismissible: payload.responseMode === "message",
170 + });
171 } else if (
172 activity.kind === "approval.resolved" ||
173 (activity.kind === "provider.approval.respond.failed" &&
packages/client-runtime/src/state/threadCommands.ts
+9
@@ -14,6 +14,7 @@ import {
14 type InterruptThreadTurnInput,
15 type RespondToThreadApprovalInput,
16 type RespondToThreadUserInputInput,
17 + type DismissThreadUserInputInput,
18 type RevertThreadCheckpointInput,
19 type SetThreadInteractionModeInput,
20 type SetThreadRuntimeModeInput,
@@ -35,6 +36,7 @@ import {
36 interruptThreadTurn,
37 respondToThreadApproval,
38 respondToThreadUserInput,
39 + dismissThreadUserInput,
40 revertThreadCheckpoint,
41 setThreadInteractionMode,
42 setThreadRuntimeMode,
@@ -60,6 +62,7 @@ export type {
62 InterruptThreadTurnInput,
63 RespondToThreadApprovalInput,
64 RespondToThreadUserInputInput,
65 + DismissThreadUserInputInput,
66 RevertThreadCheckpointInput,
67 SetThreadInteractionModeInput,
68 SetThreadRuntimeModeInput,
@@ -201,6 +204,12 @@ export function createThreadEnvironmentAtoms<R, E>(
204 scheduler,
205 concurrency,
206 }),
207 + dismissUserInput: createEnvironmentCommand(runtime, {
208 + label: "environment-data:commands:thread:dismiss-user-input",
209 + execute: (input: DismissThreadUserInputInput) => dismissThreadUserInput(input),
210 + scheduler,
211 + concurrency,
212 + }),
213 revertCheckpoint: createEnvironmentCommand(runtime, {
214 label: "environment-data:commands:thread:revert-checkpoint",
215 execute: (input: RevertThreadCheckpointInput) => revertThreadCheckpoint(input),
packages/contracts/src/orchestration.ts
+13
@@ -1033,6 +1033,17 @@ const ThreadUserInputRespondCommand = Schema.Struct({
1033 createdAt: IsoDateTime,
1034 });
1035
1036 +// Closes an async question without answering it. The agent is not messaged;
1037 +// the composer is simply released. Native callback questions cannot be dismissed
1038 +// this way because the provider is blocked waiting on a reply.
1039 +const ThreadUserInputDismissCommand = Schema.Struct({
1040 + type: Schema.Literal("thread.user-input.dismiss"),
1041 + commandId: CommandId,
1042 + threadId: ThreadId,
1043 + requestId: ApprovalRequestId,
1044 + createdAt: IsoDateTime,
1045 +});
1046 +
1047 const ThreadCheckpointRevertCommand = Schema.Struct({
1048 type: Schema.Literal("thread.checkpoint.revert"),
1049 commandId: CommandId,
@@ -1077,6 +1088,7 @@ const DispatchableClientOrchestrationCommand = Schema.Union([
1088 ThreadTurnInterruptCommand,
1089 ThreadApprovalRespondCommand,
1090 ThreadUserInputRespondCommand,
1091 + ThreadUserInputDismissCommand,
1092 ThreadCheckpointRevertCommand,
1093 ThreadSessionStopCommand,
1094 ]);
@@ -1106,6 +1118,7 @@ export const ClientOrchestrationCommand = Schema.Union([
1118 ThreadTurnInterruptCommand,
1119 ThreadApprovalRespondCommand,
1120 ThreadUserInputRespondCommand,
1121 + ThreadUserInputDismissCommand,
1122 ThreadCheckpointRevertCommand,
1123 ThreadSessionStopCommand,
1124 ]);