Skip to content

Commit 30a7240

Browse files
mdeluraclaude
andcommitted
feat(server): GitHub Copilot can generate thread titles and other text
With Copilot as the only provider, no text generation model could be selected, so thread titles, commit messages, branch names and PR text could not be generated. Copilot instances of the ACP Registry driver now run a one-off helper session with no tools and a throwaway COPILOT_HOME, so helper sessions stay out of the user's Copilot history and their MCP servers and hooks stay out of the helper. The server accepts a Copilot selection but never falls back to one automatically, because each request spends the user's plan. Settings shows "Choose a model" until a selection is in effect. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 37481f0 commit 30a7240

11 files changed

Lines changed: 653 additions & 16 deletions

File tree

‎apps/server/src/serverSettings.test.ts‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,35 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("server settings"
488488
}).pipe(Effect.provide(layerServerSettings())),
489489
);
490490

491+
it.effect("keeps a Copilot text generation selection but replaces other ACP agents", () =>
492+
Effect.gen(function* () {
493+
const serverSettings = yield* ServerSettingsModule.ServerSettingsService;
494+
const driver = ProviderDriverKind.make("acpRegistry");
495+
const copilot = ProviderInstanceId.make("acpRegistry_copilot");
496+
const local = ProviderInstanceId.make("acpRegistry_local");
497+
const kilo = ProviderInstanceId.make("acpRegistry_kilo");
498+
yield* serverSettings.updateSettings({
499+
providerInstances: {
500+
[copilot]: { driver, config: { agentId: "github-copilot-cli" } },
501+
[local]: { driver, config: { source: "local", commandPath: "/usr/bin/copilot" } },
502+
[kilo]: { driver, config: { agentId: "kilo" } },
503+
},
504+
});
505+
506+
for (const instanceId of [copilot, local]) {
507+
const selection = { instanceId, model: "claude-haiku-4.5" };
508+
const next = yield* serverSettings.updateSettings({
509+
textGenerationModelSelection: selection,
510+
});
511+
assert.deepEqual(next.textGenerationModelSelection, selection);
512+
}
513+
const replaced = yield* serverSettings.updateSettings({
514+
textGenerationModelSelection: { instanceId: kilo, model: "kilo-model" },
515+
});
516+
assert.notEqual(replaced.textGenerationModelSelection.instanceId, kilo);
517+
}).pipe(Effect.provide(layerServerSettings())),
518+
);
519+
491520
it.effect("refuses to save over a settings file it cannot parse", () =>
492521
Effect.gen(function* () {
493522
const config = yield* ServerConfig.ServerConfig;

‎apps/server/src/serverSettings.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ import {
2222
type SecretReference,
2323
withIdleCompaction,
2424
} from "@t3tools/contracts";
25+
import {
26+
AcpRegistrySettings,
27+
isCopilotAcpRegistrySettings,
28+
} from "@t3tools/provider-acp-registry/settings";
2529
import * as Cache from "effect/Cache";
2630
import * as Cause from "effect/Cause";
2731
import * as Context from "effect/Context";
@@ -496,11 +500,17 @@ function migrateLegacyProviderSettings(
496500

497501
const ACP_REGISTRY_DRIVER = ProviderDriverKind.make("acpRegistry");
498502

503+
const decodeAcpRegistrySettings = Schema.decodeUnknownOption(AcpRegistrySettings);
504+
499505
function selectionSupportsTextGeneration(
500506
settings: ServerSettings,
501507
selection: ModelSelection,
502508
): boolean {
503-
return settings.providerInstances[selection.instanceId]?.driver !== ACP_REGISTRY_DRIVER;
509+
const instance = settings.providerInstances[selection.instanceId];
510+
return (
511+
instance?.driver !== ACP_REGISTRY_DRIVER ||
512+
Option.exists(decodeAcpRegistrySettings(instance.config ?? {}), isCopilotAcpRegistrySettings)
513+
);
504514
}
505515

506516
type DriverAllowed = (driver: ProviderDriverKind) => boolean;

‎apps/web/src/components/settings/SettingsPanels.tsx‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,6 +1536,14 @@ export function ThreadsSettingsPanel() {
15361536
const textGenInstanceEntry = textGenerationModelInstanceEntries.find(
15371537
(entry) => entry.instanceId === textGenInstanceId,
15381538
);
1539+
// The picker previews the first usable provider, but the server only falls back automatically
1540+
// to built-in providers. Until the user picks an ACP agent, its preview would not be in effect.
1541+
const textGenerationSelectionInEffect = textGenerationModelInstanceEntries.some(
1542+
(entry) =>
1543+
entry.instanceId === settings.textGenerationModelSelection?.instanceId &&
1544+
entry.enabled &&
1545+
entry.isAvailable,
1546+
);
15391547
const textGenProvider: ProviderDriverKind =
15401548
textGenInstanceEntry?.driverKind ?? DEFAULT_DRIVER_KIND;
15411549
const textGenerationModelOptionsByInstance = getCustomModelOptionsByInstance(
@@ -1795,7 +1803,11 @@ export function ThreadsSettingsPanel() {
17951803
instanceEntries={textGenerationModelInstanceEntries}
17961804
modelOptionsByInstance={textGenerationModelOptionsByInstance}
17971805
triggerClassName={SETTINGS_PICKER_TRIGGER_CLASSNAME}
1798-
{...(mixedTextGenerationModel ? { triggerLabel: "Mixed" } : {})}
1806+
{...(mixedTextGenerationModel
1807+
? { triggerLabel: "Mixed" }
1808+
: textGenerationSelectionInEffect
1809+
? {}
1810+
: { triggerLabel: "Choose a model" })}
17991811
getModelDisabledReason={textGenerationModelDisabledReason}
18001812
{...(environmentId
18011813
? {

‎docs/internals/providers.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ run before the prompt. They reject profiles with such configuration before launc
7878
instructions and tool denial do not create a native sandbox.
7979
See [helper constraints](../../apps/server/src/textGeneration/AntigravityTextGeneration.ts).
8080

81+
Copilot helpers run with a throwaway `COPILOT_HOME` instead, because ACP has no session delete for
82+
Copilot and helper sessions would otherwise fill the user's history. That also excludes user-level
83+
MCP servers and hooks without having to reject those profiles. Only Copilot is text-generation
84+
capable among Registry agents: isolating a helper depends on each agent's own flags, and the server
85+
never falls back to it automatically because every request spends the user's plan.
86+
8187
## Provider updates run only through the owning installer
8288

8389
A package manager runs only when the resolved executable's path proves it owns the install. Homebrew

‎docs/user/providers-acp.md‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,16 @@ Checkpoint rollback restores your files as usual. ACP agents cannot rewind their
132132
so the next turn after a rollback starts a fresh agent session that no longer remembers the
133133
conversation from before the checkpoint.
134134

135-
Registry instances are not used for T3's app-owned text generation, such as thread titles, commit
136-
messages, branch names, or pull request descriptions. Configure a text-generation-capable provider
137-
for those actions.
135+
## Text generation
136+
137+
GitHub Copilot can write T3's thread titles, commit messages, branch names, and pull request
138+
descriptions. To use it, choose a Copilot model under **Settings → Threads → Text generation**. T3
139+
Code never switches to Copilot on its own, because each request counts against your Copilot plan, so
140+
consider a low-cost model. These requests run with no tools and without your Copilot MCP servers,
141+
hooks, or custom instructions, and they do not appear in your Copilot session history.
142+
143+
Other Registry agents are not used for text generation. Configure another provider for those
144+
actions.
138145

139146
## Advanced configuration
140147

‎packages/provider-acp-registry/src/server/adapter.ts‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
} from "./copilotAcp.ts";
1818
import { defaultInstanceIdForDriver, ProviderDriverKind } from "@t3tools/contracts";
1919
import { readCustomModelEntries } from "@t3tools/shared/model";
20-
import { AcpRegistrySettings } from "../settings.ts";
20+
import { AcpRegistrySettings, isCopilotAcpRegistrySettings } from "../settings.ts";
2121
import * as HostProcess from "@t3tools/shared/HostProcess";
2222
import { resolveSelfInvocation, type SelfInvocation } from "@t3tools/shared/nodeRuntime";
2323
import * as SecureRandom from "effect/crypto/SecureRandom";
@@ -187,11 +187,7 @@ export const makeAcpRegistryAdapterV2 = Effect.fn("makeAcpRegistryAdapterV2")(fu
187187
const startupKey =
188188
options.settings.source === "local" ? `local:${options.instanceId}` : registryAgentId;
189189
const isDevin = registryAgentId === "devin";
190-
// Local installs launch the `copilot` binary directly with no registry id.
191-
const isCopilot =
192-
registryAgentId === "github-copilot-cli" ||
193-
(options.settings.source === "local" &&
194-
/^copilot(\.exe|\.cmd)?$/i.test(options.settings.commandPath.split(/[\\/]/).pop() ?? ""));
190+
const isCopilot = isCopilotAcpRegistrySettings(options.settings);
195191
const isClaude =
196192
registryAgentId === "claude-acp" ||
197193
(options.settings.source === "local" &&

0 commit comments

Comments
 (0)