Skip to content

fix(crew): a crewmate's worker gets its skills and can open a child - #23599

Merged
chenmingwei23 merged 2 commits into
mainfrom
fix/crewmate-worker-context-skills
Oct 24, 2026
Merged

chenmingwei23 merged 2 commits into
mainfrom
fix/crewmate-worker-context-skills

Conversation

@buluoray

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A crewmate's worker sees its crewmate's added skills in its session context, and can open its own child session in its crewmate's workspace.

Two follow-ups from #23010:

  • The session-start and post-compaction skill plan (context._skills_injection_plan) called agent_skill_globs without the worker's session key. The worker's merged kit (mate_worker.mate_service_scope_spec) is built from that key, so the lookup could not read it: the worker resolved as a custom agent with no skills, and a crewmate-added always: true skill never reached its context, though skill_search (which does pass the key) could still find it.
  • A worker runs as a template, so the member-workspace inheritance in session_create (_caller_member_workspace) did not name it, and a worker that opened its own child was refused agent_workspace_mismatch.

Why it matters

A crewmate's own skills are how its owner shapes the work it hands off; a worker that never sees them in context does the work without them. A worker that cannot open a child cannot split its own task, which every other session in the crewmate's workspace can.

Not a goal

  • The per-turn triggered-skill filter in context_assembly/turn_message.py, which also calls agent_skill_globs without the key; passing it there narrows which triggered skills a worker gets, a separate change.
  • Widening which callers inherit a member's workspace beyond a session running on that crewmate's own store.
  • The other feat(crew): give each crewmate its own config, a conductor and a worker #23010 follow-ups.

What changed (motivation → approach → change)

  • Missing skills → the plan had the session key and dropped it → _skills_injection_plan passes session_key through to agent_skill_globs.
  • Refused child → the inheritance asked only "is the caller this crewmate's conductor chat" → _caller_member_workspace also accepts the crewmate whose own store the caller runs on (_store_s_crewmate): the caller's attested record keeps the crewmate's id (or, for an id-less crewmate, its selection) and its store, and the store must be that crewmate's own, so the child runs where the worker runs, on the same store. A template caller on another crewmate's store is still refused.
  • Docs: context-management.md (skill plan) and session-control.md (agent_workspace_mismatch row).

Backwards compatibility

Compatible: the skill plan only gains a key that agent_skill_globs already accepted, and the workspace check admits one more caller shape while every caller it refused before (other store, no record, non-member) is still refused.

Removes nothing: no field, route, validator or record is removed.

Tests

  • test_mate_skill_scope.py::test_a_crewmate_workers_context_skill_plan_reaches_its_crewmates_skills: the plan for a worker session includes both the worker base's skill and the crewmate's added one.
  • test_session_control_member_workspace_template.py::test_the_members_worker_opens_its_own_child_in_the_members_workspace: the worker's child runs in member-pixel on the crewmate's store and member id.
  • test_session_control_member_workspace_template.py::test_a_template_caller_on_another_members_store_is_not_widened: a template caller carrying the member id on a peer's store is still refused.

Proof: PROVEN test/test_mate_skill_scope.py::test_a_crewmate_workers_context_skill_plan_reaches_its_crewmates_skills (head 857f6cd)

prove.py does not list the workspace test because the reverted code raises SessionControlError rather than failing an assert; reverting the _store_s_crewmate call by hand turns test_the_members_worker_opens_its_own_child_in_the_members_workspace red with agent_workspace_mismatch.

Local gate: the three related backend batches ran about 71,800 tests; 106 failed, and every one fails the same way on the base commit. The frontend batches did not run here (this worktree has no website/node_modules); the diff touches no frontend file and CI runs them.

Manual verification

N/A — unit coverage drives the real create_session and the real skill plan; no live gateway run.

Related Issues

Refs #23010

Sibling sweep

Swept: git grep -n "agent_skill_globs(" -- src/
Sibling: src/kiro_crew/agent_discovery_parts/skill_scope.py -- not affected -- session_skill_globs already passes session_key
Sibling: src/kiro_crew/context_assembly/turn_message.py -- not affected -- left out on purpose, see Not a goal
Sibling: src/kiro_crew/context.py -- changed here

Pattern harvest

Not generalizable: the worker's identity lives only in its session record, and these are the two lookups that read crewmate state by name; a lint cannot tell which name-keyed lookups need the session.

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.

The session-start and post-compaction skill plan resolved a crewmate's
worker without its session key, so the worker's merged kit could not be
read and the crewmate's added skills were missing from its context.
A worker runs as a template, so the member-workspace inheritance did not
name it and its own child was refused agent_workspace_mismatch. Its
attested record keeps the crewmate's id and store; a store that is that
crewmate's own now answers with the crewmate's workspace.
@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners October 24, 2026 00:22
@buluoray
buluoray requested a review from cruisercohen October 24, 2026 00:22
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 857f6cd85004ac01581a72f8e9293ce3cc82fc0d touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: both fixes go after the root causes, which are the dropped session key and a crewmate test that missed template callers. The store-equality check keeps the child on the caller's own store, so no store boundary is crossed.

Notes

  • turn_message.py still calls agent_skill_globs without the session key, so a worker's per-turn triggered skills can still differ from its session-start plan. The PR excludes this on purpose; track it as a follow-up.

[DESIGN-REVIEWED] 857f6cd

Description read

[DESCRIPTION-READ] 46d62d54977b314fe73f226095711537c5d0c911fe46c5f9d45b0c6e7ec80f66

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 857f6cd85004ac01581a72f8e9293ce3cc82fc0d — 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

Nothing blocks: both items are mechanism-level fixes for defects that tests on this PR reproduce, and neither duplicates an existing helper.

What this change ships

Inventory (5 items) — 5 justified

Intent: let a crewmate's worker see its crewmate's added skills in context, and open its own child session in that crewmate's workspace. This is a FIX.

  1. A crewmate's worker now gets its crewmate's always-on skills at session start and after compaction — justified
  2. A crewmate's worker can now open its own child in the crewmate's member-<slug> workspace instead of being refused agent_workspace_mismatch — justified
  3. A template caller on another crewmate's store is still refused — justified
  4. _store_s_crewmate added to the facade's TYPE_CHECKING manifest — justified
  5. Spec rows updated in context-management.md and session-control.md — justified

[FIRST-PRINCIPLES-REVIEWED] 857f6cd

Description read

[DESCRIPTION-READ] 4ffed6b8fd8ac9bdeb0cba7715b9fa1ce0b17c8839a5824b201f89db6ffae71f

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 857f6cd85004ac01581a72f8e9293ce3cc82fc0d — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 857f6cd

Verdict parsed from the review's SHA-scoped output markers for commit 857f6cd85004ac01581a72f8e9293ce3cc82fc0d.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 857f6cd85004ac01581a72f8e9293ce3cc82fc0d: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 857f6cd85004ac01581a72f8e9293ce3cc82fc0d and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 857f6cd

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 857f6cd85004ac01581a72f8e9293ce3cc82fc0d: <one-sentence reason>

@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
@chenmingwei23
chenmingwei23 merged commit 5bcb00b into main Oct 24, 2026
106 checks passed
@chenmingwei23
chenmingwei23 deleted the fix/crewmate-worker-context-skills branch October 24, 2026 02:37
@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.

2 participants