GeezerVison is showing github.com — fix(acp-registry): Factory Droid's saved autonomy level no longer overrides a Supervised thread by factory-ain3sh · Pull Request #38306 · pingdotgg/t3code
fix(acp-registry): Factory Droid's saved autonomy level no longer overrides a Supervised thread
#38306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement . We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0dba09c
fix(acp-registry): Factory Droid asks before acting unless the thread…
factory-ain3sh Nov 17, 2026
28c59e5
fix(acp-registry): Droid's policy level is one its session advertises
factory-ain3sh Nov 17, 2026
60b897b
Merge main into fix/droid-autonomy-follows-runtime-mode
factory-ain3sh Nov 19, 2026
11f5f8c
Merge main into fix/droid-autonomy-follows-runtime-mode
factory-ain3sh Nov 19, 2026
0f98c52
fix(provider-acp): reconfigure when approval or sandbox policy changes
factory-ain3sh Nov 19, 2026
1503c39
Merge main into fix/droid-autonomy-follows-runtime-mode
factory-ain3sh Nov 21, 2026
7483cf5
test(acp-registry): use main's local Droid settings in the autonomy case
factory-ain3sh Nov 21, 2026
12f9ac6
Merge main into fix/droid-autonomy-follows-runtime-mode
factory-ain3sh Nov 22, 2026
c3ffa23
Merge main into fix/droid-autonomy-follows-runtime-mode
factory-ain3sh Nov 22, 2026
ad663e9
fix(acp-registry): Droid's saved autonomy level no longer overrides a…
factory-ain3sh Nov 24, 2026
80bc571
Merge main into fix/droid-autonomy-follows-runtime-mode
factory-ain3sh Nov 26, 2026
File filter
Filter by extension
.ts
(4)
All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Hide whitespace
Diff view
Hide whitespace
fix(acp-registry): Factory Droid asks before acting unless the thread…
… has Full access
Droid's ACP session modes are its autonomy levels, and a new session can
start at auto-high, which runs every action without asking. T3 never set
them, so an Approval required thread still ran Droid at auto-high, and the
composer's Autonomy Level choice could raise it further.
Droid now follows the thread's runtime policy on every session configure:
auto-high only under unrestricted Full access, normal (asks before each
change, so T3's policy answers) otherwise. The mode is locked to the policy,
so neither the Autonomy Level option nor the Plan-exit restore can override
it. Local `droid` installs get the same flavor as the registry agent.
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Loading branch information
Uh oh!
There was an error while loading. Please reload this page.
commit 0dba09cf98124a46714f5f5a6e8d841958ab2ac3
There are no files selected for viewing
Original file line number
Diff line number
Diff line change
Expand Up
@@ -23,6 +23,9 @@ const copilotModesProfile = process.env.T3_ACP_COPILOT_MODES === "1";
const copilotModeId = (name: string) =>
`https://agentclientprotocol.com/protocol/session-modes#${name}`;
const modeOptionCategory = process.env.T3_ACP_MODE_OPTION_CATEGORY ?? "mode";
// Factory Droid's modes are autonomy levels behind an `autonomy_level` option, starting at auto-high.
const droidModesProfile = process.env.T3_ACP_DROID_MODES === "1";
const modeConfigId = droidModesProfile ? "autonomy_level" : "mode";
// Comma-separated command names the mock advertises, so `/compact` support is testable.
const advertisedCommandNames = (process.env.T3_ACP_AVAILABLE_COMMANDS ?? "")
.split(",")
Expand Down
Expand Up
@@ -115,7 +118,9 @@ let currentModeId = antigravityProfile
? (process.env.T3_ACP_INITIAL_MODE ?? "default")
: copilotModesProfile
? copilotModeId("agent")
: "ask";
: droidModesProfile
? "auto-high"
: "ask";
let currentModelId = antigravityProfile ? "gemini-test-low" : "default";
let parameterizedModelPicker = false;
let currentReasoning = "medium";
Expand Down
Expand Up
@@ -303,7 +308,7 @@ function configOptions(): ReadonlyArray<AcpSchema.SessionConfigOption> {
]
: []),
{
configId: "mode" ,
configId: modeConfigId ,
name: "Mode",
category: modeOptionCategory,
type: "select" as const,
Expand Down
Expand Up
@@ -376,23 +381,31 @@ const availableModes: ReadonlyArray<AcpCompat.SessionMode> = antigravityProfile
{ id: copilotModeId("plan"), name: "Plan" },
{ id: copilotModeId("autopilot"), name: "Autopilot" },
]
: [
{
id: "ask",
name: "Ask",
description: "Request permission before making any changes",
},
{
id: "architect",
name: "Architect",
description: "Design and plan software systems without implementation",
},
{
id: "code",
name: "Code",
description: "Write and modify code with full tool access",
},
];
: droidModesProfile
? [
{ id: "normal", name: "Auto (Off)" },
{ id: "spec", name: "Spec" },
{ id: "auto-low", name: "Auto (Low)" },
{ id: "auto-medium", name: "Auto (Medium)" },
{ id: "auto-high", name: "Auto (High)" },
]
: [
{
id: "ask",
name: "Ask",
description: "Request permission before making any changes",
},
{
id: "architect",
name: "Architect",
description: "Design and plan software systems without implementation",
},
{
id: "code",
name: "Code",
description: "Write and modify code with full tool access",
},
];
function modeState(): AcpCompat.SessionModeState {
return {
Expand Down
Expand Up
@@ -827,7 +840,7 @@ const program = Effect.gen(function* () {
yield* agent.handleSetSessionConfigOption((request) =>
Effect.gen(function* () {
if (failSetModeConfigOption && request.configId === "mode" ) {
if (failSetModeConfigOption && request.configId === modeConfigId ) {
return yield* AcpError.AcpRequestError.invalidParams(
"Mock invalid params for session/set_config_option",
{
Expand All
@@ -836,7 +849,7 @@ const program = Effect.gen(function* () {
},
);
}
if (request.configId === "mode" && typeof request.value === "string") {
if (request.configId === modeConfigId && typeof request.value === "string") {
currentModeId = request.value;
}
if (request.configId === "model" && typeof request.value === "string") {
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -2249,6 +2249,103 @@ describe("AcpAdapterV2", () => {
}).pipe(Effect.provide(layerTest));
});
it.live("keeps Factory Droid's autonomy level on the thread's runtime mode", () =>
Effect.gen(function* () {
const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
const instanceId = ProviderInstanceId.make("droid-autonomy-test");
const threadId = ThreadId.make("thread-droid-autonomy");
const adapter = yield* makeAcpRegistryAdapterV2({
instanceId,
selfInvocation: yield* resolveSelfInvocation(),
settings: DROID_SETTINGS,
environment: {},
makeRuntime: makeMockRuntime({
childProcessSpawner: yield* ChildProcessSpawner.ChildProcessSpawner,
mockAgentPath: yield* bundledMockAgentPath,
protocolEvents,
environment: { T3_ACP_DROID_MODES: "1" },
}),
}).pipe(
Effect.provide(
Layer.mock(AcpRegistryCatalog)({ resolve: () => Effect.die("runtime is injected") }),
),
);
const policy = (
runtimeMode: "approval-required" | "full-access",
interactionMode: "default" | "plan" = "default",
) =>
ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({
runtimeMode,
interactionMode,
cwd: process.cwd(),
});
const modelSelection: ModelSelection = {
instanceId,
model: "default",
options: [{ id: "autonomy_level", value: "auto-high" }],
};
const runtime = yield* adapter.openSession({
threadId,
providerSessionId: ProviderSessionId.make("provider-session-droid-autonomy"),
modelSelection,
runtimePolicy: policy("approval-required"),
});
const providerThread = yield* runtime.ensureThread({
threadId,
modelSelection,
runtimePolicy: policy("approval-required"),
});
const now = yield* DateTime.now;
const autonomyWritesForTurn = Effect.fnUntraced(function* (
ordinal: number,
runtimePolicy: ProviderAdapter.ProviderAdapterV2RuntimePolicy,
) {
yield* runtime.startTurn(
makeTurnInput({
threadId,
providerThread,
instanceId,
runtimePolicy,
now,
ordinal,
messageText: `Request ${ordinal}.`,
modelSelection,
}),
);
yield* runtime.events.pipe(
Stream.takeUntil((event) => event.type === "turn.terminal"),
Stream.runDrain,
);
const writes: Array<unknown> = [];
while (true) {
const event = yield* Queue.take(protocolEvents);
if (event.direction !== "outgoing") continue;
const method = rawProtocolMethod(event);
if (method === "session/prompt") return writes;
if (
method === "session/set_config_option" &&
rawProtocolRequestParam(event, "configId") === "autonomy_level"
) {
writes.push(rawProtocolRequestParam(event, "value"));
}
}
});
assert.deepEqual(
yield* autonomyWritesForTurn(0, policy("approval-required")),
["normal"],
"Droid starts at auto-high and the Autonomy Level choice must not outrank the policy",
);
assert.deepEqual(yield* autonomyWritesForTurn(1, policy("full-access")), ["auto-high"]);
assert.deepEqual(yield* autonomyWritesForTurn(2, policy("full-access", "plan")), []);
assert.deepEqual(
yield* autonomyWritesForTurn(3, policy("approval-required")),
["normal"],
"Leaving Plan must not restore the autonomy level an earlier policy set",
);
}).pipe(Effect.provide(layerTest)),
);
it.live.each(["failed", "recovered", "cancelled"] as const)(
"projects Mistral retry notices and their %s outcome",
(outcome) =>
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -9,7 +9,7 @@ import {
extractDevinSubagentUpdate,
devinAnswerablePermissionOptions,
} from "./devinAcp.ts";
import { extractDroidElicitationForm } from "./droidAcp.ts";
import { droidAcpFlavor } from "./droidAcp.ts";
import { makeKimiPromptOutcomeWatch } from "./kimiAcp.ts";
import { extractOmpElicitationForm } from "./ompAcp.ts";
import { extractOpenCodeElicitationForm } from "./opencodeAcp.ts";
Expand Down
Expand Up
@@ -192,6 +192,10 @@ export const makeAcpRegistryAdapterV2 = Effect.fn("makeAcpRegistryAdapterV2")(fu
const startupKey =
options.settings.source === "local" ? `local:${options.instanceId}` : registryAgentId;
const isDevin = registryAgentId === "devin";
const isDroid =
registryAgentId === "factory-droid" ||
(options.settings.source === "local" &&
/^droid(\.exe|\.cmd)?$/i.test(options.settings.commandPath.split(/[\\/]/).pop() ?? ""));
const isOmp =
options.settings.source === "local" &&
/^omp(\.exe|\.cmd)?$/i.test(options.settings.commandPath.split(/[\\/]/).pop() ?? "");
Expand Down
Expand Up
@@ -248,8 +252,8 @@ export const makeAcpRegistryAdapterV2 = Effect.fn("makeAcpRegistryAdapterV2")(fu
customModels: readCustomModelEntries(options.settings.customModels).map((entry) => entry.slug),
compactViaAdvertisedCommand: true,
promptFailure: (cause) => acpRegistryPromptFailure(registryAgentId, cause),
...(registryAgentId === "factory-droid"
? { extractElicitationForm: extractDroidElicitationForm }
...(isDroid
? droidAcpFlavor
: isOmp
? { extractElicitationForm: extractOmpElicitationForm }
: isOpenCode
Expand Down
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
import { type OrchestrationV2UserInputQuestion, TrimmedNonEmptyString } from "@t3tools/contracts";
import type { AcpAdapterV2Flavor } from "@t3tools/provider-acp/server/adapter";
import type * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
import * as Predicate from "effect/Predicate";
import * as Schema from "effect/Schema";
Expand All
@@ -26,9 +27,9 @@ const isDroidCompanion = Schema.is(Schema.Struct({ type: Schema.Literal("string"
// Droid pairs each choice with an optional *_other field. The client already
// offers custom answers, so hide the companion and restore it in the response.
export const extractDroidElicitationForm: NonNullable<
AcpAdapterV2Flavor["extractElicitationForm"]
> = (request ) => {
const extractDroidElicitationForm: NonNullable<AcpAdapterV2Flavor["extractElicitationForm"]> = (
request,
) => {
if (request.mode !== "form" || !isDroidForm(request.requestedSchema)) return undefined;
const { properties, required } = request.requestedSchema;
const questions: Array<OrchestrationV2UserInputQuestion> = [];
Expand Down
Expand Up
@@ -82,3 +83,24 @@ export const extractDroidElicitationForm: NonNullable<
},
};
};
// Droid's session modes are its autonomy levels, and a new session can start at
// `auto-high`, which runs every action without asking. `normal` asks before each
// change, so T3's runtime policy answers; only unrestricted full access skips asking.
function droidSessionModeForPolicy(
policy: ProviderAdapter.ProviderAdapterV2RuntimePolicy,
): "auto-high" | "normal" {
return policy.runtimeMode === "full-access" &&
policy.approvalPolicy === undefined &&
policy.sandboxPolicy === undefined
? "auto-high"
: "normal";
}
export const droidAcpFlavor = {
extractElicitationForm: extractDroidElicitationForm,
// The composer's Autonomy Level choice would outrank the thread's runtime mode.
ownedModelOptionIds: ["autonomy_level"],
lockSessionModeToPolicy: true,
sessionModeForPolicy: droidSessionModeForPolicy,
} satisfies Partial<AcpAdapterV2Flavor>;
Loading
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.