@devries-cameron20 / t3code Mirror · read-only / commits / 505f6d6cf4
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 accepts t3_background_wait for its own background commands (#39421)

Julius Marminge committed Nov 19, 2026 at 15:36 UTC 505f6d6cf4fcd61aeafc2f32f8bc7adfd8713f5f
2 files changed +42
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts
+19
@@ -1462,6 +1462,25 @@ describe("AntigravityAdapterV2 work after the prompt ends", () => {
1462 }).pipe(Effect.provide(layerSession)),
1463 );
1464
1465 + // agy names its background commands `<session>/task-<n>`; the agent passes that to
1466 + // t3_background_wait, which must not fail since the adapter already holds the run open.
1467 + it.effect("accepts t3_background_wait for a command it already tracks", () =>
1468 + Effect.gen(function* () {
1469 + const { session, providerThread, startTurn, throughPromptSettled } =
1470 + yield* openSessionWithRunningCommand({ WaitMsBeforeAsync: 10000 });
1471 + yield* startTurn(1, false);
1472 + yield* throughPromptSettled;
1473 + const taskIds = ["mock-session-1/task-2"];
1474 + assert.isDefined(session.awaitBackgroundTasks, "t3_background_wait must not be unsupported");
1475 + const result = yield* session.awaitBackgroundTasks!({
1476 + providerThread,
1477 + taskIds,
1478 + awaited: true,
1479 + });
1480 + assert.deepEqual(result.matched, taskIds);
1481 + }).pipe(Effect.provide(layerSession)),
1482 + );
1483 +
1484 // agy 1.5.11 reads a prompt sent mid-turn as a steer: it answers the running prompt end_turn
1485 // and goes on under the new one. session/cancel would end its running commands and subagents.
1486 it.effect("steers a running prompt with the next one and leaves its work running", () =>
packages/provider-acp/src/server/adapter.ts
+23
@@ -9972,6 +9972,29 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
9972 ),
9973 ),
9974 ),
9975 + // The held turn already waits on these commands; their tool calls carry no task id,
9976 + // so any id matches while one runs on this thread.
9977 + ...(flavor.toolOutlivesPrompt === undefined
9978 + ? {}
9979 + : {
9980 + awaitBackgroundTasks: Effect.fn("AcpAdapterV2.awaitBackgroundTasks")(function* ({
9981 + providerThread,
9982 + taskIds,
9983 + }) {
9984 + const outlives = flavor.toolOutlivesPrompt;
9985 + const context = yield* Ref.get(activeTurn);
9986 + const holdsCommand =
9987 + outlives !== undefined &&
9988 + defersFinalizeForBackgroundWork &&
9989 + context !== null &&
9990 + !context.finalized &&
9991 + context.nativeThreadId === providerThread.nativeThreadRef?.nativeId &&
9992 + [...context.tools.values()].some(
9993 + (tool) => toolStatus(tool.status) === "running" && outlives(tool),
9994 + );
9995 + return { matched: holdsCommand ? [...new Set(taskIds)] : [] };
9996 + }),
9997 + }),
9998 interruptTurn: Effect.fn("AcpAdapterV2.interruptTurn")(
9999 function* (turnInput: ProviderAdapter.ProviderAdapterV2InterruptInput) {
10000 return yield* Effect.uninterruptibleMask((restore) =>