GeezerVison is showing github.com — MCP profile carry: per-machine refuse, Claude-only docs, no-store rule (#640) by scuttletoby · Pull Request #648 · scuttletoby/t3code
Conversation
Fixes #640
Follow-ups from #611. Each point, fixed or why not:
1. Per-machine opt-out: fixed. New setting mcpCarriedProfiles: apply (default) or refuse.
- With
refuse, GET /api/fork/features answers mcpProfileCarry: false. The delegating machine then refuses a narrower-profile task before it sends anything. The message says that machine is set not to take such tasks.
- A task that still arrives with a narrower (or unreadable) carried profile is refused at its turn, and so are its sub-agents. This covers a task sent before the setting changed, and the race between the features ask and the launch.
- A carried
all, nothing carried (an older sender), or the owner's pick for the task here run as before.
- The issue's wording was "ignores carried profiles". A value that ignores the carried profile would let a narrow thread get more tools just by delegating, so this is a refuse, not an ignore: neither value gives a task more than it would get.
- A bad value reads as
apply. The setting is person-only, which is automatic for fork settings and checked in personOnlySettings.test.ts.
2. Codex: docs, not enforcement. docs/fork/README.md now says plainly that only Claude threads apply profiles. Codex or any other provider gets every MCP server and T3 tool, on its own machine and as a carried task. The carry's refusal only limits a task that runs on Claude there. Enforcing profiles on Codex is a feature of its own: it needs a plan for Codex's MCP config, a per-call check, and new seams in upstream's Codex adapter. It is not a follow-up fix.
3. One extra lookup per narrower delegation: not worth it.
- The cost is one link resolve (a row read and an "answers as the linked machine" race over its addresses), only for narrower-than-
all threads.
- A delegation already makes one to three forwarded calls (project list, capabilities, launch), each with its own resolve.
- Sharing one lookup means
PeerMcpClient.call must take a resolved link. That is new seam lines in an upstream file plus a list-only announce PR, to save milliseconds.
- Each resolve also checks again that the address still answers as the linked machine. That check is worth keeping per call.
4. The no-store exception: narrowed, not removed. Upstream's adapter tests cannot get a store through a seam: their threads with parents would need store rows written for each parent, which is many lines in upstream's test file, not a one-line seam.
- The exception now applies only when neither a thread store nor a settings service is wired. That is exactly upstream's adapter tests: the settings are then the defaults, which give
all, and no store can hold a carried profile, so nothing can be narrowed.
- With settings but no store, a thread with a parent is now refused instead of keeping the old rule.
- The
needsLineage special case is gone.
General vs project
All general: any fork user with linked machines can set a machine to refuse carried profiles. Nothing here is project-specific, and no upstream file changes (seam check: only the pinned seams).
State
- Runs again: the setting is read again for each turn and each features ask, so a change counts from the next one. Tests cover refuse → apply → refuse across runs, two asks of the route with the setting flipped in between, and a second refused delegation that still launches nothing.
- Stopped half-way: the sender refuses before any launch, so nothing is left behind there. A task that arrives anyway is refused at its turn and runs nothing.
- Old, empty or missing state: an old settings file with no key reads as
apply, and a bad value reads as apply. A task with nothing carried gets the role default as before. Settings that cannot be read make the route answer true: the answer is only advice, and the turn re-reads the setting (from settings.json if secrets fail) and refuses there. An unreadable carried profile under refuse is refused.
Tests
The new tests fail on the old code. I put back origin/main's source files under the new tests and ran them: 16 fail (8 in contracts, 8 in server). With this change they pass. Locally: contracts 413/413; server src/fork, src/peer, src/mcp, orchestration-v2/Adapters, serverSettings* and golive 2490/2490. Typecheck, fmt and lint are clean.
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
#640)
- New setting mcpCarriedProfiles ("apply" default, "refuse"). With refuse,
GET /api/fork/features answers mcpProfileCarry: false, the sender refuses
a narrower-profile task before sending, and a task that still arrives
with a narrower or unreadable carried profile (and its sub-agents) is
refused at its turn. A carried all, nothing carried, or the owner's pick
for the task run as before. No value lets a task get more tools.
- Docs say plainly that only Claude threads apply profiles, carried
tasks included.
- The adapter's no-store exception now applies only when neither a thread
store nor a settings service is wired (default settings, so nothing can
narrow). With settings but no store, a thread with a parent is refused.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review (lens B, read-only) of #648, head 341ff6f
Verdict: SAFE. I found no path where a thread gets more tools than its profile allows. With refuse, every path I traced either refuses or gives the same result as apply. The no-store exception cannot be reached in production. The tests are strong (9 of 10 mutants caught; the one survivor is an equivalent mutant).
Blocking
None.
Major
None.
Minor
- The setting's docs leave out the Claude-only limit (
docs/fork/README.md:448). It says a task that arrives anyway "does not start its turn, nor do its sub-agents". On Codex or another provider that task does start, with every tool. The Codex section above says this, but this paragraph reads as unconditional. Add "on Claude" (or a link to the Claude-only paragraph).
- An unreadable carried profile gives an empty name in the message (
apps/server/src/fork/mcpProfile.ts:412). sent.name is "" when the value is not an object, so the message says profile "". This is cosmetic. Say "an MCP profile it cannot read" when the name is empty.
- When settings cannot be read,
refuse becomes apply, never wider (apps/server/src/fork/claudeMcpProfile.ts:336). If getSettings fails and settings.json does not decode, the defaults are used, so a carried narrower task is cut instead of refused. It still gets no more tools, and the same fallback already applies to every profile key. No change needed; noting it so the docs' "is refused" is not read as a promise in that corner.
Attack points checked
refuse, every path:
- Sender's pre-check:
false gets its own message (remoteMcpProfile.ts:64), and !== true still refuses anything else. Nothing is launched, also on a second try (tested).
- First turn here:
resolveAt refuses at the top whenever the carried value is not a readable all. The check runs before the carried readability check, so an unreadable value is refused too, never all.
- Sub-agents and chains: they recurse to the top and get
parent → refused.
- A fork of the task: the fork's lineage reaches the source, which has
delegatedFrom, so it is refused.
- A parent that cannot be read: the carried value is dropped, but
parentMissing refuses (store wired).
- A queued task, or the setting flipped while tasks run:
openQuery resolves the profile on every turn (ClaudeAdapterV2.ts:12967), before the continuation shortcut, so the next turn refuses. A turn that is already running finishes; that is inherent and documented ("counts from the next one").
- A restart: nothing is cached. The setting is read from settings for each turn and each features ask.
- Exceptions: the owner's
thread-pick stands and nothing carried (an older sender) gets the role default, both as before and documented. A carried all gives the same result as apply (tested).
apply: unchanged. The new branch is gated on === "refuse", and the old tests pass unchanged.
- Codex: a carried narrower task on Codex runs with every tool, the same as before MCP profile carry: per-machine refuse, Claude-only docs, no-store rule (#640) #648, and the docs now say so.
resolveMcpProfile's only caller is the Claude adapter (plus the sender's carry). No new hole. Under refuse the sender's pre-check still stops it for any provider, except in the race window.
- The no-store exception cannot be reached in production:
layerServerSettings does provideMerge(SqlitePersistence.layerConfig) (server.ts:283), so wherever the settings service exists, SqlClient does too.
- Hydration also gets
SqlitePersistence.layerConfig directly.
- The registry runs drivers in
Effect.context() (the full runtime context, ProviderInstanceRegistry.ts:539).
RemoteDelegation.layer is built under the same chain.
alone (claudeMcpProfile.ts:358) needs both services missing, which is only true in upstream's adapter tests.
- If the store fails to start, the server fails to boot. A failed store read gives
null, which refuses.
- Settings without a store (refuse threads with parents): only reachable in tests, so no false refusals in production.
- Per-call linked-machine lookup: a
resolve failure gives orchestration_error. A features read failure or timeout gives orchestration_error. A false or absent answer gives capability_denied. All fail closed before the launch.
- The features route when settings cannot be read: it answers
true. That is only advice, and the turn re-reads the setting and refuses there (tested both ways).
- Decoding:
- a missing key (an old file) →
apply;
- an unknown word or not text →
apply;
" Refuse " → refuse;
- a patch is strict (only
apply or refuse);
- a save writes the value as read;
- the setting is person-only (
personOnlySettings.test.ts).
- The docs table row (
"apply", off = yes, MCP profile carry: follow-ups from #611 #640) matches FORK_SETTING_DEFAULTS.
- State question:
- runs again: same answer, asked again, nothing launched;
- stops half-way: the refusal comes before the launch, so nothing is left behind;
- old, empty or missing settings:
apply, and nothing carried gets the role default;
- flipped mid-run: counts from the next turn.
Tests, mutants, CI
- Tests: the 5 changed server test files pass (143), and contracts
mcpProfile.test.ts passes (35).
- Mutants caught (9):
- the refuse check removed;
- refuse letting an unreadable value through;
- the route always answering
true;
- the route answering
false when settings cannot be read;
- the no-store exception for every case;
alone refusing too;
- the sender's
false branch removed;
- the decode made case-sensitive;
- the thread-pick bypass removed.
- Survived (1):
!== true → === undefined in remoteMcpProfile.ts. This mutant is equivalent: the schema allows only true, false or absent, and false is handled just above.
- CI:
gh pr checks 648 is all green.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Review lens A (read-only) of #648, head 341ff6f
Verdict: SAFE. I found no path where a thread gets more tools than its profile allows. Nothing is blocking and nothing is major. Three minors below.
Blocking
None.
Major
None.
Minor
- The
server.mcpCarriedProfiles docs section does not say "Claude only" (docs/fork/README.md:448). It says a task that arrives anyway "does not start its turn, nor do its sub-agents". That is true only on Claude. A Codex task there still runs with every tool, as :375 says. An owner who reads only the setting's section could think refuse protects Codex tasks too. Add "on Claude (a Codex task still runs with every tool, see above)".
- The refusal message can show an empty name (
apps/server/src/fork/mcpProfile.ts:412). When the carried value is not an object, or has no name, sent.name is "", and the message reads MCP profile "". This is cosmetic: it still refuses. Say "an unreadable profile" when the name is empty.
mcpCarriedProfiles is optional in McpProfileSettings (mcpProfile.ts:27). A later caller that passes only some of the settings would silently get apply. That widens nothing, because apply still cuts. Making the key required would let the type checker catch such a caller. Optional.
Attack points checked
refuse, every path:
- Sender pre-check: the route answers
false, and remoteMcpProfile.ts:64 refuses with capability_denied before anything launches. The !== true check would refuse even without that branch, so this branch only improves the message. Asking a second time asks again and launches nothing (tested).
- The task's first turn here:
resolveAt refuses a carried value that is narrower or unreadable (mcpProfile.ts:406-413) before the carried check. A carried all gives the same result as apply.
- Sub-agents: they resolve through the parent and get
parent CannotApply. Deeper chains do the same.
- A task queued before the flip, the race between the ask and the launch, a flip while tasks run: the setting is read again at the start of each turn, before the live process is reused or replaced (
ClaudeAdapterV2.ts:12967). Continuation turns compute the plan first too, so a running task's next turn is refused.
- Restart: no state is held in memory, only settings.json.
- The owner's pick for the task here: it stands. That is the owner's explicit choice and the same rule as before.
- Can a narrower profile be silently dropped? No.
- An unreadable carried value under
refuse is refused, never dropped.
- Nothing carried (an older sender) gets the role default, as with
apply before.
- A parent that cannot be read refuses when a store or settings service is wired.
apply: unchanged. The refusal branch is guarded by === "refuse", and the existing MCP profiles: carry the parent's profile with a cross-machine delegation #532 tests still pass.
- Codex: profiles are applied only in
ClaudeAdapterV2 (makeThreadMcpProfiles has no other runtime caller apart from the sender's carry). A narrower carried profile to a Codex task still runs with every tool there.
- It is the same as on main, not a new hole, and it is now documented (
README.md:375).
refuse makes things stricter: the sender refuses narrower tasks for any provider there.
- No-store exception: production cannot be in either no-store state.
- The registry's driver environment requires both
SqlClient and ServerSettingsService (ProviderInstanceRegistryHydration.ts:36-53), and the registry captures that context for each driver (ProviderInstanceRegistry.ts:539).
- The sender's
makeCarry gets its store through ProjectionStoreV2.layer (server.ts:883).
- If the store cannot be built, the adapter fails to build (closed).
- A store read or decode error becomes
null, which refuses.
- "Settings but no store" (
claudeMcpProfile.ts:377) refuses only threads that have a parent, and only on a wiring that production does not have. So it causes no false refusals in normal use.
- Per-call linked-machine lookup: not changed by this PR.
- A failed
resolve gives orchestration_error.
- A features read that fails, times out (body included), redirects or answers non-200 refuses before the launch.
- The route with settings it cannot read: it answers
true (forkFeatures.ts:46). That is safe, because the turn reads the setting again (from settings.json if secrets fail, refused if neither can be read).
- Decoding:
- a missing key (an old file), an unknown word, or a non-string value reads as
apply;
Refuse reads as refuse;
- a patch accepts only
apply or refuse;
- an encode round trip keeps the value;
- it is person-only (
personOnlySettings.test.ts).
- The docs settings table row (
"apply", off = yes, MCP profile carry: follow-ups from #611 #640) matches FORK_SETTING_DEFAULTS.
State question
- Runs again: the setting is read for each turn and for each features ask, with no cache. Tested refuse → apply → refuse, the route flipped between two asks, and a repeated refused delegation.
- Stops half-way: the sender refuses before the launch, and a task that arrives is refused before its turn. Nothing is left half-started.
- Old, empty or missing state:
- a missing key reads as
apply;
- an unreadable carried value is refused under
refuse and was already refused under apply;
- unreadable settings: the route answers
true, and the turn re-reads the setting and refuses.
- Setting flipped while tasks run: the next turn follows the new value. A turn that is already running keeps its plan, which is expected and not a widening.
Tests, mutants, CI
- In a temp worktree: the 6 changed server test files pass (215 tests) and contracts
mcpProfile.test.ts passes (35 tests).
- Mutants: 11 of 11 caught.
- the refuse check removed;
- the check inverted for unreadable values;
- refuse also taking
all;
- a sub-agent ignoring a refused parent;
- settings without a store going back to the old rule;
alone computed from the store alone;
- the route ignoring the setting;
- the route answering
false on a read error;
- the sender's
false branch removed;
- the decode without trim and lower case;
- the refusal also applied in the built-alone mode.
- CI on
341ff6f7fe: all green (fork-ci-result pass).
SAFE from lens A. Minors 1 and 2 are worth a quick fix but are not blocking.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
FORK_CHANGES.md: main's table plus this PR's MCP profiles row, re-padded.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
scuttletoby
added a commit
that referenced
this pull request
Nov 21, 2026
#640) (#648)
* MCP profile carry: per-machine refuse, Claude-only docs, no-store rule (#640)
- New setting mcpCarriedProfiles ("apply" default, "refuse"). With refuse,
GET /api/fork/features answers mcpProfileCarry: false, the sender refuses
a narrower-profile task before sending, and a task that still arrives
with a narrower or unreadable carried profile (and its sub-agents) is
refused at its turn. A carried all, nothing carried, or the owner's pick
for the task run as before. No value lets a task get more tools.
- Docs say plainly that only Claude threads apply profiles, carried
tasks included.
- The adapter's no-store exception now applies only when neither a thread
store nor a settings service is wired (default settings, so nothing can
narrow). With settings but no store, a thread with a parent is refused.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Docs: settings table row for mcpCarriedProfiles (#640)
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
#640) (#648)
* MCP profile carry: per-machine refuse, Claude-only docs, no-store rule (#640)
- New setting mcpCarriedProfiles ("apply" default, "refuse"). With refuse,
GET /api/fork/features answers mcpProfileCarry: false, the sender refuses
a narrower-profile task before sending, and a task that still arrives
with a narrower or unreadable carried profile (and its sub-agents) is
refused at its turn. A carried all, nothing carried, or the owner's pick
for the task run as before. No value lets a task get more tools.
- Docs say plainly that only Claude threads apply profiles, carried
tasks included.
- The adapter's no-store exception now applies only when neither a thread
store nor a settings service is wired (default settings, so nothing can
narrow). With settings but no store, a thread with a parent is refused.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Docs: settings table row for mcpCarriedProfiles (#640)
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
#640) (#648)
* MCP profile carry: per-machine refuse, Claude-only docs, no-store rule (#640)
- New setting mcpCarriedProfiles ("apply" default, "refuse"). With refuse,
GET /api/fork/features answers mcpProfileCarry: false, the sender refuses
a narrower-profile task before sending, and a task that still arrives
with a narrower or unreadable carried profile (and its sub-agents) is
refused at its turn. A carried all, nothing carried, or the owner's pick
for the task run as before. No value lets a task get more tools.
- Docs say plainly that only Claude threads apply profiles, carried
tasks included.
- The adapter's no-store exception now applies only when neither a thread
store nor a settings service is wired (default settings, so nothing can
narrow). With settings but no store, a thread with a parent is refused.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Docs: settings table row for mcpCarriedProfiles (#640)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Nov 21, 2026
scuttletoby
added a commit
that referenced
this pull request
Nov 28, 2026
#640) (#648)
* MCP profile carry: per-machine refuse, Claude-only docs, no-store rule (#640)
- New setting mcpCarriedProfiles ("apply" default, "refuse"). With refuse,
GET /api/fork/features answers mcpProfileCarry: false, the sender refuses
a narrower-profile task before sending, and a task that still arrives
with a narrower or unreadable carried profile (and its sub-agents) is
refused at its turn. A carried all, nothing carried, or the owner's pick
for the task run as before. No value lets a task get more tools.
- Docs say plainly that only Claude threads apply profiles, carried
tasks included.
- The adapter's no-store exception now applies only when neither a thread
store nor a settings service is wired (default settings, so nothing can
narrow). With settings but no store, a thread with a parent is refused.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Docs: settings table row for mcpCarriedProfiles (#640)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|