Skip to content

fix(kas): enter a Crew-owned KAS spawn through kiro-cli-chat - #14982

Merged
bolichen97 merged 1 commit into
mainfrom
fix/kas-spawn-kiro-cli-chat
Sep 29, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/kas-spawn-kiro-cli-chat

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A user who signed in through Kiro Crew's own Kiro sign-in can chat on the KAS backend even when kiro-cli itself is signed out.

Bug fix. After a successful Kiro Crew sign-in (Crew's vault holds the identity), the first KAS session on a pip / Docker / Linux install still died with kiro-cli's own error: You are not logged in, please log in with kiro-cli login. The Crew-owned spawn — the mode that exists precisely so kiro-cli need not be signed in — never reached the engine.

Root cause: the POSIX kiro-cli is the q_cli launcher (install / update / doctor / login / shell completion). For chat and acp it execs kiro-cli-chat, but only after checking its own sign-in, with or without --auth-method cli. So kiro-cli acp --agent-engine v3 exits 1 at the launcher and _kiro/auth/getAccessToken is never sent. kiro-cli-chat acp --agent-engine v3 has no such gate and starts KAS in --auth=acp-callback.

Why it matters

Every non-desktop install (pip, Docker image, Linux install.sh, macOS Kiro CLI.app resolved from PATH) that relies on Kiro Crew's own sign-in is broken until the user also runs kiro-cli login — which defeats the feature and, for org SSO users, means two sign-ins for one identity. The desktop app is unaffected only because its bundle already enters through kiro-cli-chat.

Not a goal

  • Changing kiro-cli: the launcher gate is theirs; reported separately. This PR routes around it and becomes a no-op once they lift it.
  • Touching the cli-owned spawn (--auth-method cli): it needs kiro-cli signed in anyway.
  • The dashboard readiness gate, which still keys on kiro-cli's whoami (returning users are unaffected: the turn is the authority).
  • Any change to how the binary is discovered, trusted or pinned.

What changed (motivation → approach → change)

Motivation: the Crew-owned spawn must not pass through a process that refuses to run without kiro-cli's sign-in.
Approach: enter through the chat binary the launcher would have exec'd anyway — the same choice the desktop bundle already makes (BUNDLED_KIRO_CLI_ENTRY) — and only where that binary provably sits beside the resolved launcher.

  • kiro_cli.chat_sibling(binary, platform_name=None): the executable, non-empty kiro-cli-chat in the same directory as a binary named kiro-cli, else None. Pure stat. None on Windows (the MSI ships one kiro-cli.exe that IS the chat-cli crate — no launcher, verified by extracting 2.25.0), for any other name (the bundled entry is already the chat binary), for an empty file (ENOEXEC would fail louder than the launcher), and when no sibling exists. The directory is the resolved path's own, never its realpath, per the launch-in-place rule.
  • acp/harness/kas.py: on the Crew-owned branch only, swap the resolved binary for the sibling when there is one, except when the resolved binary is the operator's KIROCREW_KIRO_BIN (their wrapper is exactly what they asked for). The log line names the binary chosen. The cli-owned branch is untouched.
  • Spec: kas-auth.md status paragraph; acp-client.md resolver paragraph.

Evidence (kiro-cli 2.25.0, Debian container, kiro-cli signed out, IdC identity in Crew's vault):

Command Result
kiro-cli acp --agent-engine v3 (no --auth-method) error: You are not logged in, please log in with kiro-cli login, rc=1
kiro-cli-chat acp --agent-engine v3 [INFO] Auth: --auth=acp-callback (host-mediated refresh via _kiro/auth/getAccessToken)
kirocrew chat -m "Reply with exactly the word PONG" on main AcpAuthRequired: Not signed in to Kiro
same, with this change, no KIROCREW_KIRO_BIN PONG

The gate lives in the launcher (source paths crates/q_cli/... in that binary), not in kiro-team/kiro-cli's chat-cli crate, whose execute_kas_acp maps a missing --auth-method to RelayAuth::Client correctly.

Backwards compatibility

Nothing is rejected, renamed or removed. Every miss (Windows, operator override, bundled entry, no sibling, empty sibling, cli-owned spawn) leaves the argv exactly as main builds it.

Install Resolved Effect
Linux install.sh, Docker image (/usr/local/bin) kiro-cli + kiro-cli-chat side by side swapped on the Crew-owned branch
macOS Kiro CLI.app/Contents/MacOS/ same layout swapped on the Crew-owned branch
Desktop app bundle already kiro-cli-chat unchanged
Windows kiro-cli.exe no launcher exists unchanged
Wrapper directory shipping only kiro-cli no sibling unchanged
KIROCREW_KIRO_BIN never swapped unchanged

Tests

test/test_kas_spawn_chat_sibling.py:

  • chat_sibling: sibling found; launcher alone; non-executable sibling (POSIX-only); empty executable sibling; names other than kiro-cli; win32; empty input; symlinked launcher keeps its own directory (requires_symlinks).
  • Harness plan (with chat_sibling stubbed so the plumbing is asserted on every CI host): Crew-owned swaps and drops --auth-method; cli-owned keeps the launcher, keeps the flag, and never consults the sibling; no sibling keeps the resolved binary; KIROCREW_KIRO_BIN naming the launcher is never swapped; an override naming a different binary does not pin this one.

Ran locally with test_acp_harness_contract.py and test_kas_spawn.py: 146 passed. black / isort / flake8 / mypy clean on the changed files.

Manual verification

Container built from this branch (python:3.12-slim-trixie + kiro-cli 2.25.0 from the release manifest), agent.acp_backend=kas, kiro-cli signed out, Crew vault signed in via IdC device code: kirocrew chat -m ... returns the model's reply; kirocrew doctor shows auth owner: Kiro Crew vault. Same container on main: AcpAuthRequired. Windows: MSI 2.25.0 extracted with msitools — one file, LocalApp/Kiro-Cli/kiro-cli.exe, whose embedded source paths are crates\chat-cli\... with no q_cli, so no launcher gate exists there.

Screenshots / video

Not applicable — no user-visible UI change.

Related Issues

None filed; root-caused in a Kiro Crew maintainer session on 2026-09-29.

Pattern harvest

Not generalizable: the defect is one upstream launcher's sign-in gate applied to a subcommand that delegates auth to its caller. The one general lesson is already encoded in BUNDLED_KIRO_CLI_ENTRY's comment (enter through the chat binary), and this PR extends that rule to the one remaining path that still went through the launcher.

Checklist

  • One logical change, one commit
  • Owning specs updated in the same commit (kas-auth.md, acp-client.md)
  • No model id hardcoded, no new markdown files
  • Verified on Linux; Windows layout verified from the shipped MSI; macOS by layout

@CrysisDeu
CrysisDeu requested a review from a team as a code owner September 29, 2026 08:12
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

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

Design-Verdict: PASS

Verify a fresh non-desktop dashboard sign-in reaches chat past the whoami-keyed readiness gate — the fix was proven manually only via kirocrew chat.

[DESIGN-REVIEWED] a6c21a8

Description read

[DESCRIPTION-READ] 07e459c5397d7be0449577b51341a00a49097dbab6bc67716cd1735fa556734b

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 Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of a6c21a8d7351e5f28fd5a4d76fe8b64bf9e4073c and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] a6c21a8

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

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

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

Verify the diff's non-KAS hunks are main's already-merged #14896 riding a stale base — a rebase should leave only the KAS commit.

Not justified as shipped

What this change ships

Inventory (6 items) — 5 justified

Intent: FIX — a user signed in through Kiro Crew's own vault can chat on the KAS backend even when kiro-cli itself is signed out. Defect provenance is checkable: a reproduction table in the description and test_crew_owned_spawn_enters_through_the_chat_binary, which fails on base. Cause (the upstream launcher's sign-in gate) is out of Crew's scope and the description says so and names what remains; every miss (Windows, override, no sibling, cli-owned) leaves the argv as main builds it, so wrong platform premises fail back to today's behavior rather than denying use.

  1. Crew-owned KAS session starts instead of dying "You are not logged in" on pip/Docker/Linux/macOS-PATH installs — justified
  2. A KIROCREW_KIRO_BIN wrapper named kiro-cli is never swapped out from under the operator — justified
  3. The spawn log line now names the binary entered through — justified
  4. New public helper kiro_cli.chat_sibling (1 real consumer, acp/harness/kas.py; grepped chat_sibling, 5 files = consumer + definition + tests + 2 specs) — justified
  5. kas-auth.md and acp-client.md paragraphs updated in the same commit — justified
  6. Glass search dock over the session and crew lists, with its tests and capture harness — rides along: identical to main's merged feat(ui): glass search field floating over the session and crew lists #14896 (48b040c); stale diff base, net-zero at merge

[FIRST-PRINCIPLES-REVIEWED] a6c21a8

Description read

[DESCRIPTION-READ] 7c0cf18739e88735f2bc519c20f7cc77a3e85ef4989f97f5cb161b82f9da4d8d

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 Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

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

Review details

Nothing blocks; one advisory: the KAS doctor line now reports a relay argv the runtime will not spawn.

FINDING — src/kiro_crew/cli_doctor.py:1524 — with agent.acp_backend="kas", a Crew-held vault identity and the upstream POSIX layout (kiro-cli + kiro-cli-chat side by side), _report_kas_backend prints ' '.join(build_kas_argv(binary, host_auth=host_auth)) over binary = resolve_kiro_cli(), so the relay: row shows …/kiro-cli acp --agent-engine v3 while KasHarness.resolve_spawn now swaps in chat_sibling(kas_bin) and actually spawns …/kiro-cli-chat … — the doctor advertises exactly the launcher + no---auth-method cli combination the diff exists to avoid, and its output is byte-identical whether the swap applied or silently declined (no sibling / zero-byte) → Fix: in _report_kas_backend, apply kiro_cli.chat_sibling (guarded by the same KIROCREW_KIRO_BIN exemption) to binary before build_kas_argv on the host_auth branch, so both callers render one decision.

[OPUS-REVIEWED] a6c21a8

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable a6c21a8d7351e5f28fd5a4d76fe8b64bf9e4073c: <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 Sep 29, 2026
The POSIX `kiro-cli` is the q_cli launcher. It checks its OWN sign-in
before it execs `kiro-cli-chat` for `acp`, with or without
`--auth-method cli`. A Crew-owned KAS spawn exists for the host where
kiro-cli is signed out (Crew's vault holds the identity), so through the
launcher it exited "You are not logged in" and the engine never asked
Crew for the credential. Measured on kiro-cli 2.25.0 in a container
with kiro-cli signed out and an IdC identity in Crew's vault: the
launcher exits 1; `kiro-cli-chat acp --agent-engine v3` starts KAS in
`--auth=acp-callback` and the turn completes.

`kiro_cli.chat_sibling` returns the executable, non-empty
`kiro-cli-chat` in the same directory as a resolved `kiro-cli`, or
None. The KAS harness consults it on the Crew-owned branch only and
never for an explicit KIROCREW_KIRO_BIN; the cli-owned spawn keeps the
launcher, since it needs kiro-cli signed in anyway. Every miss
(Windows, whose one kiro-cli.exe is the chat-cli crate itself; operator
override; bundled entry; no or empty sibling) leaves the resolved
binary as it was, which is today's behaviour. The desktop bundle
already enters through the chat binary for the same reason.
@CrysisDeu
CrysisDeu force-pushed the fix/kas-spawn-kiro-cli-chat branch from 23765fc to a6c21a8 Compare September 29, 2026 08:55
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ✅ PASS

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

UX-Verdict: PASS

Verify the deferred dashboard readiness gate (kiro-cli whoami) doesn't still tell a Crew-signed-in first-run user to log in after chat now works.

The diff changes no user-visible control — backend spawn selection, a path helper, specs, tests; the only string change is an operator log line — so the absent screenshots are not an evidence gap.

[UX-REVIEWED] a6c21a8

Description read

[DESCRIPTION-READ] fb15b6d94e3d8de90736cd7e8965d61d10e7bf4a45ede95f88ec6537fa2ff1dd

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 added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 29, 2026

@bolichen97 bolichen97 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 on behalf of the maintainers (sweep 2026-09-29): readiness passed, required checks green on a6c21a8, no blocking review threads, security posture unchanged. Approving and merging.

@bolichen97
bolichen97 merged commit a0d4316 into main Sep 29, 2026
142 of 143 checks passed
@bolichen97
bolichen97 deleted the fix/kas-spawn-kiro-cli-chat branch September 29, 2026 16:56
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 29, 2026
bolichen97 added a commit that referenced this pull request Oct 6, 2026
…release/0.8.0) (#17271)

Backport of #16131, #16700 and #17250 to release/0.8.0, plus the
kiro_cli.chat_sibling helper #16131 calls (from #14982; only the helper,
not #14982's KAS spawn change).

- #16131: ASBX_KIRO_MANDATORY_MCPS no longer pins every Crew-owned MCP
  server resident. They defer under Tool Search when the spawn runs the
  pinned kiro-cli (or its chat sibling) at >= 2.27.0; any other binary or
  version keeps them resident. An operator's ambient value still wins.
- #16700: a deferred call's rawInput is {"tool_id", "arguments"}; the
  directive consumer now digests the arguments, so monitor_start,
  monitor_update and autonudge_stop claim their parked record instead of
  being dropped with CLAIM MISS input-differs.
- #17250: the bundled kiro-cli moves from 2.24.0 to 2.27.1, without which
  the >= 2.27.0 gate never opens on a desktop install.
- chat_sibling: without it mandatory_mcps_drop_allowed raises NameError,
  which it swallows, so deferral would silently never apply on this branch.

(cherry picked from commits af16284, af2619f, 9348a25)
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