Skip to content

fix: mount scoped worker tools for kas crewmates - #21820

Closed
pstarkgit wants to merge 2 commits into
kirodotdev:mainfrom
pstarkgit:codex/member-managed-spawn-durable-20261018
Closed

pstarkgit wants to merge 2 commits into
kirodotdev:mainfrom
pstarkgit:codex/member-managed-spawn-durable-20261018

Conversation

@pstarkgit

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Let eligible KAS crewmates create and manage durable worker sessions through a finite, session-bound core tool mount.

KAS crewmate sessions can receive dashboard session controls, but they do not receive the public core worker verbs needed to create, inspect, list, and steer managed workers. Adding the full core server would expose unrelated capabilities and could ignore the crewmate's authored tool restrictions.

Why it matters

Crewmates need durable delegated work to outlive one turn while remaining attributable to the correct session. A finite mount provides that capability without widening ordinary sessions or sharing a scoped process with the normal full core server.

Not a goal

  • Do not change worker scheduling, completion callbacks, delivery, polling, or judgment.
  • Do not add managed worker tools to ordinary, unsigned, nonmember, or non-KAS sessions.
  • Do not replace explicit core server selections or weaken disabled and excluded tool settings.
  • Do not change the Kiro harness construction path.

What changed (motivation → approach → change)

The missing worker surface is added as a session-specific managed kirocrew-core element after the KAS agent projection and before managed-server hoisting. The KAS projection now carries the exact admitted source spec beside its derived-spec snapshot, allowing the mount to preserve authored selections without rereading a changing file. The generated process receives the real signed session token and a validated finite scope containing spawn_run, spawn_status, spawn_list, and spawn_steer; an existing projected skill_search is retained. Full discovery, names-only discovery, and dispatch all enforce the same scope, and the existing pooled environment hash separates finite and ordinary core processes.

The mount retains the existing fail-closed agent.member_dispatch opt-out. Malformed policy or settings, an empty tool allowlist, an explicit core declaration, a disabled native mount, or an ineligible session leaves the original projection and server array unchanged.

Backwards compatibility

Compatible: existing session and agent-spec inputs remain valid, and ordinary core processes retain their complete tool surface.

Removes nothing: the change adds a finite member-only mount and preserves all existing authored servers, tools, permissions, exclusions, and callbacks.

Tests

  • The canonical related-change gate passed on the unchanged candidate: 123,750 backend tests passed, with 266 skips and 6 expected failures; 22,735 frontend tests passed, with 2 skips. No test failed.
  • Focused production-function tests cover signed member eligibility, loaded and new request shapes, finite discovery and dispatch, opt-outs, explicit selections, disabled mounts, empty allowlists, malformed settings, exclusions, retained skill_search, immutability, and pooled process-key separation.
  • The KAS projection test verifies that the admitted source spec accompanies the derived payload. Existing callback-failure coverage confirms the unchanged completion path.
  • Stability checks passed: 20 serial and 10 grouped parallel repetitions for the new member-managed tests, 20 serial repetitions for source-spec projection, and grouped and seeded-shuffled KAS neighbors.
  • Black formatting ratchet, subprocess encoding, isort, Flake8, mypy, added-line harness parity, and documentation lint passed.
  • Related fixture repairs establish import aliases before dependencies, isolate the Bash stub environment, and pin the doctor test's expected install channel. The KAS runtime identity catalog now records the new positive backend check.

Manual verification

The exact-source isolated pod booted, returned healthy status, and served the two expected seeded cron records. Authentication passed: sessions returned 200 with owner authentication and 403 without it. A supplemental headless check rendered the seeded conversation and composer, read authenticated sessions, and observed zero page errors. The task-owned pod was stopped and its isolated data home reclaimed; production was unchanged.

The bundled browser smoke did not pass: its navigation timed out waiting for network idle. The supplemental screenshot contains an update dialog, and its request snapshot shows a pending /api/ui-prefs request. The method, request age, and cause were not recorded; no causal attribution is made. That failure is retained and is not claimed as a green end-to-end result. Signed member-worker composition is verified by the production-function tests above, rather than this dashboard-shell check.

Screenshots / video

N/A — backend-only session and MCP composition change with no rendered UI delta.

Related Issues

Closes #21819.

Pattern harvest

Rule candidate: review-prompt
Pattern: Session-specific capability mounts must preserve operator opt-outs and enforce one finite scope across discovery, dispatch, and pooled process identity.

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.

@pstarkgit
pstarkgit requested review from a team and KiroCrewCaptain as code owners October 18, 2026 08:41
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 18, 2026
@pstarkgit
pstarkgit force-pushed the codex/member-managed-spawn-durable-20261018 branch from 47ead01 to 2530947 Compare October 21, 2026 18:18
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 21, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 21, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

Thanks for the careful work here, @pstarkgit. Closing this as superseded by the Crewmate 2.0 change in #23010 (merged 2026-10-23, commit 26cd29f).

On current main a crewmate's own chat runs on kirocrew-mate-conductor and hands durable work to its own kirocrew-mate-worker sessions through session_create / session_send / session_read_message. Those sessions outlive the turn, run with the crewmate's kit and identity, and wake the crewmate when they report, which covers the goal of #21819.

The accepted RFC amendment in that PR also decided the opposite of this mount: the conductor starts no sub-agents. spawn_run, spawn_sub_agents and the durable pump are refused for it by agent_policy.conductor_spawn_refusal (src/kiro_crew/subagent_parts/agent_policy.py), and mate_worker.MATE_CONDUCTOR_EXCLUDED_TOOLS leaves those tools out of its spec. Mounting spawn_run / spawn_status / spawn_list / spawn_steer on KAS crewmate sessions would conflict with that design, and the branch also conflicts with main in the files #23010 rewrote.

If you see a crewmate case that the worker path still does not cover, please open a new issue against the current design and we will take a look.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: kas crewmates lack managed-worker tools

2 participants