Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions .github/fork-seams.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,10 @@
},
"apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts": {
"why": "MCP profiles part 5: each Codex thread gets its profile's outside MCP servers switched off in its own per-thread config (mcp_servers.<name>.enabled = false for every server Codex's config/read lists for the thread's folder that the profile leaves out, launch-argument servers included; T3's own entries stay), and a turn is refused, saying why and the fix, when the thread's live servers (mcpServerStatus/list) still include one outside its profile. The adapter's app-server client factory is wrapped by apps/server/src/fork/codexMcpProfile.ts; the overrides travel per request, so other threads on the shared app-server keep their own sets. Additions only; tested in apps/server/src/fork/codexMcpProfile.test.ts.",
"added": [],
"announced": {
"since": "2026-11-21",
"added": [
"import * as CodexMcpProfile from \"../../fork/codexMcpProfile.ts\"; // Fork: MCP profiles",
"...(yield* CodexMcpProfile.profiledClientFactory(clientFactory)), // Fork: MCP profiles"
]
}
"added": [
"import * as CodexMcpProfile from \"../../fork/codexMcpProfile.ts\"; // Fork: MCP profiles",
"...(yield* CodexMcpProfile.profiledClientFactory(clientFactory)), // Fork: MCP profiles"
]
},
"apps/server/src/orchestration-v2/ProviderTurnStartService.ts": {
"why": "MCP profiles part 2: a Claude turn its MCP profile refuses never reached Claude, like the other refusals in this list.",
Expand Down
2 changes: 1 addition & 1 deletion FORK_CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ setting is missing here or a setting named here does not exist.
| A local, read-only "is T3 busy?" answer: `GET /api/fork/activity` on loopback, and `t3 __fork-report --base-dir <home> --activity`, which asks it and exits 0 only when nothing is working. | A host quiet check reads T3's own turns and approvals instead of guessing from processes. | `server.activityProbe` | off | [#547](https://github.com/scuttletoby/t3code/pull/547) |
| `t3 serve --hold-work` starts a server on a copy of a T3 home with all agent work and T3 Connect held. | Look at a new build's threads and migrations on a copy before it replaces a running T3. | none | only with the flag | [#175](https://github.com/scuttletoby/t3code/pull/175) |
| Docs: one machine for new work through upstream's load-balancing weights; settings saved with an early draft's client setting for it still load. | Upstream already has the feature, so the fork's own setting was removed. | none | - | [#25](https://github.com/scuttletoby/t3code/pull/25) |
| MCP profiles: named profiles (which outside MCP servers and T3 tool groups a thread gets), a default, a sub-agent rule, a pick per thread and the rules that pick one. Claude applies the outside servers and refuses a turn when its profile cannot. A task delegated to another machine carries its parent's profile, and a narrower one goes only to a Claude instance on a machine that applies it (one can refuse such tasks). Only Claude applies profiles: a turn on any other provider whose profile is narrower than `all` is refused as it starts. Settings → Fork lists, adds, edits and deletes profiles, sets the default and the sub-agent rule (also per project) and each thread's pick. | Fewer tools per thread saves tokens and keeps agents from tools they should not use. | `server.mcpProfiles`, `server.mcpProfile`, `server.mcpSubagentProfile`, `server.mcpThreadProfiles`, `server.mcpCarriedProfiles`, `projectOverride.mcpProfile`, `projectOverride.mcpSubagentProfile` | off | [#227](https://github.com/scuttletoby/t3code/pull/227), [#528](https://github.com/scuttletoby/t3code/pull/528), [#640](https://github.com/scuttletoby/t3code/issues/640), [#672](https://github.com/scuttletoby/t3code/issues/672) |
| MCP profiles: named profiles (which outside MCP servers and T3 tool groups a thread gets), a default, a sub-agent rule, a pick per thread and the rules that pick one. Claude and Codex apply the outside servers (Codex per thread on its shared app-server, as `mcp_servers.<name>.enabled = false`) and refuse a turn when its profile cannot. A task delegated to another machine carries its parent's profile, and a narrower one goes only to a Claude instance on a machine that applies it (one can refuse such tasks). Only Claude and Codex apply profiles: a turn on any other provider whose profile is narrower than `all` is refused as it starts. Settings → Fork lists, adds, edits and deletes profiles, sets the default and the sub-agent rule (also per project) and each thread's pick. | Fewer tools per thread saves tokens and keeps agents from tools they should not use. | `server.mcpProfiles`, `server.mcpProfile`, `server.mcpSubagentProfile`, `server.mcpThreadProfiles`, `server.mcpCarriedProfiles`, `projectOverride.mcpProfile`, `projectOverride.mcpSubagentProfile` | off | [#227](https://github.com/scuttletoby/t3code/pull/227), [#528](https://github.com/scuttletoby/t3code/pull/528), [#640](https://github.com/scuttletoby/t3code/issues/640), [#672](https://github.com/scuttletoby/t3code/issues/672) |
| Playtest mode, part 1: settings for a project's playtest adapter (claim, renew, push and release steps only the person sets) and the contract those steps follow. Nothing starts a session yet. | A person tries an agent's unfinished work on a test target, round after round, no PR per round. | `server.playtest`, `projectOverride.playtest` | off | [#260](https://github.com/scuttletoby/t3code/pull/260) |
| Playtest mode, part 2: the session store and service: start (claim), rounds of push steps, end (release), kept across restarts. A session keeps the steps it started with. No tool calls it yet. | A person tries an agent's unfinished work on a test target, round after round, no PR per round. | `server.playtest`, `projectOverride.playtest` | off | [#261](https://github.com/scuttletoby/t3code/pull/261) |
| Playtest mode, part 3: the worker renews claims, ends idle, too-long and gone-thread sessions, finishes what a restart cut, and tells the thread once when T3 ended a session. | A person tries an agent's unfinished work on a test target, round after round, no PR per round. | `server.playtest`, `projectOverride.playtest` | off | [#262](https://github.com/scuttletoby/t3code/pull/262) |
Expand Down
47 changes: 39 additions & 8 deletions apps/server/src/fork/claudeMcpProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
MCP_CARRIED_PROFILES_REFUSE,
MCP_PROFILE_ALL,
type OrchestrationV2AppThread,
ProjectId,
type ServerSettings,
type ThreadId,
isDelegatedAppThread,
Expand Down Expand Up @@ -530,13 +531,8 @@ export const makeMcpProfileSettings = Effect.gen(function* () {

type McpOverrides = { readonly mcpServers?: Readonly<Record<string, unknown>> | undefined };

/**
* One settings read, or a refusal, then threads' resolved profiles (or refusals) from it: two
* threads compared against one file. Settings as {@link makeMcpProfileSettings} reads them; without
* the settings service (tests), the default settings' (`all`, cut to a profile another machine
* carried).
*/
export const makeThreadMcpProfileReads = Effect.gen(function* () {
/** {@link makeThreadMcpProfileReads}, and the store's thread reads it uses. */
const makeLineageReads = Effect.gen(function* () {
const settingsService = yield* Effect.serviceOption(ServerSettingsService.ServerSettingsService);
const sql = yield* Effect.serviceOption(SqlClient.SqlClient);
// The adapter built alone (upstream's adapter tests): default settings and no store, so nothing
Expand All @@ -562,12 +558,21 @@ export const makeThreadMcpProfileReads = Effect.gen(function* () {
? undefined
: () => Effect.succeed(null);
const readSettings = yield* makeMcpProfileSettings;
return Effect.map(
const reads = Effect.map(
readSettings,
(settings) => (thread: LineageThread) => mcpProfileForThread(settings, thread, findThread),
);
return { reads, findThread };
});

/**
* One settings read, or a refusal, then threads' resolved profiles (or refusals) from it: two
* threads compared against one file. Settings as {@link makeMcpProfileSettings} reads them; without
* the settings service (tests), the default settings' (`all`, cut to a profile another machine
* carried).
*/
export const makeThreadMcpProfileReads = Effect.map(makeLineageReads, ({ reads }) => reads);

/**
* A thread's resolved profile, or a refusal, from the settings {@link makeMcpProfileSettings}
* reads on each call; see {@link makeThreadMcpProfileReads}.
Expand All @@ -579,6 +584,32 @@ export const makeThreadMcpProfiles = Effect.gen(function* () {
});
});

/**
* A thread's resolved profile, or a refusal, found by its id alone (a Codex thread request carries
* only the id). A thread the store cannot give refuses, as an unreadable parent does. With no store
* and no settings service (upstream's adapter tests) it is read as a root thread: `all`.
*/
export const makeThreadMcpProfilesById = Effect.gen(function* () {
const { reads, findThread } = yield* makeLineageReads;
return Effect.fn("ClaudeMcpProfile.profileForId")(function* (threadId: ThreadId) {
const read = yield* reads;
if (findThread === undefined) {
return yield* read({
id: threadId,
projectId: ProjectId.make("unknown-project"),
lineage: { parentThreadId: null, relationshipToParent: null, rootThreadId: threadId },
} as LineageThread);
}
const thread = yield* findThread(threadId);
if (thread === null) {
return yield* new ClaudeMcpProfileError({
reason: `T3 cannot read this thread from its store, so its MCP profile cannot be worked out and it cannot start: retry, or ${FIX}.`,
});
}
return yield* read(thread);
});
});

/** The thread's Claude plan, or a refusal, from {@link makeThreadMcpProfiles}. */
export const makeClaudeMcpProfiles = Effect.gen(function* () {
const profileFor = yield* makeThreadMcpProfiles;
Expand Down
Loading
Loading