Repository navigation
fix(acp): share the Claude settings seed when only the model differs - #16782
Conversation
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
3 similar comments
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Confirm the dropped rationale that sharing "would silently override the sibling's own pick" no longer holds. The base control run shows the sibling reads the owner's file either way. [DESIGN-REVIEWED] 08c09ec Description read[DESCRIPTION-READ] bcdf8ff58a924743a5e966b34dfdbb696555331c1b35c38752ef02eb40bdec2a That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check one thing: the live push-over-seed proof ran only on claude-agent-acp 0.73.0. Confirm a sibling still lands on its own model on an adapter at 0.84.0 or later. What this change shipsInventory (6 items) — 6 justifiedIntent: a Claude session that shares a project directory with a session pinned to another model, or to none, keeps Crew's MCP tools and runs its own model. FIX.
[FIRST-PRINCIPLES-REVIEWED] 08c09ec Description read[DESCRIPTION-READ] cfbfdeb3aa11575bc00d441d28d07e0c003cfc610d06f26314d7f8cf17a759a5 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
|
Updated the description: the Goal now includes sessions pinned to different models (Not a goal dropped that exclusion), and Manual verification records a live run. On this head (claude-agent-acp 0.73.0), a sibling pinned to Fable 5.0 shares an Opus 5.5 seed, fresh and after a restart with |
1146248 to
6c939ba
Compare
|
Rebased this branch onto current
This is an automated maintenance rebase: there had been no activity from anyone else on the PR in the last 6 hours. No code was changed. |
A claude session whose rendered settings payload differed from the shared .claude/settings.local.json only in the "model" key was refused the share. Below claude-agent-acp 0.84.0 the exclusion fallback is unavailable too, so the session ran with its whole mcpServers array withheld. "model" grants no permission and _apply_startup_model sets it live, so retry the share with the payload's model key dropped.
A Claude session resumed after a gateway restart keeps its own slot pin, while the first fresh session after the restart seeds the shared settings file under another model. Siblings can also be advertised the same models in another order. Either way the payload differed from the seed outside every permission key, the share was refused, and the session ran with its whole mcpServers array withheld. Share a sibling's seed when it carries this session's permission keys and still lets the session run its own model. The model half grants no permission, and _apply_startup_model pushes each session's model live, which the adapter accepts only for an availableModels entry. So the seed must list the session's model, or name none when the session pins none. This one rule replaces the model-key retry, and the share still validates the seed's own bytes. The seed is read only when it matches the durable record, through the bounded, no-follow, non-blocking read the ownership check already uses, so a FIFO or an oversized file at the path is refused unread.
6c939ba to
08c09ec
Compare
|
Reviewed, not approving (crew-pr-reviewer). It changes when a Claude session reuses a sibling's settings seed, which decides that session's MCP tools and model. A maintainer should confirm the sharing rule. |
iamwhatever
left a comment
There was a problem hiding this comment.
Approving after a deeper pass (crew-pr-reviewer). This fixes a real loss: a model-pinned Claude session next to an unpinned owner was refused the shared seed and ran without Crew's MCP tools. The share now allows only the model half (availableModels, model) to differ. The sibling seed bytes are read without following links or waiting on FIFOs, and must match the expected size and hash. It is a one-file change with 7 tests, and Design and First Principles lanes PASS. CI is green and the base is main.
Problem / Motivation
Goal: A Claude session keeps Crew's MCP tools, and runs its own model, when it shares a project directory with a session pinned to another model or to none.
Every Claude session in one
work_dirshares one Crew-authored.claude/settings.local.json. A later session may share that seed only when its own rendered payload is byte-identical to it. The payload carries amodelkey whenever the session pins a model, so a model-pinned session next to an unpinned owner is refused the share. A session pinned to a different model than the seed's is refused the same way. A session resumed after a gateway restart hits that case whenever its pin differs from the new owner's. With claude-agent-acp older than 0.84.0 the exclusion fallback is refused too, so the session is not governed and runs with its wholemcpServersarray withheld, pooled stubs included: no Crew tools at all.Why it matters
Whichever session seeds first owns the file. Any later session in that directory whose
modelkey differs from the seed silently loses every Crew MCP tool, and nothing in the session says why.Not a goal
What changed (motivation → approach → change)
Commit 1:
work_dirwith an unpinned session launches with no--mcp-config._share_settings_seed_if_identicalcompares whole payloads, andmodelis the only key that differs.modelgrants no permission, and_apply_startup_modelsets it live on the session anyway. The new_share_settings_seed_ignoring_modeltries the exact share first, then retries it with the payload'smodelkey dropped. Both share sites insrc/kiro_crew/acp/client.pycall it: the pre-existing-seed branch and the poll after losing the create race. The permission keys (permissions.defaultModeand the rest) still have to match byte for byte.Commit 2, added after a live run. It covers the different-model case that "Not a goal" deferred when this PR opened, without narrowing the digest.
--resumeand no--mcp-config. It keeps its own slot pin, while the first fresh session after the restart seeds the file under the crew's current pin. Siblings can also be advertised the same models in another order, soavailableModelsdiffers as well.model. It matches nothing but a modelless seed with an identical list._share_sibling_settings_seedreplaces that retry with one rule, taken from how a session's model already reaches the adapter.availableModels,model) grants no permission._apply_startup_modelpushes each session's model live oversession/set_config_option, and claude-agent-acp accepts that push only for anavailableModelsentry.model. A session that pins none pushes nothing and would start on the owner's pin, so it shares only a seed that names nomodeleither._settings_path_holds's bounded, no-follow, non-blocking read now hands back the verified bytes (_settings_path_bytes), so a FIFO or an oversized file at the path is refused, not read.docs/system-specs/modules/claude-code-provider.mdnow describes the rule. It still said the model keys were part of the share boundary.Backwards compatibility
Compatible: a seed that was shared before is still shared, since the byte-identical check runs first. The new shares are siblings whose seed differs only in the model half and still runs their model. Three cases stay refused, as they were before this PR:
availableModelsdoes not list the session's modelRemoves nothing: the change only widens when an existing share succeeds. No key, record, validator or path is removed or tightened.
Tests
All in
test/test_acp_seed_provenance.py::TestSharedPermissionSurface. Each was run against the code it names and failed there:test_a_model_pinned_sibling_shares_a_modelless_seedclient.pywithout commit 1, atassert sibling._claude_settings_shared is Truetest_a_sibling_pinned_to_another_model_shares_the_seedtest_a_sibling_offered_another_model_list_shares_the_seedtest_an_auto_sibling_offered_another_model_list_shares_the_seedtest_a_sibling_whose_model_the_seed_does_not_list_is_refusedtest_an_auto_sibling_is_refused_a_pinned_seedtest_a_fifo_at_the_seed_path_is_refused_without_blockingThe rest of the module passes (171 tests), as do the ACP client, session-MCP, permission-seed, model-registry, provider-mirror and member-mount modules. flake8, isort, mypy, the black gate, the harness-parity gate and the docs lint are clean.
Manual verification
A live run on this head (
1146248): an isolated gateway (python -m kiro_crew gateway --test-mode, throwaway data home) with the claude backend and claude-agent-acp 0.73.0. That adapter is below the 0.84.0 exclusion floor, so a refused share leaves the session with no Crew MCP tools. All slots share one project directory, and every turn asks the session to callkirocrew-core'slist_sessionsonce.claude-opus-5.5, runs first. It seeds the sharedsettings.local.jsonwith"model": "global.anthropic.claude-opus-5-5[1m]"and anavailableModelslist that includesfable.claude-fable-5(Fable 5.0), runs next. Crew folds the pin onto the adapter's advertisedfable.claude-opus-5.5runs first and seeds the file again. Slot B then runs again, and the adapter resumes it (resume=<B's session id>, Claude Code--resume).What slot B showed, read from the seed record, the adapter's own frames (recorded with
KIROCREW_ACP_RECORD_FRAMES) and B's Claude Code transcript:--resume)modeloption as B starts (session/new,session/load)global.anthropic.claude-opus-5-5[1m](the seed's)global.anthropic.claude-opus-5-5[1m](the seed's)modeloption after Crew'sset_config_optionpushfablefablemessage.modelof B's replies in its transcriptclaude-fable-5claude-fable-5mcp__kirocrew-core__list_sessionscallclaude-agent-acp 0.73.0 reports the current model as the
modelconfig option'scurrentValueand sends nomodels.currentModelId. The adapter starts B on the seed's model, then Crew's push moves it to B's own, both fresh and on resume. Slot A and its post-restart replacement ranclaude-opus-5-5throughout.Control: the same steps on the base commit (
5786c77bc, without this PR). B still ranclaude-fable-5, but the gateway refused it the share both times: the gateway loggedwithholding the whole mcpServers array, the seed record lists no sharer, and B answered thatlist_sessionsis not available.Related Issues
Surfaced while testing #16200's per-crew ACP backend pins. Those first put a model-pinned crew on Claude next to an unpinned session, and then a resumed session next to a re-pinned one.
Pattern harvest
Not generalizable: the byte-equality share rule is the one place where a non-permission key was compared as if it were a permission.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)