GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Refuse a narrowed MCP profile at turn start on a provider that cannot apply it by scuttletoby · Pull Request #679 · scuttletoby/t3code

Conversation

@scuttletoby

@scuttletoby scuttletoby commented Nov 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Owner

Fixes #672

A thread whose MCP profile is narrower than all no longer starts, resumes or compacts on Codex, or on any provider other than Claude. Those providers would give the thread every MCP server and every T3 tool.

How

  • One check, at turn start, on the machine that runs the turn. fork/mcpProfileTurnCheck.ts wraps upstream's ProviderInstanceRegistry, the registry every turn reads its adapter from. For an instance outside MCP_PROFILE_DRIVERS, startTurn, resumeTurn and compactThread first resolve the thread's profile with the same resolver Claude uses (makeThreadMcpProfiles). If the profile is not all, the call fails with a ProviderAdapterTurnStartError that wraps a ClaudeMcpProfileError, and upstream's turn-start service shows that as a refusal. Claude instances pass through unchanged.
  • The wrap keeps the session live. The instance, its adapter and each session runtime are wrapped in a delegating proxy, not copied with an object spread. Every property other than those three methods is read from the real object at each access, so a getter such as providerSession (ACP, Pi and OpenCode v2 replace it as the session changes) stays live, for every thread, profile all included. A spread of the wrapped runtime (upstream's ProviderSessionManager makes one) keeps the check.
  • Compaction is checked because some providers compact by sending a /compact prompt, which is not known to call no tools. A steer is not checked again: it joins a turn that was checked when it started.
  • Every route is covered because the check sits where the turn runs:
    • a provider switch (t3_thread_configure or the app);
    • t3_thread_launch into a narrowed project;
    • local delegation (parent profile or mcpSubagentProfile);
    • a carried narrower profile;
    • an older sender that carries nothing (the task gets this machine's profile for its role).
  • Wiring: one server.ts line, directly below upstream's orchestration layer (Layer.provideMerge(ForkLayers.mcpProfileTurnCheck)). Two things guard it:
    • the layer needs the thread store and the settings service, so a server wired without them is a type error;
    • holdWork.boot.test.ts boots the real server and checks both that the layer is built (McpProfileTurnCheck.make) and where it sits: in the boot's trace, McpProfileTurnCheck.getInstance runs inside the orchestration layer's ProviderAdapterRegistryV2.get and RuntimePolicyV2.resolve. With the line moved above layerOrchestrationApplication (it still type-checks and still emits the make span), the test fails, because those two then read upstream's registry.
  • Refusal text: it says what to change ("Switch the thread to a Claude instance, or pick "all" for this thread in Settings."). It does not say "Retry the turn". Upstream's failure message shows the error's own reason before any category guidance, so the guidance line is not shown. A test pins that the message contains neither "Retry" nor "server logs".

Remote delegation

  • A call that names a driver (target.driverKind) and no instance asks the other machine's provider list once: upstream's resolveRemoteInstance picked the instance from that list by that driver in the same call, so carryMcpProfile uses it.
  • A call that names an instance looks it up in the list as on main, also when a driver is named. Upstream passes a named instance on unchecked when the remote does not list it, so an unlisted instance is refused here before anything is launched.

Behaviour change for installs that use only all

This choice fails closed. A non-Claude turn now refuses when its profile cannot be worked out, where before it ran. That happens when a parent thread cannot be read or decoded, or when the settings read fails and the settings file cannot be read either. Each non-Claude turn also reads the settings. The README says so.

Minors from #672

  • The doc comments above isEveryMcpTool (mcpProfile.ts) and plansFor (claudeMcpProfile.test.ts) now sit directly above the code they describe.
  • README: null also reads as apply for mcpCarriedProfiles.
  • A Codex machine set to apply that gets a narrower task from an older sender: the turn check now refuses it. The README says so.

General vs project

Everything is general. Any fork user with MCP profiles and more than one provider gets the check. There are no project names or settings. The rule "only Claude applies profiles" lives in MCP_PROFILE_DRIVERS.

State question (in tests)

  • Runs again: each turn reads the settings as they are at that moment, so a profile change or a switch back to Claude counts from the next turn. getInstance and listInstances return the same wrapped object every time. The wrapper caches only the object, never a decision. A remote delegation refused for an unlisted instance is refused again on a rerun, and launches nothing either time.
  • Stopped half-way: a turn interrupted while its profile is being read never starts the provider turn, and a rerun works.
  • Old, empty or missing state:
    • a thread with no profile anywhere runs as before;
    • an older sender's task (no carried profile) gets this machine's profile;
    • a child whose parent is missing from the store refuses ("parent thread cannot be read");
    • a failed settings read: the machine's own threads get all, and a narrower carried task refuses;
    • a provider switched mid-thread refuses a turn and a compaction on the new provider, and Claude is untouched;
    • a session whose getter changes after it was opened reads the new value (first, then second).

Tests

  • The new tests fail on the old code (this PR's previous head, b39ec561ff), checked locally: 12 fail, 37 pass in mcpProfileTurnCheck.test.ts and remoteMcpProfile.test.ts:
    • 9 live-getter tests. There are 3 runtime shapes: getter and startTurn only; getter with resumeTurn and compactThread; and a class with a prototype getter. Each shape runs on 3 drivers: pi, opencode and cursor. The failure is expected 'first' to equal 'second'.
    • the switched-off-Claude test, because compaction was not checked;
    • the 2 remote tests: a listed named instance is looked up, and an unlisted named instance is refused.
  • Mutants killed:
    • With isEveryMcpTool(profile) replaced by profile.servers === "all", the new test fails: servers: "all" with fewer T3 tools is narrower than all, so it refuses.
    • With the server.ts line moved above the orchestration layer, the boot test fails (see Wiring).
  • workAdmission.startPaths.test.ts lists fork/mcpProfileTurnCheck.ts among the files allowed to mention startTurn. The reason: the wrapper calls it only inside sessions that the gated turn services open, so it stays behind the work gate. That test made Test Server 2 red on the previous head.
  • New code: 257 of 257 pass in mcpProfileTurnCheck, remoteMcpProfile, workAdmission.startPaths, holdWork.boot, claudeMcpProfile, claudeMcpProfile.adapter, mcpProfile, forkFeatures.router and RemoteDelegation. Server typecheck, lint and knip are clean.

Seam

This PR adds one server.ts line, announced in #677, which has merged. Main has been merged in. The line now sits only under added in .github/fork-seams.json, and the announced block is gone. fork-seam-check.cjs --config-ref origin/main origin/main HEAD passes.

Out of scope:

  • The review majors that apply to every provider are tracked in MCP profiles: settings parse failure widens to all; t3_thread_launch drops the launcher's profile #681.
  • t3_thread_launch does not carry the launching thread's profile. A launched thread gets its own machine's profile for its project, and on a non-Claude provider the turn check refuses that profile if it is narrower than all.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@scuttletoby @claude
Refuse a narrowed MCP profile at turn start on a provider that cannot…
b39ec56
… apply it

A thread whose MCP profile is narrower than "all" no longer starts (or
resumes) a turn on Codex or any other provider but Claude, which would
give it every MCP server and T3 tool. The check runs on the machine that
runs the turn, as it starts, by wrapping upstream's provider instance
registry (fork/mcpProfileTurnCheck.ts, one server.ts line), so every
route is covered: a provider switch, t3_thread_launch, a local
delegation and a task from an older sender.

Also: a remote delegation that names a driver asks the other machine's
provider list once; doc comments moved above the code they describe;
the README says null reads as apply for mcpCarriedProfiles.

Fixes #672

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby

scuttletoby commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

Review lens A (bypass routes): NOT SAFE as it stands. Two small fixes make it safe.

The turn check itself is sound. Every turn path gets the wrapped registry, because Layer.provideMerge lets the upper layer win and the session manager, turn and run services, switch service, importer, handoff owner and MCP server all sit above it. Claude instances pass through unchanged. These routes all refuse at turn start: a provider switch mid-thread, a resume after a restart, an instance added or renamed later (a new object, so a new wrap), and a driver id spelled differently (fails closed). Profile all behaves as before, apart from minor (b). The one server.ts line (apps/server/src/server.ts:742) is exactly the line #677 announces, and no other upstream file changes (holdWork.boot.test.ts belongs to the fork). The 4 fork test files pass locally (150/150).

Blocking

  1. A regression in remote carry, compared with main. apps/server/src/fork/remoteMcpProfile.ts:107-111 now trusts target.driverKind and skips the orchestrator_capabilities lookup. But upstream resolveRemoteInstance (apps/server/src/peer/RemoteDelegation.ts:240-250) returns a named providerInstanceId unchecked when the remote does not list it (named === undefined). Example: a delegation with driverKind: claudeAgent and an instance that is missing from the remote's snapshot or was added there later. A local probe on this PR carried a t3-only profile and launched it (1 capabilities ask, no refusal). The same probe on main fails and launches nothing. An updated remote is covered by its own turn check. A remote on the Refuse a narrower MCP profile to a non-Claude instance; one settings fallback #669 version (carry, no turn check) runs that thread on a non-Claude instance with every tool. Fix: skip the lookup only when target.providerInstanceId === undefined, because only then has upstream picked the instance from the listed providers. Add a test for a named, unlisted instance.
  2. CI: Test Server 2 is red because of this PR, not by chance. apps/server/src/workAdmission.startPaths.test.ts:137 ("only the turn services mention startTurn outside the adapters") now also finds fork/mcpProfileTurnCheck.ts. The wrapper only runs inside sessions that the gated turn services open, so it stays behind the work gate. Add it to the list with a one-line reason.

Major (both existed before this PR, both apply to every provider: please open issues, not blockers here)

  1. A settings.json that does not decode widens a thread's own profile to all. Upstream load (apps/server/src/serverSettings.ts:815-850) then falls back to defaults and getSettings succeeds. makeMcpProfileSettings (apps/server/src/fork/claudeMcpProfile.ts:376-381) sets only mcpCarriedProfiles to refuse. The thread's own project and thread profiles come from defaults, so they are all. A file that narrowed a project and then broke runs that project's threads (Codex and Claude) with every tool. A probe confirmed it. This differs from "a failed settings read must refuse". The PR's state note ("a failed settings read: own threads get all") holds only when the file is missing. Suggested fix: read the MCP profile keys from a lenient parse of the broken file, or refuse threads whose profile cannot be known.
  2. t3_thread_launch escapes the narrowing. A narrowed thread whose t3Tools include threads (e.g. a profile with servers: [] and t3Tools: "all") can launch a thread locally or on another machine. The new thread has no parent lineage and no carry, so it gets the project profile (often all) on any provider. The PR says this is out of scope, but I found no issue that tracks it.

Minor

  • (a) compactThread is not checked (apps/server/src/fork/mcpProfileTurnCheck.ts:85-93). openSession on a non-Claude instance for a narrowed thread still starts the provider session with its full MCP config; only the turn refuses. Some adapters compact by sending /compact as a prompt, which may not be tool-free. Please document why that is acceptable, or check it too.
  • (b) A behaviour change for installs that use only all (or no profiles): a non-Claude turn now refuses when a parent thread cannot be read or decoded, or when the settings read fails and settings.json cannot be read. Each non-Claude turn also reads settings.json from disk. That is fine as a fail-closed choice, but please say so in the PR notes.
  • (c) The boot-span guard (apps/server/src/holdWork.boot.test.ts:362) proves the layer is built, not where it sits. Moving the line above layerOrchestrationApplication would still type-check and still emit the span, but turns would get the raw registry. A boot test that gets the real adapter registry and asserts a Codex instance is wrapped would pin the position.
  • (d) .github/fork-seams.json will conflict with Announce the MCP profile turn check's server.ts seam line #677, since both edit the same why and the end of the list. Rebase after Announce the MCP profile turn check's server.ts seam line #677 merges.

CI (finished)

  • Red, as expected until Announce the MCP profile turn check's server.ts seam line #677 merges, from the seam check (server.ts adds the line): "No database schema changes", "Workflow lint and upstream drift", "Fork checks ran", fork-ci-result.
  • Red because of this PR: Test Server 2 (blocking 2).
  • Everything else is green.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@scuttletoby

scuttletoby commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

Review lens B (state and tests): NOT SAFE at b39ec56

There are two blockers. First, the wrapper freezes a live session getter on every non-Claude thread, including threads whose profile is all. Second, Test Server 2 is red because of this PR. The turn-start check itself is placed correctly, and its tests mostly bite: 7 of 8 mutants are killed.

Blocking

  1. apps/server/src/fork/mcpProfileTurnCheck.ts:86-93: { ...runtime, startTurn, resumeTurn } freezes the providerSession getter.

    • Several session runtimes expose providerSession as a live getter:
      • packages/provider-acp/src/server/adapter.ts:9697. The session is reassigned around line 8331, when a session is upgraded to supportsModelSwitchInSession.
      • packages/provider-pi/src/server/adapter.ts:3330. The model and extension statuses change.
      • packages/provider-opencode/src/server/v2/adapter.ts:4752. Status and lastError are reassigned around line 1125.
    • An object spread calls the getter once and copies the value. Upstream keeps the getter on purpose (orchestration-v2/ProviderSessionManager.ts:2345-2350, "Pi replaces its session snapshot as metadata changes").
    • The wrap applies to every non-Claude instance, before the profile is looked at. So every ACP, Pi or OpenCode v2 thread now sees a stale session:
      • stale capabilities, so the in-session model switch is lost (Orchestrator.ts:6349, 6473, 7607, 11453);
      • stale status, model and lastError;
      • stale snapshots written into the provider-session events (ProviderSessionManager.ts:773, 1801, 3157).
    • This contradicts the README's "A thread whose profile is all runs on any provider as before".
    • Fix: keep the property descriptors, then override the two methods:
      const wrapped = Object.defineProperties({}, Object.getOwnPropertyDescriptors(runtime)) as typeof runtime;
      wrapped.startTurn = refuseUnless(instance, runtime.startTurn); // and resumeTurn when present
      You could also add an explicit get providerSession() { return runtime.providerSession; }, the way decorateRuntime does.
    • Regression test. It fails on this head with expected 'first' to equal 'second':
      it.effect("keeps a live providerSession getter on a wrapped runtime", () =>
        Effect.gen(function* () {
          let current = { model: "first" } as any;
          const runtime = { get providerSession() { return current; }, startTurn: () => Effect.void } as any;
          // fake "pi" instance whose orchestrationAdapter.openSession returns `runtime`,
          // wrapped via ForkLayers.mcpProfileTurnCheck over ServerSettingsService.layerTest({})
          // + ProjectionStore.layer + SqlitePersistence.layerMemory
          const session = yield* openThroughWrappedRegistry(runtime);
          current = { model: "second" };
          assert.strictEqual(session.providerSession.model, "second");
        }));
  2. CI: Test Server 2 is red because of this PR, not because of Announce the MCP profile turn check's server.ts seam line #677.

    • The failing test is apps/server/src/workAdmission.startPaths.test.ts:137, "only the turn services mention startTurn outside the adapters". It fails with expected [ 'fork/mcpProfileTurnCheck.ts', …(3) ] to deeply equal [ …(3) ].
    • The wrapper only delegates to the adapter's own startTurn, which is still reached only through the gated turn services. So the fix is to add "fork/mcpProfileTurnCheck.ts" to that list, with a one-line comment saying it wraps the method and never calls it outside the gated path.

Major

  1. apps/server/src/fork/remoteMcpProfile.ts:103-111: the single-ask shortcut trusts target.driverKind even for an instance the other machine does not list.
    • Upstream's resolveRemoteInstance (apps/server/src/peer/RemoteDelegation.ts:240-249) returns a named providerInstanceId unchanged when that machine does not list it. It refuses only when the instance is listed with a different driver.
    • With this PR, { providerInstanceId: "gone", driverKind: "claudeAgent" } and a narrowed profile skips the provider list. The task is launched.
    • Before this PR, the list lookup found nothing and the delegation was refused. That is Refuse a narrower MCP profile to a non-Claude instance; one settings fallback #669's fail-closed rule "an instance it does not list … refuses it too" (docs/fork/README.md:460-461).
    • An updated receiver's turn check would still refuse the turn. A Refuse a narrower MCP profile to a non-Claude instance; one settings fallback #669-era receiver would not.
    • Fix: use target.driverKind only when target.providerInstanceId === undefined, because only then has upstream picked the instance from the list. Otherwise ask, as before.
    • Regression test for remoteMcpProfile.test.ts. It fails on this head and passes on main's remoteMcpProfile.ts:
      it.effect("refuses an unlisted instance named with a Claude driver, before any launch", () =>
        Effect.scoped(Effect.gen(function* () {
          const harness = yield* makeHarness(T3_ONLY, "carries", CLAUDE_THERE, "gone", "claudeAgent");
          const exit = yield* Effect.exit(harness.delegate);
          assert.isTrue(Exit.isFailure(exit));
          assert.include(JSON.stringify(exit), "capability_denied");
          assert.deepStrictEqual(harness.launched, []);
        })));
    • On the brief's caching question: nothing is cached across calls. Each delegation asks again, or uses the request's own driverKind. A failed ask still refuses. So a stale or failed provider list is never reused. The only gap is the unlisted-instance case above.

Minor

  1. Surviving mutant: mcpProfileTurnCheck.ts:43-51. Replacing isEveryMcpTool(profile) with profile.servers === "all" leaves all 13 tests green. Please add a test with servers all and narrowed t3Tools. That profile parses, and Claude narrows it (claudeMcpProfile.ts:84), so another provider must refuse it.
  2. The placement guard is weaker than claimed (PR body and forkLayers.ts doc). holdWork.boot.test.ts:365-370 boots the real CLI and reads the McpProfileTurnCheck.make span, so it catches removal of the line at server.ts:742. Moving the line above Layer.provideMerge(layerOrchestrationApplication) would still type-check and still emit the span, while the orchestration layer would get the unwrapped registry. Either soften the claim, or add a check that the registry the orchestration layer resolves is the wrapped one.
  3. Misleading guidance on refusal. The refusal becomes a ProviderAdapterTurnStartError, so the user sees upstream's text "Retry the turn; if it keeps failing, check the provider setup…" (packages/provider-core/src/server/failure.ts:52). Retrying will always fail. The reason text says what to do; consider a guidance that does not suggest retrying.
  4. Docs: docs/fork/README.md:460-461 should match the outcome of item 3. The "runs on any provider as before" line holds only once item 1 is fixed. The FORK_CHANGES row matches the code.

State question

  • Runs again or reconnect: the check reruns on every startTurn and resumeTurn. The WeakMap only caches the wrapper object, never a decision, so a profile change is seen on the next turn.
  • Stopped half-way between profile write and turn start: the profile is read when the turn starts, so there is no window.
  • Missing parent, no profile anywhere: these give all and pass. With a parent narrower than all, the narrowed-by-parent reason is shown; a mutant without it is killed.
  • Old database or settings: a resolver error refuses the turn; a mutant that treats the error as all is killed. A failed settings read on an own thread still gives all. That is documented and comes from Refuse a narrower MCP profile to a non-Claude instance; one settings fallback #669.
  • Provider switched mid-thread: the switch opens a session through the wrapped registry, so the next turn is checked on the new provider.
  • Not checked: steering and compaction. A steer continues a turn that was checked when it started, and compaction calls no tools, so this is acceptable.
  • Placement: server.ts:742 sits right below layerOrchestrationApplication. With provideMerge, the consumer side wins the merge, so the orchestration layer, the MCP HTTP server, ws, ProviderSwitchService and AgentSessionImporter all get the wrapped registry.

Tests and mutants

  • The PR's 5 files, 152 tests, all pass at the head.

  • Each mutant was run against mcpProfileTurnCheck.test.ts:

    Mutant Result
    Pass-through wrap 10 tests fail
    No resumeTurn wrap 1 fails
    No WeakMap cache 1 fails
    Claude wrapped too 2 fail
    listInstances unwrapped 1 fails
    Narrowed-by-parent reason dropped 2 fail
    Resolver error treated as all 2 fail
    servers === "all" only survives (item 4)
  • On main's remoteMcpProfile.ts, the 2 new single-ask tests fail, as claimed.

  • I did not run the boot test with the server.ts line removed.

CI at b39ec56

  • Seam check, red as expected until Announce the MCP profile turn check's server.ts seam line #677 merges: "Workflow lint and upstream drift" and "No database schema changes" (both run the seam script). Both fail only on the unannounced server.ts line, and "Fork checks ran" / fork-ci-result are red as a result.
  • Test Server 2: red because of this PR (item 2).
  • Green: Lint, Build and Typecheck, Web, Rust, and Test Server 1 and 3-8.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@scuttletoby scuttletoby mentioned this pull request Nov 20, 2026
MCP profiles: settings parse failure widens to all; t3_thread_launch drops the launcher's profile #681
Closed
scuttletoby and others added 3 commits November 20, 2026 20:28
@scuttletoby @claude
MCP profile turn check: keep sessions live, look up named remote inst…
ff611f0
…ances

- Wrap each non-Claude instance, adapter and session runtime in a
  delegating proxy instead of an object spread, so getters such as
  providerSession stay live for every thread, profile all included.
- Check compactThread as well as startTurn and resumeTurn: some
  providers compact by sending a /compact prompt.
- Remote carry asks the remote for its instance list unless no instance
  is named; a named instance the remote does not list is refused again.
- Allow fork/mcpProfileTurnCheck.ts in the startTurn path test.
- Boot test pins the layer's position: the orchestration layer's
  adapter registry and runtime policy read instances through the check.
- Tests: live getters for each runtime shape and driver, servers=all
  with fewer T3 tools refuses, refusal text names no retry, unlisted
  named remote instance refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby @claude
Merge origin/main into fix/672-mcp-profile-turn-start
4ba3f07
The server.ts seam line stays only under "added": the "announced"
block from #677 is dropped now that this PR adds the line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby
Merge branch 'main' into fix/672-mcp-profile-turn-start
28503db
@scuttletoby
scuttletoby merged commit 07e0f23 into main Nov 20, 2026
40 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@scuttletoby scuttletoby mentioned this pull request Nov 21, 2026
Fork cannot follow upstream #792
Closed
scuttletoby added a commit that referenced this pull request Nov 21, 2026
@scuttletoby @claude
Refuse a narrowed MCP profile at turn start on a provider that cannot…
44cd19f
… apply it (#679)

* Refuse a narrowed MCP profile at turn start on a provider that cannot apply it

A thread whose MCP profile is narrower than "all" no longer starts (or
resumes) a turn on Codex or any other provider but Claude, which would
give it every MCP server and T3 tool. The check runs on the machine that
runs the turn, as it starts, by wrapping upstream's provider instance
registry (fork/mcpProfileTurnCheck.ts, one server.ts line), so every
route is covered: a provider switch, t3_thread_launch, a local
delegation and a task from an older sender.

Also: a remote delegation that names a driver asks the other machine's
provider list once; doc comments moved above the code they describe;
the README says null reads as apply for mcpCarriedProfiles.

Fixes #672

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile turn check: keep sessions live, look up named remote instances

- Wrap each non-Claude instance, adapter and session runtime in a
  delegating proxy instead of an object spread, so getters such as
  providerSession stay live for every thread, profile all included.
- Check compactThread as well as startTurn and resumeTurn: some
  providers compact by sending a /compact prompt.
- Remote carry asks the remote for its instance list unless no instance
  is named; a named instance the remote does not list is refused again.
- Allow fork/mcpProfileTurnCheck.ts in the startTurn path test.
- Boot test pins the layer's position: the orchestration layer's
  adapter registry and runtime policy read instances through the check.
- Tests: live getters for each runtime shape and driver, servers=all
  with fewer T3 tools refuses, refusal text names no retry, unlisted
  named remote instance refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
@scuttletoby @claude
Refuse a narrowed MCP profile at turn start on a provider that cannot…
08c258c
… apply it (#679)

* Refuse a narrowed MCP profile at turn start on a provider that cannot apply it

A thread whose MCP profile is narrower than "all" no longer starts (or
resumes) a turn on Codex or any other provider but Claude, which would
give it every MCP server and T3 tool. The check runs on the machine that
runs the turn, as it starts, by wrapping upstream's provider instance
registry (fork/mcpProfileTurnCheck.ts, one server.ts line), so every
route is covered: a provider switch, t3_thread_launch, a local
delegation and a task from an older sender.

Also: a remote delegation that names a driver asks the other machine's
provider list once; doc comments moved above the code they describe;
the README says null reads as apply for mcpCarriedProfiles.

Fixes #672

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile turn check: keep sessions live, look up named remote instances

- Wrap each non-Claude instance, adapter and session runtime in a
  delegating proxy instead of an object spread, so getters such as
  providerSession stay live for every thread, profile all included.
- Check compactThread as well as startTurn and resumeTurn: some
  providers compact by sending a /compact prompt.
- Remote carry asks the remote for its instance list unless no instance
  is named; a named instance the remote does not list is refused again.
- Allow fork/mcpProfileTurnCheck.ts in the startTurn path test.
- Boot test pins the layer's position: the orchestration layer's
  adapter registry and runtime policy read instances through the check.
- Tests: live getters for each runtime shape and driver, servers=all
  with fewer T3 tools refuses, refusal text names no retry, unlisted
  named remote instance refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
@scuttletoby @claude
Refuse a narrowed MCP profile at turn start on a provider that cannot…
401556e
… apply it (#679)

* Refuse a narrowed MCP profile at turn start on a provider that cannot apply it

A thread whose MCP profile is narrower than "all" no longer starts (or
resumes) a turn on Codex or any other provider but Claude, which would
give it every MCP server and T3 tool. The check runs on the machine that
runs the turn, as it starts, by wrapping upstream's provider instance
registry (fork/mcpProfileTurnCheck.ts, one server.ts line), so every
route is covered: a provider switch, t3_thread_launch, a local
delegation and a task from an older sender.

Also: a remote delegation that names a driver asks the other machine's
provider list once; doc comments moved above the code they describe;
the README says null reads as apply for mcpCarriedProfiles.

Fixes #672

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile turn check: keep sessions live, look up named remote instances

- Wrap each non-Claude instance, adapter and session runtime in a
  delegating proxy instead of an object spread, so getters such as
  providerSession stay live for every thread, profile all included.
- Check compactThread as well as startTurn and resumeTurn: some
  providers compact by sending a /compact prompt.
- Remote carry asks the remote for its instance list unless no instance
  is named; a named instance the remote does not list is refused again.
- Allow fork/mcpProfileTurnCheck.ts in the startTurn path test.
- Boot test pins the layer's position: the orchestration layer's
  adapter registry and runtime policy read instances through the check.
- Tests: live getters for each runtime shape and driver, servers=all
  with fewer T3 tools refuses, refusal text names no retry, unlisted
  named remote instance refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Nov 22, 2026
MCP profiles: finish the feature (Settings pick, T3 tool groups, Codex, optional narrowing) #875
Open
Owner question: move the main agent machine to fork build 0.1.12 so its newer features can go on? #895
Closed
Follow upstream: rebase onto v0.1.14-nightly.20261127.5345 (draft) #1138
Merged
scuttletoby added a commit that referenced this pull request Nov 28, 2026
@scuttletoby @claude @noreply
Refuse a narrowed MCP profile at turn start on a provider that cannot…
31ef189
… apply it (#679)

* Refuse a narrowed MCP profile at turn start on a provider that cannot apply it

A thread whose MCP profile is narrower than "all" no longer starts (or
resumes) a turn on Codex or any other provider but Claude, which would
give it every MCP server and T3 tool. The check runs on the machine that
runs the turn, as it starts, by wrapping upstream's provider instance
registry (fork/mcpProfileTurnCheck.ts, one server.ts line), so every
route is covered: a provider switch, t3_thread_launch, a local
delegation and a task from an older sender.

Also: a remote delegation that names a driver asks the other machine's
provider list once; doc comments moved above the code they describe;
the README says null reads as apply for mcpCarriedProfiles.

Fixes #672

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* MCP profile turn check: keep sessions live, look up named remote instances

- Wrap each non-Claude instance, adapter and session runtime in a
  delegating proxy instead of an object spread, so getters such as
  providerSession stay live for every thread, profile all included.
- Check compactThread as well as startTurn and resumeTurn: some
  providers compact by sending a /compact prompt.
- Remote carry asks the remote for its instance list unless no instance
  is named; a named instance the remote does not list is refused again.
- Allow fork/mcpProfileTurnCheck.ts in the startTurn path test.
- Boot test pins the layer's position: the orchestration layer's
  adapter registry and runtime policy read instances through the check.
- Tests: live getters for each runtime shape and driver, servers=all
  with fewer T3 tools refuses, refusal text names no retry, unlisted
  named remote instance refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
scuttletoby pushed a commit that referenced this pull request Nov 28, 2026
@noreply @claude
fork: fixes for upstream v0.1.14-nightly.20261127.5345
8f68caf
Fork code and tests that upstream's changes since v0.1.12-nightly.20261121.5051 broke, found
by the type check and lint after the rebase:

- server.ts: upstream's runtime layer chain grew to 20 steps, Effect's pipe limit; with the
  fork's two (the handoff compaction skip and the MCP profile turn check) it took 22 and typed
  as never. Each fork step now shares a step with the upstream line it sits on (a flow, and the
  check's own pipe, as the check did before #679): same layers, same order, 20 steps.
- ClaudeAdapterV2.ts: upstream's openQueryRuntime now yields { program, querySession }, so the
  MCP profile check taps the query session, not the whole result.
- WaitPrJudge.ts: upstream's pull request target adds PullRequestRepositoryInvalidError (a
  repository written with its host); a wait naming one is refused with upstream's message. Test.
- forkMarkdownFileLinkActions.ts: the untranslated-copy exception has no fork message left
  (the fork's download moved to upstream's).
- Fork tests: upstream's launch path reads ProviderRegistry (agent mode picks), its routes need
  FeedbackStore, LayoutCommandApprovalWrites, WorkflowDefinitions, Workflows and FeatureFlags,
  its runtime layer ProjectSetupScriptRunner, its startup BackgroundPolicy, its thread launch
  layer the projection store and file system, its searchable tools an input schema, and its
  spawn resolver may answer with a promise. The fork's test layers provide these as upstream's
  own tests do.
- editor.test.ts: a link without isFile is a folder link, which upstream now opens in a new
  window (?windowId=_blank); the fork's path tests expect that.
- remoteReplyRead.test.ts: upstream's reply scan starts after position 0, not -1 (pingdotgg#42717); the
  older-peer fixture serves its first page there.
- vp fmt on the files the rebase's conflict resolutions touched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Narrowed MCP profile: refuse at turn start on providers that cannot apply it (#669 follow-ups)

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@scuttletoby
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.