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 21, 11:00 UTC
fix(server): dismissing a background OpenCode subagent's question lets it carry on (#37319)
Julius Marminge committed
Nov 15, 2026 at 10:51 UTC
af8faa9cfa98956a788a312d94ae46654db4e922
3 files changed
+24
apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts
+20
@@ -4035,6 +4035,26 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
4035
}),
4036
);
4037
4038
+ // A cancel without a message aborts the asking session's step, so the child would never report.
4039
+ it.effect.each(["cancel", "decline"] as const)(
4040
+ "lets a background child carry on when its question is dismissed with %s",
4041
+ (decision) =>
4042
+ Effect.gen(function* () {
4043
+ const form = { ...colorForm, sessionID: CHILD };
4044
+ const { runtime, thread } = yield* resumed([
4045
+ ...launchedAndRunning,
4046
+ event("form.created", { form }),
4047
+ event("session.execution.succeeded", { sessionID: SESSION }),
4048
+ out("session.form.cancel", { sessionID: CHILD, formID: form.id, message: "<string>" }),
4049
+ reply("session.form.cancel", null),
4050
+ ]);
4051
+ const requested = yield* requestOf(runtime).pipe(Effect.forkScoped);
4052
+ yield* runtime.startTurn(withLineage(thread));
4053
+ const request = yield* Fiber.join(requested);
4054
+ yield* runtime.respondToRuntimeRequest({ requestId: request!.id, decision });
4055
+ }),
4056
+ );
4057
+
4058
it.effect("keeps a background child's requests when its parent stops during reconciliation", () =>
4059
Effect.gen(function* () {
4060
const reading = yield* Deferred.make<void>();
apps/server/src/orchestration-v2/Adapters/OpenCodeAdapterV2.testkit.ts
+1
@@ -89,6 +89,7 @@ export type OpenCodeOrchestratorReplayHarnessError =
89
90
function replayValueMatches(expected: unknown, actual: unknown): boolean {
91
if (expected === "<any>" || expected === "<workspace>") return true;
92
+ if (expected === "<string>") return typeof actual === "string" && actual.length > 0;
93
if (Array.isArray(expected)) {
94
return (
95
Array.isArray(actual) &&
packages/provider-opencode/src/server/v2/adapter.ts
+3
@@ -467,6 +467,7 @@ const sameRules = (left: ReadonlyArray<Rule> | undefined, right: ReadonlyArray<R
467
468
// Rejection without a message stops the whole execution, meaning Cancel.
469
const DECLINED = "The user declined this request.";
470
+const DISMISSED = "The user dismissed this question. Continue without an answer.";
471
472
// Steer before decline; otherwise the model sees only Unable to execute command and retries.
473
const declinedNote = (action: string, resources: ReadonlyArray<string>) =>
@@ -5192,6 +5193,8 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr
5193
? client.session.form.cancel({
5194
sessionID: entry.sessionId,
5195
formID: Form.ID.make(native.id),
5196
+ // Without a message OpenCode aborts the step, and a background subagent never reports.
5197
+ ...(asker.subagent === undefined ? {} : { message: DISMISSED }),
5198
})
5199
: client.session.form.reply({
5200
sessionID: entry.sessionId,