Repository navigation
feat: remote crew sign-in via Crew's vault on the KAS bundle route - #23657
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the bundle-route box chooses its own sign-in program, the relay route still runs the same kiro-cli commands in the Notes
[DESIGN-REVIEWED] f0bf3f9 Description read[DESCRIPTION-READ] 37a539c75056290cb7d15841af906c66fc88d3977207f4d479b81e1cd6e3cf10 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Each item fixes a defect on the bundle route, where kiro-cli is not installed. Nothing changes a default. The extra sign-out fence and the duplicated route and account-type spellings are notes. Notes
What this change shipsInventory (10 items) — 8 justifiedIntent: sign a remote crew on the KAS bundle route in and out, and read who it is signed in as, through Crew's vault without kiro-cli. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] f0bf3f9 Description read[DESCRIPTION-READ] 703262e57ccc643b41400cb7ceda824a4d46aba5e7caaff9a302b51407810563 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
3c7bd0c to
f08b7eb
Compare
f08b7eb to
77e2887
Compare
2c10142 to
aa6be00
Compare
aa6be00 to
16dbdc6
Compare
16dbdc6 to
d7c215f
Compare
fb4a2dc to
a1942e2
Compare
On the KAS bundle route (agent.acp_backend kas with agent.kas_bundle on) the engine's only credential is Crew's own vault and kiro-cli is not installed, yet two remote sign-in surfaces still drove kiro-cli on the remote machine: the cloud instance sign-in over SSM and the aws_control crew container's kiro-cli store seed. The box now decides which program owns the sign-in. New verbs `kirocrew kas login | whoami | logout | route` drive KasLoginService from a shell in kiro-cli's own vocabulary (the device prompt lines, the `whoami --format json` document, the exit codes), and every remote script `kirocrew cloud login|logout` runs asks the box's `kirocrew kas route` before choosing its branch; only the exact answer `kas-bundle` takes the vault verbs, every other answer (an older Kiro Crew included) runs the kiro-cli commands it always ran. The local reading of an identity shares one parser for both, and an OIDC sign-in records its start URL so an Identity Center vault identity can be matched to its organisation. The launching machine's own identity is read from its vault when it runs the bundle route. The container supervisor decides after writing the backend config: on the bundle route it skips kiro-cli's sentinel store seed and requires the installed engine instead; elsewhere the seed runs as before. Builder ID device authorization through the vault was run against the live issuer up to the device prompt; the approval half needs a human and is recorded as not yet validated. Refs #21843
a1942e2 to
f0bf3f9
Compare
|
@iamwhatever re-review requested for head f0bf3f9: PR Readiness passed, Design / First Principles / GPT / Opus all PASS; every r124 ask is addressed above (issue #23856 linked; |
|
Reply to the First Principles note on the third spelling of the bundle-route predicate ( |
|
Hold for maintainer review. Reviewed at The r124 asks are met. #23856 tracks the This PR changes sign-in, sign-out, credential storage and the container's sign-in program, and it adds a Three notes on this head have no reply yet:
The red — crew-pr-reviewer (r125) |
Problem / Motivation
Goal: A remote crew (an EC2 instance signed in by
kirocrew cloud login, or the aws_control crew container) that runs the KAS bundle route can be signed in, show who it is signed in as, and sign out through Crew's own vault, with no kiro-cli on the remote machine, while every other route keeps its kiro-cli sign-in exactly as before.On the KAS bundle route (
agent.acp_backend: kaswithagent.kas_bundle: true) the engine's only credential is Crew's own vault and kiro-cli is not installed (#21843). Two remote sign-in surfaces still drove kiro-cli on the remote machine:kirocrew cloud login|logoutand the launch wizard rankiro-cli login,kiro-cli whoami --format jsonandkiro-cli logouton the instance over SSM. On a bundle-route instance every one of those is "command not found": the box cannot be signed in, its identity cannot be read, and the launching machine's own identity (discover_local_identity) also came fromkiro-cli whoami.kiro-cli whoamito accept it before every start. On a bundle-route task there is no kiro-cli to ask, so the task refuses to start.Why it matters
The bundle route is the no-kiro-cli install that lets the desktop app drop the bundled
kiro-cli-chat(#21843). Until a remote crew can sign in through the vault, turning the route on by default would leave every cloud instance and every crew container with a chat backend nobody can sign in. The relay route must keep working unchanged, because that is what every remote crew runs today.Not a goal
kirocrew doctor(feat(doctor): report the KAS bundle engine instead of probing kiro-cli #23617) and the model picker (feat(models): serve the KAS bundle picker from the engine model select #23618): other items of KAS bundle route by default: replace the remaining kiro-cli calls (whoami, list-models, update, doctor) so the desktop app can drop the bundled kiro-cli-chat #21843. This PR adds its own smallauth/whoami.pymapping; it can collapse onto feat: name the signed-in account from Crew's vault on the KAS route #23615'saccount_type_from_claimsonce both are on main.agent.kas_bundleto default-on, or the live validation of the approval half of Builder ID / IdC / External IdP sign-in (recorded as open inkas-auth.md).cloud/login.pytoday, now inside theelsebranch.What changed (motivation → approach → change)
The local
kirocrew cloudcommand cannot read the remote config (it lives in the instance'sconfig.json), so the box decides which program owns the sign-in.New verbs
kirocrew kas login | whoami | logout | route(cli_kas_login.py) drive the existingKasLoginServicefrom a shell in kiro-cli's vocabulary:loginprintsOpen <URL>andcode: XXXX-XXXX, polls until approved, exits 0 once the vault holds the credential (already signed inover a usable identity);whoami --format jsonprints thekiro-cli whoamidocument (accountType,startUrl; never a token or e-mail), exit 1 when signed out;logoutempties the vault;routeprintskas-bundleorkiro-cli, and reports an unreadable config as an error (exit 1), never askiro-cli.Every remote script in
cloud/login.pysplices incloud/login_vault.py's prelude, which runs the box's ownkirocrew kas route. Only the exact answerkas-bundletakes the vault branch; any other answer runs the kiro-cli commands the scripts always ran. A box with neither program (no kiro-cli, probe notkas-bundle) gets a plain-language refusal with the probe's own error and the remedy, notkiro-cli: command not found. Both branches share one log, capture loop and parsers; a failed vault sign-in never degrades into kiro-cli's callback flow; cancel and replace stop both patterns; the vault logout kills no engine process (the pre-turn identity-change check retires them).An OIDC sign-in records its start URL on the token and every refresh keeps it, so an Identity Center vault identity matches its organisation for the life of the sign-in.
whoami/logintreat a refresh-rejected slot as signed out, as doctor and the card do. Becausekas logoutis a second process over the gateway's vault, the store carries a sign-out generation under a store-wide flock: every sign-out bumps it, every login compares it before it saves (and its account-switch deletions) under the same lock; the poll handler answers that refusal as the begin's 409.discover_local_identityreads the launching machine's vault on the bundle route. TheaccountTypemapping inauth/whoami.pyduplicates #23615's; collapsing them is #23856. The bundle-route predicate's single spelling across the codebase is #23858.The container supervisor decides after
write_backend_config: on the bundle route it skips the kiro-cli store seed (the gateway's readiness gate names a missing engine per turn); elsewhere the seed runs as before.Wiring and wording:
cli_kas.pymounts the verbs;cli_parser_gateway.pylists them;cli_cloud.py,cli_parser_admin.py,cloud/wizard.pysay "Kiro" instead of "kiro-cli";dashboard/handlers/kas_login.pymaps the poll's sign-out code to 409.Backwards compatibility
Compatible: the kiro-cli route's remote commands are unchanged inside the
elsebranch, a box without the new verb answers empty and takes that branch,kirocrew kaskeepsinstall|status|remove, andKasToken.extraalready round-trips unknown keys.Removes nothing: every path, key and function on main stays; the container's kiro-cli seed still runs on every config that does not turn the bundle route on.
Tests
test/test_cli_kas_login.py: the parser;routespells the constant the remote scripts compare against;whoamiexit codes and a JSON that parses throughparse_whoami_output;logoutempties every slot;loginprints a promptparse_login_outputreads, forwards IdC start URL and region, answersalready signed inover a usable identity, names a lapsed slot as the one it replaces, and reports expiry / store failure with exit 1. The login service is faked at its class seam.test/test_cloud_login_vault.py: every remote script asks the box for its route, the vault verb is theifbranch and the kiro-cli verb theelse, the vault launch is one shape per target with shell-quoted flags, the callback script refuses on the vault route, cancel/replace stop both patterns; the local side reads a vault prompt like a kiro-cli one, never falls back to the callback flow on the vault route, and reads a vaultwhoamidocument as the remote identity;discover_local_identityon the bundle route. Then the generated scripts run under bash against stubkirocrew/kiro-cliprograms, one isolated HOME per route (kas-bundle,kiro-cli, empty), asserting which program the box ran and the shared sentinels; a box with no kiro-cli whosekas routefails produces the readable refusal, and the local side reads it as unknown.kas routeon an unreadable config prints the error and exits 1.test/test_kas_login_signout_generation.py: two services over one store (the gateway and a shell): a sign-out in one refuses the other's pending login at persist time withsigned_out_during_loginand leaves the vault empty; a login with no sign-out in between persists; every sign-out moves the generation; a refresh keeps the recorded start URL; a refresh-rejected slot reads as signed out.test/test_kas_auth_whoami.py: theaccountTypespelling per slot, the document's parse and target match for Builder ID and Identity Center, no e-mail and no secret in it,resolve_signed_inis the usable predicate,vault_owns_sign_inis positive on both halves, and the service records the start URL on Builder ID and IdC sign-ins.container_tests/test_supervisor_kiro_login.pyandtest_supervisor_main.py:kas_bundle_routereads the written config and is positive on both halves (unreadable or absent config = relay route);run()seeds kiro-cli's store after the config is written and before the backend, and skips the seed on the bundle route while the backend still starts.Determinism and side effects: no sleeps, no clocks beyond fixed dates, no ports; the bash tests run foreground scripts only with a controlled
HOME/PATHwhose first entry shadowskirocrew,kiro-cli,pkillandpgrepwith logging stubs, so no real process or store is reached and no background login is started.Manual verification
bash -nand were driven end to end against stubkirocrewandkiro-cliprograms in three isolated HOMEs: withkas routeansweringkas-bundlethe box rankirocrew kas whoami,kirocrew kas login [--provider idc --start-url … --region …],kirocrew kas logoutand refused the callback flow; answeringkiro-clior nothing, it rankiro-cli whoami,kiro-cli login --use-device-flow […],kiro-cli login(callback) andkiro-cli logout, with the same sentinels on the local side.kirocrew kas routeprintedkiro-clion a default config andkas-bundlewith{"agent": {"acp_backend": "kas", "kas_bundle": true}};kas whoami --format jsonexited 1 signed out;kas logoutwas a clean no-op signed out.kirocrew kas login --provider builder_idin an isolatedKIROCREW_HOMEcompletedRegisterClientandStartDeviceAuthorizationagainstoidc.us-east-1.amazonaws.comand printed the verification URL and user code, then was killed after 20 s with nobody approving. The approval half (CreateToken) needs a human's own Builder ID and was not run;kas-auth.md§ Validation status says so.Screenshots / video
N/A — CLI and remote-script change, no dashboard surface.
Related Issues
Part of #21843
Refs #21843 #15373 #23856 #23858
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)