Repository navigation
fix(session-control): dispatch a worker template a crewmate shadows - #18454
Conversation
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Check: with Suggestions
[DESIGN-REVIEWED] 870140d Description read[DESCRIPTION-READ] 9821bc3d3939efcf93dc79a51bfa4bd6c672e23591001194de9cf6a3d83f8200 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 On installs where What this change shipsInventory (8 items) — 7 justifiedIntent: A conductor can dispatch the stock worker even when an older sync enrolled a crewmate with the same name. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 870140d Description read[DESCRIPTION-READ] 681aaa18815ff1db8d1aa27802c3b21e186465160c6cbed99cbe9b104513bdf8 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
af3e004 to
4f2509a
Compare
|
|
Real-resolver verification asked for in the PASS summary: |
4f2509a to
b7d648c
Compare
|
On the summary question (an owner-tab conductor on a shadowed install used to get the enrolled |
f5de819 to
ec648c4
Compare
|
Rebased onto |
ec648c4 to
8063362
Compare
|
Rebased onto |
…me-named crewmate shadows On installs where the pre-0.8 enrol-on-mount agent sync registered kirocrew-worker as a crew member with its own private V2 store, a bare session_create(agent="kirocrew-worker") selects that MEMBER. A conductor whose own record is on the shared store (a crew member's DM thread) or a child a parent conductor created may not bind that member's store, so every leaf dispatch is refused memory_delegation_denied -- for a worker that needs no memory of its own. The refusal is terse by design and the member binding is immutable, so the conductor invented a remedy that does not exist (a memory-store setting under Settings > Crew). session_create takes agent_kind with one value, "template": it resolves the shared template in resolve_agent_bindings(selection_kind="template") and the child takes the caller's own store exactly as an unshadowed template child does. There is no "member" kind: a bare name already selects the member. The committed namespace is recorded on the slot and in the birth metadata. The conductor charter and the goal-conductor skill always pass agent_kind "template" for kirocrew-worker, so no conductor meets the refusal first; on an install with no shadowing member the template kind resolves exactly what the bare name resolves. The MCP reply to memory_delegation_denied names the two real remedies, the server-side cause line names the shared-store caller instead of a lost vouch, and the preflight refusal no longer renders a doubled Error: prefix. One test runs the real resolver against a member-shadowed name.
8063362 to
870140d
Compare
|
Rebased onto |
bolichen97
left a comment
There was a problem hiding this comment.
Approved at head 870140d: PR Readiness is green, no open change requests, and the review lanes passed. (AI-assisted review at bolichen97's request.)
Problem / Motivation
Goal: A conductor can dispatch
kirocrew-workeras a plain template on its own memory, so a crewmate of that name holding private memory no longer blocks every leaf dispatch with a refusal the conductor cannot act on.Symptom (gateway 0.8.0.9, three refusals in one minute,
gateway.log):The conductor, running as a crew member's DM thread, then told the user:
That setting does not exist.
MemoryStoreFieldrenders a member's store read-only ("stores are never selectable here"), andPATCH /api/agents/{name}refuses amemory_storechange with 409member_memory_immutable. The user went looking for the control and found nothing.Root cause: the pre-0.8 enrol-on-mount agent sync registered
kirocrew-workeras a crew member with its own V2 store (config.agents["kirocrew-worker"].member_idset,memory_stores["member-kirocrew-worker-..."]), whilekirocrew-conductorstayed ondefault.session_create(agent="kirocrew-worker")resolves name-first, so it selects the MEMBER. The conductor's own record is on the shared store, so the own-store admission can never agree (bind_session_executionvouches only a truthymember_id), the member DM thread is fenced, and the create is refusedmemory_delegation_denied— for a worker that needs no memory of its own. The refusal is terse on the wire by design (it must not confirm a guessed member name), and no shipped text named a real remedy.Why it matters
Every goal conducted from a crew member's DM thread on such an install cannot dispatch a single leaf item through the path the charter prescribes. The conductor falls back to the
defaultagent (as it did here) or stalls, and the user is sent to a Settings control that does not exist. Any install that ran an enrol-on-mount build before f2f5a54 carries this shape;crewmate_prune_migrationdeliberately never pruneskirocrew_ownedrows, so the member stays.Not a goal
test_the_bare_name_is_still_refused_and_the_cause_names_the_shared_storeand the unchangedTestPrivateStoreCallerIsolation).kirocrew-workercrewmate, or making a member's memory binding mutable. The binding stays immutable; a migration that moves it is a separate decision.membervalue for the new field. A bare name already selects the member, so the value would only restate that resolution; the chat route keeps its own two-value field untouched._created_bylineage fence (session_create: agent-created conductors cannot dispatch private-member workers (403 memory_delegation_denied), contradicting goal-conductor skill #15512, fixed by fix: fence session_create by creator's lineage verdict, not _created_by alone #15916).What changed (motivation → approach → change)
session_createcan say "the template, on my own memory", and the conductor always says it forkirocrew-worker.session_create(tool,POST /api/session-control/create,create_session)agent_kindwith one value,"template"; threaded toresolve_agent_bindings(selection_kind=...); recorded on the slot and in the birth metadataagent.py) andgoal-conductor/SKILL.mdkirocrew-workerwithagent_kind: "template"memory_delegation_deniedtool replyThe chat create route already distinguishes the two namespaces a name can live in: an explicit template pick "never pins member memory" (
chat_handlers.py).session_createhad no way to say the same thing, so a shadowed template was unreachable from it.dashboard/session_control.pycreate_session(agent_kind="")takes that one value: any other value is refusedinvalid_agent_kind, a kind withoutagentis refusedagent_kind_requires_agent(an inherited caller agent is not a selection), and a stated kind that does not resolve is refusedagent_unresolvednaming the namespace instead of falling back to whoever answers by default. The existing template arm then does the rest: the child takes the caller's own store and the worker template's persona, as an unshadowed template child already does. The resolver's namespace verdict is recorded on the slot (agent_kind) and in the persist-at-birth metadata, so an idle template child of a shadowed name rehydrates in its namespace rather than re-resolving the bare name member-first.dashboard/handlers/session_control.pyaccepts the field strictly typed (invalid_field_typefor a non-string);validation.pySESSION_CREATE_SCHEMAallows{template}with no default (validation runs twice perTABLE.call, and a defaulted""would meet the allow-list on the second pass).The charter and the skill tell the conductor to pass
agent_kind: "template"on everykirocrew-workerdispatch, not to retry after a refusal: a worker needs no memory of its own, and on an install with no shadowing member the template kind resolves exactly what the bare name resolves (_resolve_agent_selectionskips only the alias lookup). So no conductor meets the refusal first.mcp_dashboard.py:agent_kindin thesession_createschema and payload, with the description saying to always pass it forkirocrew-worker. Amemory_delegation_deniedreply appends the two real remedies (re-send withagent_kind: "template", or the owner's own tab) and says the binding is not a setting; a refused template dispatch gets the owner remedy alone; other refusals are unchanged. The folder-walk preflight refusal no longer renders a doubledError: Error:prefix. The server-side cause line names a caller whose own record is on the shared store as such (no member id AND thedefaultstore, since a V1 crewmate on its own named store also carries no member id), before the vouched-identity causes, still naming neither store nor member.Docs:
src/kiro_crew/docs/session-control.mdargument table and error rows;docs/system-specs/modules/session-control.mdcreate-route paragraph.test_agent_refactor_contracts.py/test_agent_refactor_spec_bytes.pycarry the refreshed digests for the changed conductor prompt bytes, as every prompt-changing PR does (#18111 precedent).Backwards compatibility
Compatible:
agent_kindis optional on the tool, the route andcreate_session; every existing call omits it and takes the unchanged name-first path. The only observable changes to an existing call are the preflight refusal text losing its doubledError:prefix (every existing assertion isstartswith("Error:")and still holds) and the appended remedy sentence onmemory_delegation_denied. The chat route'sagent_kind(member|template) is untouched. One intended behaviour change for the stock conductor only: on an install where the old sync enrolledkirocrew-workeras a crewmate, a conductor that could bind that crewmate (the owner's own tab) used to run leaf items on the crewmate's private memory and now runs the template on its own memory, which is what a one-item worker needs; dispatching the crewmate stays available by bare name.Removes nothing: no field, route, code, record key or capability is removed or narrowed; the fence refuses exactly the population it refused before.
Tests
test/test_member_session_control.py::TestShadowedTemplateDispatchreproduces the host shape (a crew member's DM thread on the shared store, aworkermember with a V2 store, a same-named template):test_the_bare_name_is_still_refused_and_the_cause_names_the_shared_store— the fence is untouched; the log cause names the shared-store condition, not "no vouched identity", and discloses neither store nor member.test_a_v1_member_on_its_own_store_is_not_logged_as_a_shared_store_caller— a memory_version-1 crewmate on its own named store (member id None, private store) naming the V2 member is refused with the vouch cause, never the shared-store cause. Mutation-proved: dropping the store check from the predicate fails it atcall.test_the_template_kind_dispatches_the_worker_on_the_callers_own_store— the child runs the worker template on the caller's own store, member store untouched;agent_kindrecorded on the slot and in the birth metadata.test_the_template_kind_rides_the_http_route— refused bare, admitted as template,invalid_field_typefor a non-string kind.test_a_stated_kind_is_validated_and_never_falls_back—memberandcreware refusedinvalid_agent_kindbefore the resolver is consulted;agent_kind_requires_agent;agent_unresolvednaming the namespace. Mutation-proved: re-admitting"member"to the closed set fails this test atcall(AssertionError: member).test_the_real_resolver_resolves_a_member_shadowed_name_as_the_template— the realresolve_agent_bindings(no stand-in) against a config whereworkeris a crew member on private storemember-workerand the installed-template catalog carries a template of the same name: the bare name is refusedmemory_delegation_denied, the stated kind creates the child on the caller'sdefaultstore withtemplate_id == "worker"and nomember_id. Mutation-proved: withselection_kind=agent_kindreplaced byselection_kind="", this test fails (cannot verify delegation within the caller's memory assignment).test/test_mcp_dashboard_folders.py::TestSessionCreateAgentKind— the kind rides the payload, is absent when omitted, andcrewormemberis refused by the schema before any call; thememory_delegation_deniedreply carries the template and owner remedies (owner-only after a refused template dispatch), other refusals carry none; the preflight refusal carries the same remedy with no folder created.test/test_conductor_agent.py::test_prompt_and_skill_name_the_template_dispatch_for_a_shadowed_worker— charter and skill both carry the literal "Always dispatchkirocrew-workerwithagent_kind: "template"" sentence and no "Re-send".Run locally on this head: the touched test files plus
test_chat_agent_kind.py,test_chat_agent_selection.pyandtest_config_loader.pypass (1,141 tests); black, isort, flake8 and mypy (2,242 source files) clean.Manual verification
Not run against a live gateway: the running install is 0.8.0.9 and this change lands in a later release. The symptom is read from the host's gateway log (three
memory delegation refused for member-kirocrew-conductor: this process holds no vouched identity for the callerlines) and the host'sconfig.json(kirocrew-conductorondefault,kirocrew-workerwithmember_idand amember-kirocrew-worker-…V2 store, created 2026-09-15 by the enrol-on-mount sync); the unit fixture reproduces exactly that shape, and the real-resolver test runs it through the shipped resolver. The absence of the Settings control the conductor pointed at was verified in source:MemoryStoreFieldrenders the store read-only andcrew_update.pyanswers amemory_storechange with 409member_memory_immutable.Related Issues
no linked issue: the refusal shape was read on a host, not filed as an issue; the two references below are adjacent fixes, not this defect.
Refs #15512 (the
_created_byhalf of the same refusal, fixed by #15916; this PR is the shared-store half). Refs #18204 ("Not covered": amember-<slug>thread refused for a requested agent name that is itself aconfig.agentskey —agent_kind: "template"is the way out for that shape too).Pattern harvest
Rule candidate: review-prompt
Pattern: a deliberately terse refusal (one that withholds the store, the member, the account) must be paired with an actionable remedy at the surface the caller reads, or the caller invents one — here a Settings control that does not exist.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license (see the Licensing section of CONTRIBUTING.md).