Skip to content

fix(crewmate): a conductor slot with no record opens no worker - #23678

Merged
iamwhatever merged 1 commit into
mainfrom
fix/crewmate-recordless-conductor-worker
Oct 24, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/crewmate-recordless-conductor-worker

Conversation

@buluoray

@buluoray buluoray commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A crewmate chat with no memory record cannot open a worker that belongs to no crewmate.

A crewmate's conductor chat hands its work to the crewmate's worker through session_create. A conductor slot from before execution records were written has no record, and names its crewmate only by its slot agent. session_create still read that as the crewmate's hand-off and opened kirocrew-mate-worker with member_id=None on the shared default store (#23010 review, CrysisDeu minor items).

Why it matters

That worker belongs to no crewmate. Its own spec refuses it at its first turn (worker_session_spec: "it names no crewmate"), so the user gets an empty session in the sidebar that can never run. Until then it sits on the shared store, outside the crewmate's private memory.

Not a goal

What changed (motivation → approach → change)

Symptom → cause → change:

  • Symptom: a record-less conductor slot opens a worker with no member on the default store.
  • Cause: _hands_off_to_own_worker falls back to the slot's agent name when the caller has no record (_dispatching_crewmate), but the worker's identity and store come only from the record, so the child is built from the shared template branch.
  • Change: src/kiro_crew/dashboard/session_control_parts/session_create.py:create_session refuses that hand-off with conductor_record_missing before anything is allocated. The message tells the user to open a new chat with the crewmate, which gets a record. The code is its own: the MCP loopback decoder (src/kiro_crew/mcp_core_parts/gateway.py:_http_error_body) rewrites caller_record_missing, an auth-layer code, to its cron and subagent wording, which would hide this remedy from the model.

Dropping the slot-name fallback inside _dispatching_crewmate itself, for every reader, is tracked in #23834.

I chose a refusal over building the worker from the slot agent's member record, because a record-less slot has no attested identity: binding it to a private member store from a name alone would skip the authorization the record carries.

docs/system-specs/modules/session-control.md records the refusal next to worker_kit_harness_unsupported.

Backwards compatibility

Compatible: only a conductor slot with no execution record changes, and the worker it opened could never run a turn.

Removes nothing: no field, key, route or function is removed; one hand-off that produced an unusable session is now refused.

Tests

Proof: PROVEN test/test_mate_worker_dispatch.py::test_a_conductor_slot_with_no_record_opens_no_worker (head 551a42f)

  • test/test_mate_worker_dispatch.py::test_a_conductor_slot_with_no_record_opens_no_worker: a default-workspace crewmate's conductor slot with its record removed; the hand-off is refused conductor_record_missing and no slot is allocated. Without the fix it opens kirocrew-mate-worker with no member on default.
  • test/test_mcp_dashboard_folders_session_create.py::test_a_record_less_conductor_refusal_reaches_the_model_with_its_own_remedy: the refusal body goes through _http_error_body and the session_create tool, and the tool reply still says "open a new chat with the crewmate". Under the earlier caller_record_missing code it does not.
  • Ran locally: test_mate_*.py, test_crewmate_*.py, test_session_control*.py and both ratchets (1804 passed), lint, mypy, semgrep, docs-lint, and scripts/local-gate.py --base origin/main: backend passed (3024); frontend failed 9 files this diff does not touch, each with Denied ID .../node_modules/@pierre/diffs/..., because this host serves website/node_modules from a symlink vite refuses; CI runs them.

Manual verification

N/A — unit coverage sufficient: the refusal is driven through the real create_session on a real config and transcript.

Related Issues

Follow-up to #23010. Follow-up: #23834.

Sibling sweep

Swept: git grep -n "_dispatching_crewmate(" -- src/kiro_crew/dashboard/session_control_parts/session_create.py
Sibling: src/kiro_crew/dashboard/session_control_parts/session_create.py -- changed here
Sibling: src/kiro_crew/dashboard/agent_admin/crew_records.py -- not affected -- it reads the crew record by name to create a crewmate and opens no session

Pattern harvest

Not generalizable: the record-less fallback is the one place a slot name stands in for an attested identity on the hand-off path.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners October 24, 2026 06:34
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 24, 2026
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 551a42fae4f4a3f302e16410bef62e5c2060bb0c — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing to check. The change is backend only: it adds a session_create refusal that goes to the model through MCP. It adds or changes no dashboard control, so the missing blind read leaves no evidence gap.

[UX-REVIEWED] 551a42f

Description read

[DESCRIPTION-READ] 44a4b77d88444b4c9624d7bd0abb335a1e2ca0545d706c108f803380a1396d48

That sha256 names everything this verdict read: the PR description, plus the 3 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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 551a42fae4f4a3f302e16410bef62e5c2060bb0c — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. A hand-off that could only produce a worker that never runs is now refused before anything is allocated, under a code of its own.

Notes

  • The record-less fallback in _dispatching_crewmate still feeds _conducts_for_a_worker for every other reader. This PR guards only the one hand-off site, so crewmate: drop the slot-name fallback in _dispatching_crewmate #23834 is where the real cause gets fixed. Keep that issue linked to this new refusal so the guard is removed once the fallback is gone.

[DESIGN-REVIEWED] 551a42f

Description read

[DESCRIPTION-READ] a875c7a6d7b41ac539c4234e5659a427a89d15b41f9a03441867f74cb90f3edd

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 551a42fae4f4a3f302e16410bef62e5c2060bb0c — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

The refusal sits at the call site, and the description names the cause and defers it to #23834, so nothing blocks.

Notes

What this change ships

Inventory (3 items) — 2 justified

Intent: stop a crewmate chat with no memory record from opening a worker that belongs to no crewmate and can never run. FIX.

  1. A record-less conductor chat's hand-off to its worker is now refused before anything is allocated, with a "open a new chat with the crewmate" remedy — symptom-level, cause deferred to crewmate: drop the slot-name fallback in _dispatching_crewmate #23834
  2. A new refusal code conductor_record_missing, kept apart from caller_record_missing so the MCP decoder at gateway.py:577 doesn't reword it — justified
  3. The session-control spec records the refusal — justified

(The website hunks in the patch are #23229, already on base 7d472002. The merge commit's diff against base touches only the 4 backend, test and doc files.)

[FIRST-PRINCIPLES-REVIEWED] 551a42f

Description read

[DESCRIPTION-READ] ec8a82e2e1c771c9648f9084cf090701764b13d77163d60ec26c316e21dc408e

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 551a42fae4f4a3f302e16410bef62e5c2060bb0c — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 551a42f

Verdict parsed from the review's SHA-scoped output markers for commit 551a42fae4f4a3f302e16410bef62e5c2060bb0c.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 551a42fae4f4a3f302e16410bef62e5c2060bb0c false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 551a42fae4f4a3f302e16410bef62e5c2060bb0c and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 551a42f

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 551a42fae4f4a3f302e16410bef62e5c2060bb0c false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 24, 2026

@cruisercohen cruisercohen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed as security scope (crewmate worker routing), comment only — not approving. This is a fail-closed tightening, and I found no blocking problem.

It refuses create_session with caller_record_missing when a conductor slot would hand off to its own worker but has no execution record (a slot from before records, named only by its slot agent). Without the refusal, that worker would run with no crewmate, on the shared store — not the confinement a crewmate's worker is meant to inherit. The refusal is raised before anything is allocated, and only on the own_worker + caller_execution is None path, so an ordinary create is untouched.

Tests: 32 pass on the merge with current main; dropping the refusal turns test_a_conductor_slot_with_no_record_opens_no_worker red (it also asserts nothing was allocated).

Final sign-off is a maintainer's.

iamwhatever
iamwhatever previously approved these changes Oct 24, 2026
@iamwhatever
iamwhatever enabled auto-merge (squash) October 24, 2026 20:45
@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at b859727.

The code looks correct. The refusal fires only on the own-worker path with no execution record, before anything is allocated (session_create.py#L333-L342), and the new test checks both the code and that no slot was created. All checks are green.

It stays on hold for two reasons:

  1. Policy: this changes which caller may open a crewmate worker and on which memory store, so a human maintainer signs off on identity and admission changes.
  2. Two AI notes on this head have no reply. The Opus note is accurate: gateway.py#L577-L581 replaces any caller_record_missing message with the cron/subagent wording, so the model never sees "open a new chat with the crewmate". The Design note suggests removing the slot-name fallback in _dispatching_crewmate itself. Please reply to each, and if either is deferred, link an issue.

— crew-pr-reviewer (r124)

A crewmate's conductor slot from before execution records names its
crewmate only by its slot agent. session_create still took it as the
crewmate's hand-off and opened kirocrew-mate-worker with no member id
on the shared default store, a worker no turn can run. It is now
refused conductor_record_missing before anything is allocated. The code
is its own: the MCP loopback decoder rewrites caller_record_missing to
its cron and subagent wording, which would hide this refusal's remedy.
@buluoray
buluoray force-pushed the fix/crewmate-recordless-conductor-worker branch from b859727 to 551a42f Compare October 24, 2026 21:06
@buluoray

Copy link
Copy Markdown
Contributor Author

New head: 551a42fae4f4a3f302e16410bef62e5c2060bb0c (rebased on main 0dc070e421, still one commit).

Re HOLD (crew-pr-reviewer r124): both AI notes are answered below. The human sign-off on the admission change is Ray's.

Opus note — mcp_core_parts/gateway.py rewrites caller_record_missing: accurate, fixed in this PR. caller_record_missing is the auth layer's code for a removed cron or subagent record (token_auth.py), and _http_error_body replaces its message with that wording. This refusal now has its own code, conductor_record_missing, which the decoder passes through unchanged. New test test/test_mcp_dashboard_folders_session_create.py::test_a_record_less_conductor_refusal_reaches_the_model_with_its_own_remedy runs the refusal body through _http_error_body and the session_create tool and checks the tool reply says "open a new chat with the crewmate"; it fails under the old code. The spec line in session-control.md names the new code.

Design note — drop the slot-name fallback in _dispatching_crewmate: deferred to #23834. It changes every reader of _dispatching_crewmate (workspace inheritance, profile model pins, the hand-off), so it needs its own reader sweep and tests; this PR guards only the hand-off, the one reader that could open a worker on the shared store.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 24, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Maintainer sign-off (buluoray) at 551a42f, on the identity / admission change @iamwhatever held for.

  • What rule changed: session_create refuses a conductor slot that would hand off to its own worker but has no execution record, with its own code conductor_record_missing.
  • Before -> after: before, such a slot opened a worker with no crewmate, on the shared store; after, it is refused before anything is allocated, and the model is told to open a new chat with the crewmate.
  • Worst case if wrong: a pre-record conductor chat cannot open its worker until the user starts a new chat with that crewmate. No data or memory is touched.
  • Evidence checked: the refusal sits only on the own-worker path with caller_execution is None (session_create.py), before any allocation; the gateway now passes the new code through instead of rewriting it to the cron/subagent wording; cruisercohen and iamwhatever reviewed the code as correct.
  • Tools still work: ordinary session_create, template workers and every caller with a record are unchanged; only the record-less own-worker case refuses.
  • Backward compatible: yes. The only change is a refusal for a case that used to produce a worker with no crewmate.
  • Existing tests: the related suites pass (1127 tests on the rebased head); the new tests fail with the fix reverted (PROVEN at 551a42f), including the gateway pass-through test.
  • How to undo: revert this one commit; no migration or stored state to roll back.

The slot-name fallback in _dispatching_crewmate is tracked separately in #23834.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 24, 2026

@CrysisDeu CrysisDeu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: MERGE_WITH_NITS → Approve

Reviewed at head 551a42fa. This closes the #23010 slice-B gap: session_create.py:345 now refuses with conductor_record_missing before any allocation, and I could not find another record-less path that reaches shared memory. Fail-closed at the entry point, as required.

Admission sign-off at 21:23Z was the author's own; this approval is the second-maintainer sign-off.

Nits (non-blocking)

  1. test/test_mcp_dashboard_folders_session_create.py:393-422 — the decoder test hand-builds the payload instead of going through create_session, so a refactor of the call site would not be caught. Couple it.
  2. test/test_mate_worker_dispatch.py:165-191 — no refuse → fix record → recover sequence test. Add one so the "recovers after the record is fixed" claim is CI-checked.
  3. session_create.py:1498-1501 — _dispatching_crewmate docstring is stale; remove together with the guard under #23834.

Posted by code-reviewer (Kiro Crew member) on behalf of @CrysisDeu. Full report on file.

@iamwhatever
iamwhatever merged commit 658eb70 into main Oct 24, 2026
109 checks passed
@iamwhatever
iamwhatever deleted the fix/crewmate-recordless-conductor-worker branch October 24, 2026 22:58
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants