@devries-cameron20 / t3code Mirror · read-only / commits / 6de770c1e6
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, 21:00 UTC

fix(server): ACP retries a config option whose write failed for a reason other than refusal (#34782)

Julius Marminge committed Nov 11, 2026 at 22:41 UTC 6de770c1e61b17f139634af7dd3dee77c2a0c039
2 files changed +64 -6
apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.test.ts
+57 -1
@@ -476,6 +476,8 @@ describe("AcpRegistryAdapterV2", () => {
476 readonly storedModePick?: string;
477 readonly turnModels?: ReadonlyArray<string>;
478 readonly rejectedModel?: string;
479 + readonly storedOptions?: ReadonlyArray<{ readonly id: string; readonly value: string }>;
480 + readonly failsConfiguration?: boolean;
481 }) {
482 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
483 // Scope release gives the replay agent at most a second to exit, so the status
@@ -563,6 +565,7 @@ describe("AcpRegistryAdapterV2", () => {
565 ...(input.storedModePick === undefined
566 ? {}
567 : { options: [{ id: ACP_SESSION_MODE_OPTION_ID, value: input.storedModePick }] }),
568 + ...(input.storedOptions === undefined ? {} : { options: input.storedOptions }),
569 };
570 const configurations: Array<AcpRegistryLiveConfiguration | undefined> = [];
571 yield* Effect.gen(function* () {
@@ -616,13 +619,17 @@ describe("AcpRegistryAdapterV2", () => {
619 }).pipe(
620 Effect.match({
621 onFailure: (error) => {
622 + if (input.failsConfiguration === true) return;
623 assert.isDefined(input.rejectedModel);
624 assert.equal(
625 makeProviderFailure({ cause: error }).message,
626 `The agent did not accept the model "${input.rejectedModel}". Choose another model for this provider, then retry.`,
627 );
628 },
625 - onSuccess: () => assert.isUndefined(input.rejectedModel),
629 + onSuccess: () => {
630 + assert.isUndefined(input.rejectedModel);
631 + assert.notEqual(input.failsConfiguration, true, "configuration should have failed");
632 + },
633 }),
634 Effect.scoped,
635 );
@@ -903,6 +910,55 @@ describe("AcpRegistryAdapterV2", () => {
910 );
911 }).pipe(Effect.provide(layerTest), Effect.scoped),
912 );
913 + it.effect(
914 + "fails configuration when an option write errors for a reason other than refusal",
915 + () => {
916 + const sessionModel = (currentValue: string) => ({
917 + ...modelOption("model", currentValue),
918 + options: ["default", "named"].map((value) => ({ value, name: value })),
919 + });
920 + const thinking = {
921 + id: "thinking",
922 + name: "Thinking",
923 + category: "thought_level",
924 + type: "select",
925 + currentValue: "low",
926 + options: ["low", "high"].map((value) => ({ value, name: value })),
927 + };
928 + return openWithStoredPicks({
929 + setup: { configOptions: [sessionModel("default")] },
930 + storedModel: "named",
931 + storedOptions: [
932 + { id: "thinking", value: "high" },
933 + { id: "unavailable", value: "x" },
934 + ],
935 + failsConfiguration: true,
936 + pickFrames: [
937 + outbound("session/set_config_option", {
938 + sessionId: "agent-session",
939 + configId: "model",
940 + value: "named",
941 + }),
942 + answer("session/set_config_option", {
943 + configOptions: [sessionModel("named"), thinking],
944 + }),
945 + outbound("session/set_config_option", {
946 + sessionId: "agent-session",
947 + configId: "thinking",
948 + value: "high",
949 + }),
950 + {
951 + type: "emit_inbound",
952 + frame: {
953 + kind: "response",
954 + method: "session/set_config_option",
955 + error: { code: -32603, message: "Internal error" },
956 + },
957 + },
958 + ],
959 + }).pipe(Effect.provide(layerTest), Effect.scoped);
960 + },
961 + );
962 const modelOptions = [
963 { id: "fast", name: "Fast", category: "model", type: "boolean", currentValue: false },
964 {
packages/provider-acp/src/server/adapter.ts
+7 -5
@@ -7391,11 +7391,13 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
7391 yield* runtime.setConfigOption(selection.id, selection.value).pipe(
7392 Effect.catchTags({
7393 AcpRequestError: (error) =>
7394 - Effect.logWarning("ACP session rejected a configuration option value", {
7395 - optionId: selection.id,
7396 - value: selection.value,
7397 - detail: error.message,
7398 - }),
7394 + error.code === -32602
7395 + ? Effect.logWarning("ACP session rejected a configuration option value", {
7396 + optionId: selection.id,
7397 + value: selection.value,
7398 + detail: error.message,
7399 + })
7400 + : Effect.fail(error),
7401 }),
7402 );
7403 }