feat(antigravity): queue follow-up turns sequentially instead of cancelling active prompt #11628
Closedwillblanchard(GitHub profile, opens in a new tab)wants to merge 2 commits into
main fromrefs/pull/11628/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- @@ -1030 +1031,20 @@1030- const launch = yield* context.promptLock.withPermit(1031+ const requestedModel = input.modelSelection?.model ?? context.session.model;1032+ const configOptions = yield* context.runtime.getConfigOptions;1033+ const model = resolveAntigravityModel({1034+ configOptions,1035+ model: requestedModel,1036+ defaultModel: yield* options.defaultModel ?? Effect.succeed(undefined),1037+ });1038+ const availableModels = antigravityModelOptions(configOptions);1039+ if (model && !availableModels.some((option) => option.value === model)) {1040+ return yield* mapAntigravityError(1041+ input.threadId,1042+ "session/prompt",1043+ EffectAcpErrors.AcpRequestError.invalidParams(1044+ `Antigravity model '${model}' is unavailable for this Google account. Select an available model.`,1045+ ),1046+ );1047+ }1048+1049+ return yield* context.turnQueue1050+ .withPermit(@@ -1026,5 +1028,9 @@10261028 });10271029 }).pipe(Effect.uninterruptible);102810301029- return yield* Effect.gen(function* () {1030- const launch = yield* context.promptLock.withPermit(1031+ const requestedModel = input.modelSelection?.model ?? context.session.model;1032+ const configOptions = yield* context.runtime.getConfigOptions;1033+ const model = resolveAntigravityModel({1034+ configOptions,1035+ model: requestedModel,1036+ defaultModel: yield* options.defaultModel ?? Effect.succeed(undefined),
- apps/server/src/provider/Layers/AntigravityAdapter.test.ts lines 617 to 618Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -609,15 +609,10 @@609609 const second = yield* h.adapter610610 .sendTurn({611611 threadId,612- input: "Steer the turn",612+ input: "Follow-up prompt",613613 modelSelection: { instanceId, model: nativeAlternative },614614 })615615 .pipe(Effect.forkChild);616- expect(yield* h.nextCancellation).toBe(1);617- expect(h.calls.slice(marker)).toEqual(["cancel:1"]);618- yield* h.emitNative({619- _tag: "ContentDelta",620- text: "The first prompt stopped.",621- rawPayload: {},622- });623- yield* Deferred.succeed(h.cancelRelease, undefined);616+617+ expect(h.hasActivePrompt()).toBe(true);618+ expect(h.calls.slice(marker)).toEqual([]);apps/server/src/provider/Layers/AntigravityAdapter.ts lines 1031 to 1049OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -1029,2 +1031,19 @@1029- return yield* Effect.gen(function* () {1030- const launch = yield* context.promptLock.withPermit(1031+ const requestedModel = input.modelSelection?.model ?? context.session.model;1032+ const configOptions = yield* context.runtime.getConfigOptions;1033+ const model = resolveAntigravityModel({1034+ configOptions,1035+ model: requestedModel,1036+ defaultModel: yield* options.defaultModel ?? Effect.succeed(undefined),1037+ });1038+ const availableModels = antigravityModelOptions(configOptions);1039+ if (model && !availableModels.some((option) => option.value === model)) {1040+ return yield* mapAntigravityError(1041+ input.threadId,1042+ "session/prompt",1043+ EffectAcpErrors.AcpRequestError.invalidParams(1044+ `Antigravity model '${model}' is unavailable for this Google account. Select an available model.`,1045+ ),1046+ );1047+ }1048+1049+ return yield* context.turnQueue
- @@ -1149,14 +1159,8 @@1149- context.promptLock.withPermit(1150- Effect.gen(function* () {1151- const turn = intent;1152- if (!turn || turn.settled || context.stopped || context.generation !== turn.generation)1153- return;1154- const promptFiber = context.promptFiber;1155- yield* cancelRequests(context);1156- yield* Effect.ignore(context.runtime.cancel);1157- if (promptFiber) yield* Fiber.interrupt(promptFiber);1158- yield* finishTurn(turn, { state: "cancelled", stopReason: "cancelled" });1159- }),1159+ Effect.mapError((cause) =>1160+ isAcpError(cause) ? mapAntigravityError(input.threadId, "session/prompt", cause) : cause,11601161 ),1161- ),1162- );1162+ Effect.tapError((cause) =>1163+ Effect.suspend(() =>1164+ intent1165+ ? context.promptLock.withPermit(1166+ finishTurn(intent, { state: "failed", errorMessage: cause.message }),
juliusmarminge closed this
Sign in to join this conversation.
Codex Review Summary#
This comment shows the latest Codex review activity on this pull request.
a3ab5e5ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.