Skip to content

fix(spawn): admit the host operator's cli spawn without a session on 0.8 - #15824

Merged
bolichen97 merged 2 commits into
release/0.8.0from
backport/0.8.0-cli-spawn-host-identity
Oct 1, 2026
Merged

bolichen97 merged 2 commits into
release/0.8.0from
backport/0.8.0-cli-spawn-host-identity

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: kirocrew spawn run starts a subagent on 0.8.x instead of always failing with 409.

Backport of #15593 to release/0.8.0. On 0.8.0rc1 every kirocrew spawn run returns 409 member_identity_unavailable, because api_spawn claims the body default "" while the CLI's verified scope has session=None.

Why it matters

On 0.8.x the CLI cannot start a subagent at all, which breaks headless and scripted use.

Not a goal

What changed (motivation → approach → change)

  • Cherry-picks of fix(spawn): admit the host operator's cli spawn without a session #15593's two commits (git cherry-pick -x equivalent, applied cleanly with no conflicts).
  • api_spawn claims no session only for the host operator's CLI: no X-Session-Key, no parent_session, no X-Internal-Caller, and a host peer process (local_owner_bootstrap_allowed). Every other parentless internal request keeps its 409.

Backwards compatibility

Compatible: it only admits the host CLI request that 0.8.0rc1 always refused.

Tests

test/test_member_memory_api.py passes on this branch (169 passed), including the admitted host-CLI case and the three refusal cases (non-host peer, session-unbound MCP caller, session key without parent). Gate results are in the PR comment.

Manual verification

Not run against a live 0.8 gateway.

Related Issues

Backport of #15593.

Pattern harvest

Rule candidate: none

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) — subagent.md § CLI, carried by the cherry-pick
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

koenvincent and others added 2 commits October 1, 2026 09:40
The CLI posts /api/spawn with the internal secret but no X-Session-Key and no
parent_session. member_request_scope verifies that caller as Global with
session=None, but api_spawn compared it against the body default "", so every
CLI spawn was refused 409 member_identity_unavailable. On a headless gateway
that made kirocrew spawn run unusable.

When neither the header nor parent_session is present, claim no session. A
non-empty parent, or a caller that has a session, keeps the exact-match check,
so a header-less caller still cannot borrow a private parent.
The CLI exemption admitted any internal request with no X-Session-Key
and no parent_session. Two other callers send that shape. A pooled MCP
stdio server that lost its session sends it, and so does an agent's own
shell running kirocrew spawn run with the readable .local_secret. Either
would put a crew member's or an incognito parent's child on Global
memory at persistent, which the 409 existed to refuse.

The exemption now also needs X-Internal-Caller absent, which every MCP
stdio server sets, and a host peer process. The host check is the
provenance the local owner-token bootstrap uses, so a sandboxed shell
fails it. Every other parentless internal request keeps its 409
member_identity_unavailable.

Tests pin each clause: a non-host peer, a session-unbound MCP caller
and a caller with a session key but no parent all stay refused.
subagent.md documents the predicate and the sandbox-off residual.
@bolichen97
bolichen97 requested a review from a team as a code owner October 1, 2026 10:52
@bolichen97
bolichen97 requested review from cruisercohen and removed request for a team October 1, 2026 10:52
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — 🟡 CONCERNS

Design-level review of da063252ec561477a7c2dfd8ef96500f1c7d7494 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

Source PR #15593 is still open and unreviewed on main; this "backport" ships a security-sensitive admission exemption main has not yet accepted.

Watch

  • The description says "Backport of fix(spawn): admit the host operator's cli spawn without a session #15593... cherry-picked unchanged," but fix(spawn): admit the host operator's cli spawn without a session #15593 is OPEN with reviewDecision: REVIEW_REQUIRED. If main's review tightens _is_host_cli_spawn (an admission exemption on a governance-adjacent 409), release/0.8.0 silently carries a looser predicate than main ever approved, with no tracking that they diverged.
    Clears when: fix(spawn): admit the host operator's cli spawn without a session #15593 merges to main unchanged before this lands, or this PR is held and re-cherry-picked from the merged commits.
  • "Manual verification: Not run against a live 0.8 gateway" — the PR's entire goal ("kirocrew spawn run starts a subagent on 0.8.x") rests on local_owner_bootstrap_allowed returning True for the real CLI's connection, which every new test mocks (_host_process(monkeypatch, ...)). If the real peer-PID resolution fails for the CLI's actual socket shape, 0.8.0 ships still returning 409 and the release notes claim a fix that doesn't work. Low regression risk (the path is already always-broken), but the success claim is unverified.
    Clears when: a live kirocrew spawn run against an isolated 0.8 gateway returns 200 (per docs/guides/worktree-verification-recipes.md), pasted in a PR comment.

[DESIGN-REVIEWED] da06325

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of da063252ec561477a7c2dfd8ef96500f1c7d7494 — 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/CONCERNS are advisory.

First-Principles-Verdict: PASS

Description says "Manual verification: Not run against a live 0.8 gateway" — confirm the admitted CLI spawn on a real 0.8 gateway, since all tests mock local_owner_bootstrap_allowed.

What this change ships

Inventory (3 items) — 2 justified

Intent: FIX — backport #15593 so kirocrew spawn run on 0.8.x starts a subagent instead of always returning 409.

  1. kirocrew spawn run without a session now starts a subagent on 0.8.x; sandboxed shells, named MCP callers and session-bearing callers keep their 409 — justified
  2. subagent.md documents which caller shape is admitted session-less — justified
  3. Test helpers make_request/request accept extra_headers — rides along (test-only, serves the fix's own refusal tests)

[FIRST-PRINCIPLES-REVIEWED] da06325

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — 🔴 changes requested (blocking)

GPT 5.6 found at least one blocking issue that must be resolved before merging da063252ec561477a7c2dfd8ef96500f1c7d7494. 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/dashboard/handlers/messaging.py:661 -- Host CLI spawn bypasses the host governance profile (origin: validation)

claimed_session=None if host_cli else parent_session
Host CLI request → empty parent_session_key reaches _vet_spawn_governance → surface:host spawn denial is skipped and the child starts.
Anchor: residual/security
Fix: Evaluate host CLI spawn governance with HOST_SESSION_KEY while preserving an empty parent key for ownership.
[BLOCK-MERGE] da06325
[GPT-REVIEWED] da06325

Adjudication (Opus 5) — is blocking on each finding proportionate?

F1 — harm rung UNBOUNDED (profile half of POLICY ∩ PROFILE bypassed). Confirmed: messaging.py:659-662 admits a parentless internal request whose peer is a host process (messaging.py:427-436) and still forwards parent_session_key="" at messaging.py:782, which subagent_manager/admission/gate.py:476 hands to _vet_spawn_governance (subagent.py:509-519); with "" the key resolves to a non-host surface and no bound profile (governance_profiles.py:1370, 1406-1425, _UNATTENDED_SURFACES at :199), so a surface:host profile denying capabilities.spawn is silently skipped — the exact mechanic docs/system-specs/modules/governance.md:3099-3104 calls load-bearing. No recovery path: the child starts and the skipped denial is never re-evaluated; the rarity argument also fails, since the PR's own doc (docs/system-specs/modules/subagent.md:1816-1818) states an agent's shell with the sandbox off is indistinguishable from the operator's CLI, making the combination reachable by the governed agent itself rather than only by the operator.

[ADJUDICATION] da063252ec561477a7c2dfd8ef96500f1c7d7494 total=0 uphold=0 downgrade=0
[GPT-ADJUDICATED] da063252ec561477a7c2dfd8ef96500f1c7d7494

[ADJUDICATION-FENCED] da063252ec561477a7c2dfd8ef96500f1c7d7494 fenced=1 flagged=0
UPHOLD-FENCED F1 src/kiro_crew/dashboard/handlers/messaging.py:661 -- The newly admitted parentless spawn carries an empty session key into `_vet_spawn_governance`, which resolves to no bound profile and silently drops a `surface:host` spawn denial, and the PR's own doc concedes an unsandboxed agent shell is indistinguishable from the operator's CLI, so the bypass is reachable by the governed agent itself.
[GPT-ADJUDICATED-FENCED] da063252ec561477a7c2dfd8ef96500f1c7d7494

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

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] da06325

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

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

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 1, 2026
@bolichen97
bolichen97 merged commit b8421fe into release/0.8.0 Oct 1, 2026
20 of 22 checks passed
@bolichen97
bolichen97 deleted the backport/0.8.0-cli-spawn-host-identity branch October 1, 2026 20:02
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 1, 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