@devries-cameron20 / t3code Mirror · read-only / commits / e24f0c7154
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 21, 04:45 UTC

fix(server): Antigravity wake runs accept steers again (#39767)

Julius Marminge committed Nov 20, 2026 at 07:31 UTC e24f0c7154cc625a401545b3e49cc5776802c210
2 files changed +72 -12
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts
+67
@@ -1414,6 +1414,73 @@ describe("AntigravityAdapterV2 work after the prompt ends", () => {
1414 }).pipe(Effect.provide(layerSession)),
1415 );
1416
1417 + // A wake run has no prompt of its own, yet agy can keep working in it for minutes.
1418 + it.effect("steers a continuation run that keeps working after its wake", () =>
1419 + Effect.gen(function* () {
1420 + const opened = yield* openSessionWithRunningCommand(
1421 + { IsDaemon: true, WaitMsBeforeAsync: 500 },
1422 + undefined,
1423 + { agentVersion: "1.5.11", holdsFirstPrompt: false },
1424 + );
1425 + const { session, providerThread, command, offers, send, startTurn, until, throughTerminal } =
1426 + opened;
1427 + yield* startTurn(1, false);
1428 + yield* throughTerminal;
1429 + yield* send({
1430 + sessionUpdate: "tool_call_update",
1431 + ...command,
1432 + status: "completed",
1433 + rawOutput: { output: "Command exited with code 0.", exit_code: 0 },
1434 + });
1435 + assert.lengthOf(offers, 1, "the finished daemon must wake the thread");
1436 + yield* offers[0]!.dispatchIfCurrent!(Effect.void);
1437 + yield* startTurn(2, true);
1438 + const followUp = { toolCallId: "call_build", kind: "execute", title: "vp run build" };
1439 + yield* send({ sessionUpdate: "tool_call", ...followUp, status: "in_progress" });
1440 + const continued = yield* until(
1441 + (event) =>
1442 + event.type === "turn_item.updated" &&
1443 + event.turnItem.nativeItemRef?.nativeId === followUp.toolCallId,
1444 + );
1445 + const providerTurnId = continued.flatMap((event) =>
1446 + event.type === "provider_turn.updated" ? [event.providerTurn.id] : [],
1447 + )[0]!;
1448 +
1449 + const steer = yield* session
1450 + .steerTurn({
1451 + threadId: ThreadId.make("thread-antigravity-wake"),
1452 + runId: RunId.make("run-antigravity-wake-2"),
1453 + providerThread,
1454 + providerTurnId,
1455 + message: {
1456 + messageId: MessageId.make("message-antigravity-steer"),
1457 + text: "Skip the build",
1458 + attachments: [],
1459 + createdBy: "user",
1460 + creationSource: "web",
1461 + },
1462 + })
1463 + .pipe(Effect.exit);
1464 + assert.isTrue(
1465 + Exit.isSuccess(steer),
1466 + `a working wake run must accept a steer: ${String(Exit.isFailure(steer) && steer.cause)}`,
1467 + );
1468 + assert.equal(opened.cancels(), 0, "a steer must not cancel the agent's work");
1469 + assert.lengthOf(opened.prompts, 2);
1470 + assert.deepEqual(opened.prompts[1]!.prompt, [{ type: "text", text: "Skip the build" }]);
1471 +
1472 + yield* send({ sessionUpdate: "tool_call_update", ...followUp, status: "completed" });
1473 + yield* TestClock.adjust("16 minutes");
1474 + const silent = yield* until((event) => event.type === "turn.terminal");
1475 + const terminal = silent.at(-1);
1476 + assert.equal(
1477 + terminal?.type === "turn.terminal" && terminal.status,
1478 + "failed",
1479 + "a silent steer prompt must still hit the inactivity timeout",
1480 + );
1481 + }).pipe(Effect.provide(layerSession)),
1482 + );
1483 +
1484 it.effect("steers a run held open by a detached subagent without stopping it", () =>
1485 Effect.gen(function* () {
1486 const fileSystem = yield* FileSystem.FileSystem;
packages/provider-acp/src/server/adapter.ts
+5 -12
@@ -9539,7 +9539,7 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
9539 text,
9540 turnInput.message.attachments,
9541 );
9542 - const dispatched = yield* runtimeTransitionPermit.withPermit(
9542 + const [dispatched, context] = yield* runtimeTransitionPermit.withPermit(
9543 Effect.gen(function* () {
9544 const context = yield* Ref.get(activeTurn);
9545 if (
@@ -9553,14 +9553,6 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
9553 detail: `Provider turn ${turnInput.providerTurnId} is not active and cannot be steered.`,
9554 });
9555 }
9556 - // A wake turn has no prompt of its own to steer; its reply ends the run soon.
9557 - if (context.promptSequence === 0) {
9558 - return yield* new ProviderAdapter.ProviderAdapterSteerDeclinedError({
9559 - driver,
9560 - providerThreadId: turnInput.providerThread.id,
9561 - providerTurnId: turnInput.providerTurnId,
9562 - });
9563 - }
9556 const generation = yield* Ref.get(runtimeCallbackGeneration);
9557 const checkPromptOutcome =
9558 flavor.watchPromptOutcome === undefined
@@ -9624,10 +9616,12 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
9616 detail: `Provider turn ${turnInput.providerTurnId} ended before it could be steered.`,
9617 });
9618 }
9627 - return dispatched;
9619 + return [dispatched, context] as const;
9620 }),
9621 );
9622 yield* Deferred.await(dispatched);
9623 + // A wake run sent no prompt, so its inactivity watchdog waits for this one.
9624 + yield* Deferred.succeed(context.promptDispatched, undefined);
9625 });
9626
9627 yield* Effect.addFinalizer(() =>
@@ -9967,8 +9961,7 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
9961 (effect, turnInput) =>
9962 effect.pipe(
9963 Effect.mapError((cause) =>
9970 - cause._tag === "ProviderAdapterSteerRunUnsupportedError" ||
9971 - cause._tag === "ProviderAdapterSteerDeclinedError"
9964 + cause._tag === "ProviderAdapterSteerRunUnsupportedError"
9965 ? cause
9966 : new ProviderAdapter.ProviderAdapterSteerRunError({
9967 driver,