Skip to content

feat(pod): a pod's bundled KAS engine can use the host's Crew sign-in - #43525

Open
iamwhatever wants to merge 1 commit into
mainfrom
feat/pod-host-token-broker
Open

iamwhatever wants to merge 1 commit into
mainfrom
feat/pod-host-token-broker

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A test pod whose KAS runs on Kiro Crew's own engine can sign in with the host's Kiro Crew sign-in, without a separate sign-in inside the pod and without the pod ever holding a refresh token.

A pod has its own data home, so its Crew vault starts empty. The bundled KAS route only takes Kiro Crew's own sign-in, so every new pod on that route needs its own kirocrew kas login with that pod's KIROCREW_HOME before it can run a chat. That blocks automated pod testing of the bundle route.

Why it matters

Pods are how changes are tested end to end before they ship, and more of them now run the bundle route. A sign-in per pod means a person has to act before every automated test run. Lending short-lived access tokens from the host removes that step and keeps the long-lived credential on the host.

Not a goal

  • The relay (kiro-cli) route. A pod whose KAS runs through kiro-cli signs in exactly as before, preview or not. _stage_runtime_auth_store stays, because that route still reads kiro-cli's own store.
  • Closing Pod-scoped sign-in: eliminate the staged-store shell-read residual #9211. This implements the bundle part of its second option only; the staged kiro-cli store it tracks is unchanged.
  • Changing pod up / pod down, the Dev Fleet pod tools or the sign-in hints.

What changed (motivation → approach → change)

Approach: the host recognises the pod by its process, not a secret, so nothing is written into the pod.

  • Preview pod_host_sign_in ("Let Dev Fleet test machines use this computer's sign-in", under Publishing and Sign-in), default off, off on LTS (edition_locks.preview_on): src/kiro_crew/config/sections_dashboard.py, the row in website/src/pages/settings/FeaturePreviewsSection.tsx, website/src/utils/previewFlags.ts, strings in website/src/i18n/locales/ (13 locales, en-XA regenerated), search words in website/src/components/commandPalette/settingsKeywords.ts with settingsRegistry.gen.ts regenerated, plus the regenerated config-baseline.json, settings registry, find_ui index, configuration.md and a row in docs/feature-map/README.md.

  • Host routes (dashboard/handlers/pod_host_sign_in.py): POST /api/pods/host-sign-in/token and POST /api/pods/host-sign-in/refused. Token auth lets them through only while the preview is on (token_auth_paths._exact_method_bypass, the same shape as the connector socket). Each request is then checked, fail closed:

    1. preview on, and this gateway is not itself a pod;
    2. it arrived on this gateway's own dashboard unix socket (never TCP, never the agent socket) from a peer the kernel reports as this user;
    3. an enabled app holds the owner's grant for these routes (apps.core_route_grants.core_route_grant, app-agnostic);
    4. the peer's SO_PEERCRED pid is the named pod unit's MainPID (the unit execs the pod gateway), stable across the check, and it shares the host gateway's namespaces on Linux or runs unsandboxed on macOS, so a sandboxed shell inside the pod is refused and a stopped pod has no main process;
    5. a rate limit per kernel-attested peer pid and route, counted before checks 3 and 4, in the dashboard's shared limiter (dashboard/create_rate_limit.py, 30 per 5-minute window).

    Every decision is audited. The answer comes from the host's Crew vault only (answer_from_vault, via the new src/kiro_crew/agent_sdk/kas_vault_answer.py seam), never a workload identity, kiro-cli's sign-in or an API key, and is cut to accessToken, expiresAt, profileArn, provider, authMethod. No refresh token, client secret or other field leaves; renewal stays on the host. A company (edition) sign-in on the host is never lent: 403 host_sign_in_not_lendable, the same refusal a local agent gets (stored_sign_in_registered). No host sign-in: 409 host_not_signed_in, shown in the pod as "run kirocrew kas login on the host". /refused answers sign_in_refused for a lent token.

  • Pod side (src/kiro_crew/pod_host_sign_in.py): active() is true in a pod given the host socket in KIROCREW_POD_HOST_SIGN_IN_SOCKET; it posts over that unix socket only and refuses a listener that is not this user.

  • Bundle-route readiness and models. With an empty pod vault and the host socket, kas_crew_signin_ready in src/kiro_crew/dashboard/kiro_readiness.py asks the host for a token instead of refusing, _vault_signed_in in src/kiro_crew/dashboard/handlers/models_kas_bundle.py counts the borrowed sign-in, and vault_identity in src/kiro_crew/agent_sdk/kas_model_catalog.py keys the model catalog by the host socket.

  • Bundle only. In src/kiro_crew/acp/kas_host_auth.py, answer_get_access_token and sign_in_refused ask the host only for a bundle engine whose pod vault is empty; the pod's own sign-in wins. src/kiro_crew/acp/harness/kas.py and src/kiro_crew/acp/runtime_session_load.py pass bundle from the runtime's spawn route. _crew_holds_usable_sign_in in src/kiro_crew/acp/kas_route.py counts the lent sign-in, as it counts a workload identity, so the bundle route can be chosen; the relay shortcut in crew_sign_in_starts_spawn and vault_holds_identity stay vault-only.

  • Wiring. kirocrew pod up (src/kiro_crew/pod/cli.py) records the host's data home as HOST_HOME in the pod's env file (pod_host_sign_in.host_home_for_pod; empty when pod up runs inside a pod). The pod unit boots with a clean environment, so the boot (src/kiro_crew/pod/runtime_boot.py) passes that value to build_pod_env in src/kiro_crew/pod/runtime.py, which calls pod_host_sign_in.apply_to_pod_env. It drops any inherited KIROCREW_POD_HOST_SIGN_IN_SOCKET and sets it to the host gateway's dashboard socket only while the preview is on and Dev Fleet holds the grant in that recorded home (read under config.paths.run_with_data_home, without the loader's write-back, so a pod boot never rewrites the host's config.json). No recorded home gives no socket, so a pod started before this change borrows nothing until its next pod up. pod_context (used by pod exec) drops it again, so only the pod's gateway, the process the host answers, is given the socket. src/kiro_crew/apps/builtins/dev_fleet/app.json declares /api/pods/host-sign-in/* in permissions.api, the grant step 3 reads, so the routes answer only while the owner has Dev Fleet enabled.

Adopted hosts

On a host whose Dev Fleet record was adopted from its own repository, the grant is read from that repository's app.json, not from the wheel copy this PR edits. KiroCrewCaptain/kirocrew-app-dev-fleet#15 added /api/pods/host-sign-in/* there, but this PR does not change the Dev Fleet pin in src/kiro_crew/apps/adoption-pins.json.

So a host that adopted the external Dev Fleet gets 403 app_not_enabled on the host sign-in route until a separate re-pin PR lands. That re-pin waits until the app repository and this repository's wheel copy match again: main moved the live-target cutover into core (#45591), and the app made its own change there, so neither side carries the other's today. The re-pin is a follow-up, not part of this PR. Until then the feature stays behind the default-off pod_host_sign_in preview, and a host on the built-in Dev Fleet works as described above.

App repo: KiroCrewCaptain/kirocrew-app-dev-fleet#15

Backwards compatibility

Compatible: with the preview off (the default, and always on LTS) the two routes meet the ordinary token gate and answer 404, no pod is given the socket, and every sign-in path behaves as on main. The new bundle keyword defaults to False.

Removes nothing: the change adds two routes, a preview and a branch taken only in a pod given the host socket.

Tests

test/test_pod_host_sign_in.py runs the host routes on a real unix socket and dials them with the pod's own client, so peer credentials are the kernel's; only the pod unit's MainPID and the app grant are patched.

  • Only the five keys leave, even when the vault answer offers a refresh token, client secret or more; the pod side cuts to the same five.
  • Another pod's name, a pod that is down, a peer in another namespace, no app grant, a TCP request, a pod unit that cannot be read (macOS launchctl failing): all refused with a code. The rate limit answers 429. Each lend is audited without the token.
  • A company sign-in is refused before the vault is read. A host with no Crew sign-in refuses with 409 and names kirocrew kas login; an ambient KIRO_API_KEY is never lent.
  • Preview off: the host answers 404 and token auth does not let the routes through; an LTS build reads the preview off; a pod with no socket answers as before.
  • Readiness is ready when the host lends and not when it refuses, unchanged outside a pod; /api/models sees the borrowed sign-in; the catalog is keyed by it only when the pod vault is empty.
  • A relay engine never asks the host; the pod's own sign-in wins; the bundle route sees the lent sign-in while vault_holds_identity stays false; /refused goes to the host for a bundle only; the harness passes its spawn route.

Mutation check: 18 mutants (each check above removed or loosened, the key list widened or narrowed) all fail at least one of these tests.

  • Wiring: Dev Fleet's manifest grants both routes; a pod env gets the host socket only with the preview on, never an inherited one, and never from a pod; build_pod_env applies it. A host on its own KIROCREW_HOME lends: pod up records that home, and a boot whose own data home has the preview off still gets the host socket from it and leaves the host's config.json byte-identical; an empty or relative home gives none; a pod records no home for its own pods; the boot hands the env file's HOST_HOME to build_pod_env; pod up writes it. These failed on 3bc731273929 and pass now.

Determinism: 5 runs with -n 2, one with -n 0, and one in reversed order with -n 0: 33 passed each time (before this round's readiness, models and catalog tests; the file now has 50). The shared limiter's buckets are reset around every test by the suite's existing fixture.

Dev Fleet's permission parity data (test/test_dev_fleet_permission_parity.py) lists the new grant. Updated fakes in test_kas_spawn.py, test_acp_harness_contract.py and test_acp_harness_wire_parity.py to take the new keyword. Related tests run with -n 2.

Manual verification

Feature Previews page in a pod of this branch: the new row renders under Publishing and Sign-in, after "MCP sign-in by Kiro Crew", off, its summary saying that test machines from the Dev Fleet app sign in as you so you don't sign in on each one, that their chats count against your plan, and that your long-term sign-in stays on this computer; its hint saying what Dev Fleet is, that machines on the Kiro CLI or with their own sign-in sign in as before, that a company sign-in is never used, and what Off does.

End-to-end with a real host sign-in was not run: this host has no Kiro Crew sign-in, and the live gateway runs main, which has no host routes.

Real-machine verification

Partial. The full lend (host signed in -> pod borrows -> bundle chat answers) was not observed. What was run, on dev-dsk (AL2023, Linux 6.12, x86_64), head 3bc731273929, 2026-12-05:

Step Result
T1: pod pr43525-t1 on this branch, preview pod_host_sign_in on, Dev Fleet enabled (builtin), agent.kas_bundle on up; owner signed its vault in: GET /api/kas-login -> authenticated: true, provider: Enterprise, usable: true; a bundle chat on T1 itself answered
T2 started from inside T1 (T1's pod_up tool), agent.kas_bundle on GET /api/kas-login -> authenticated: false; bundle chat -> Error: KAS runs on Kiro Crew's own engine (agent.kas_bundle is on). Not signed in to Kiro. ...; T1's Security Event Log has no pod.host_sign_in.* row
Why T1 lent nothing the test setup, see the next paragraph. (T1 could not have lent in any case: the host handler answers 404 pod_host_sign_in_off when the gateway is itself a pod, dashboard/handlers/pod_host_sign_in.py:144.)
H: a non-pod gateway on this branch (loopback port 7851), its own data home holding T1's signed-in vault, preview on, Dev Fleet enabled with /api/pods/host-sign-in/* in its grant record up
T2 started from H with kirocrew pod up (seed agent.kas_bundle: true) T2 /api/models -> kas_bundle_sign_in_required; bundle chat -> the same "Not signed in to Kiro" error; H's Security Event Log has no pod.host_sign_in.* row, so no request reached H

Why neither run lent: the socket is chosen by apply_to_pod_env inside build_pod_env, which runs in the pod unit's own kirocrew pod _run (pod/runtime_boot.py:700). systemd starts that process with a clean environment, and neither the template unit nor the per-pod drop-in pins KIROCREW_HOME, so it reads the default data home ~/.kiro/crew. There the preview is off (that config has no pod_host_sign_in), so host_socket_for_pod returns None and the pod is never pointed at H's (or T1's) socket. The provider (Enterprise) and the company-sign-in rule were never reached: no request arrived at either host. So a test host on a custom KIROCREW_HOME cannot be the lender. A host on the default data home, the normal case, reads its own config. The same fact means apply_to_pod_env is not "host side" as its docstring says: it runs under the pod worktree's code and always follows the default data home. The host still checks every request (pod unit main pid, grant, preview), so this was not a bypass, but a host gateway on a non-default KIROCREW_HOME silently never lent. pod up now records the host's data home for the boot (see Wiring), and the rerun below uses a host on its own data home.

Rerun on the fixed head: pending.

Cleanup: both pods down (data reclaimed), test gateway H stopped, its data home and both worktrees removed. The owner's gateway and data home were not touched.

Screenshots / video

Settings > Developer > Feature previews, with the new "Let Dev Fleet test machines use this computer's sign-in" row (off) under Publishing and Sign-in:

Feature previews with the Let Dev Fleet test machines use this computer's sign-in row

Residual risk

  • While a pod runs, code in the pod that runs outside its agents' sandbox can obtain the host's access token (about one hour each). This is narrower than today's staged kiro-cli store, which holds a refresh token.
  • Lent tokens are the host person's identity, so usage and telemetry count on the host account.

Related Issues

Part of #9211

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners November 27, 2026 19:31
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the preview is off by default, the host checks the pod's process identity rather than a secret, no refresh token leaves the host, and the patch removes nothing.

Notes

  • If a host adopted Dev Fleet from its own repository, it answers 403 app_not_enabled until the re-pin follow-up lands. File an issue for that follow-up so the gap has an owner.

[DESIGN-REVIEWED] e98eea5

Description read

[DESCRIPTION-READ] a06651fc48d9c58d4c79b33ae5dcffcd6a5da8d9650bce1ff5bd2e3e53d33af9

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 Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🔴 BLOCK

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

UX-Verdict: BLOCK

The blind reader would not turn on the new switch. They did not know what "Dev Fleet" is, and the only definition is hidden in the ⓘ tooltip.

Blockers

The new switch names an app the row never explains
Trigger: a host owner opens Settings › Feature Previews › Publishing and Sign-in and reads the "Let Dev Fleet test machines use this computer's sign-in" row in shot-01.
Outcome: the visible line says "Test machines from the Dev Fleet app sign in as you… Their chats count against your plan." The line that defines the app, "Dev Fleet is the app that starts test copies of {{productName}}", sits only in pod_host_sign_in_desc, which is the tooltip hint. So the reader sees "machines act as me" with no idea which machines. The blind reader rated their reading "a guess. I don't know what 'Dev Fleet' is" and said they would not click it: "no, because other machines would be using my account." This hits every owner who looks at the row, and the switch is the only control this PR adds, so it fails the PR's whole value every time. Owners who should turn it on will leave it off.
Fix: put the definition in pod_host_sign_in_desc_summary itself, e.g. "Test copies of {{productName}} that the Dev Fleet app starts sign in as you, so you don't sign in on each one. Their chats count against your plan." Leave the tooltip for the kiro-cli and company sign-in exceptions.

Notes

  • "Your long-term sign-in stays on this computer." reads as reassurance next to the consequence line. Cut it, or say what never leaves: "Test machines get short-lived access only."
  • The blind reader confused this row's "sign-in" with the "sign-in" in the "MCP sign-in by Kiro Crew" row directly above it. A label that starts with the outcome, such as "Share your sign-in with Dev Fleet test copies", would tell the two apart.

[UX-REVIEWED] e98eea5

Description read

[DESCRIPTION-READ] 02e7decbe9f14e2e3aaac6c633363b5917cbbe3a2806bfaead67b4dd2cf3f7cf

That sha256 names everything this verdict read: the PR description, plus the 4 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 Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

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

The feature stays behind a preview that is off by default and always off on LTS, so nobody gets it without opting in. One part is heavier than the goal needs: the 60-second lend cache in the readiness check.

Notes

  • Item 6 — oversized: ready(fresh=False), READY_CACHE_SECS, the fresh/pod_refusal parameters and rewrites_history=False on two callers exist only to keep turn checks under MAX_POD_HOST_SIGN_IN_PER_WINDOW = 30. That cap is a number this same PR sets ("A proposal, not a measured value"). The same diff's _engine_signed_in already answers readiness as pod_host_sign_in.active(), where "the token request reports a host refusal". Subtraction: delete the ready cache and the fresh/rewrites_history threading, so the turns that rewrite nothing (/v1/chat/completions, /v1/responses) no longer ask the host each turn. Destructive reruns keep asking fresh. Clears when: the mechanism is removed, or a human amends the Goal.

What this change ships

Inventory (8 items) — 7 justified

Intent: let a test pod's bundled KAS engine run chats on the host's Crew sign-in without a separate sign-in in the pod. This is an ADDITION.

  1. New Feature Preview toggle "Let Dev Fleet test machines use this computer's sign-in", default off, off on LTS — justified
  2. Two host routes that lend an access token and answer "is it refused", only to the pod's own gateway process, over the unix socket — justified
  3. A pod's bundle engine borrows the host token when its own vault is empty — justified
  4. Readiness, the model picker and route choice count the borrowed sign-in on the bundle route only — justified
  5. pod up records the host's data home, and the pod boot hands the gateway the host socket — justified
  6. Turns that rewrite no history reuse a recent lend for 60s — oversized
  7. Dev Fleet's built-in manifest gains the /api/pods/host-sign-in/* grant, with the app repo named — justified
  8. Re-export seam agent_sdk/kas_vault_answer.py, as scripts/check_agent_sdk_boundary.py requires — justified

[FIRST-PRINCIPLES-REVIEWED] e98eea5

Description read

[DESCRIPTION-READ] a887763320c5fd431094c01e9ff999d82855fbb8b60ace2b8a634c4abf9c1d7f

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 Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] e98eea5

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable e98eea50854b1d9ce1e4460826d00c5723573a71 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] e98eea5

False positive or not applicable? A repository writer can comment:
/ai-review override gpt e98eea50854b1d9ce1e4460826d00c5723573a71 false-positive: <reason, 20 to 500 characters>

@iamwhatever
iamwhatever force-pushed the feat/pod-host-token-broker branch from 9ec1ffa to b98d587 Compare November 27, 2026 20:07
@iamwhatever

iamwhatever commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=bb3aaad47862

fixed in b98d587: with an empty pod vault and the host socket, kas_crew_signin_ready (src/kiro_crew/dashboard/kiro_readiness.py) asks the host for a token instead of refusing, _vault_signed_in (src/kiro_crew/dashboard/handlers/models_kas_bundle.py) counts the borrowed sign-in, and vault_identity (src/kiro_crew/agent_sdk/kas_model_catalog.py) keys the catalog by the host socket. The relay's checks stay vault-only.
Tests: readiness ready/refused/outside a pod, /api/models availability and catalog keying in test/test_pod_host_sign_in.py.

self-added: no
mechanism: bundle-route sign-in checks read the borrowed sign-in as they read a workload identity

@iamwhatever

iamwhatever commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=9f6b3d6448c5

fixed in b98d587: the row is now "Test pods use this computer's sign-in", under Publishing and Sign-in after "MCP sign-in by Kiro Crew". Its visible summary says test pods you start from this computer borrow its Kiro Crew sign-in through short-lived tokens, never the sign-in itself, that code in a running pod outside its agents' sandbox can use those tokens, and that usage counts on your account. The info tip gives the On and Off behaviour. One word for the machine throughout: this computer. Updated in all 12 locales; new screenshot in the description.

self-added: no
mechanism: preview copy names what the reader knows

@iamwhatever

iamwhatever commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=bb072cd1d23d

Rebutted: kept as the documented shortcut at pod_host_sign_in.catalog_identity. Keying the borrowed catalog by the host's account needs the host to send an account marker with each token, and the owner fixed the lent answer at exactly five keys (accessToken, expiresAt, profileArn, provider, authMethod); a sixth is a new wire field outside that ruling. The case is a host account switch while a pod runs, the feature is off by default and inert until the follow-up wiring, and restarting the pod clears the key. The adjudication downgraded it for the same reason.

self-added: yes
mechanism: socket-derived catalog key for a borrowed sign-in

@iamwhatever
iamwhatever force-pushed the feat/pod-host-token-broker branch from b98d587 to fdeb21e Compare November 27, 2026 20:27
@iamwhatever

iamwhatever commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=72159a97f7d8

fixed in fdeb21e: the visible summary now starts by saying what a test pod is (test copies of Kiro Crew you start on this computer, for example from the command line or the Dev Fleet app), then what the switch does (they use this computer's Kiro Crew sign-in instead of asking you to sign in again), then the risk in plain words (while a test pod runs, programs it runs can use your Kiro account, and their usage counts on your account). The internal terms are gone. The hint keeps only what the summary does not say: the temporary key, that it stops with the pod, Off, and that pods on kiro-cli are unaffected. All 12 locales; new screenshot in the description.

self-added: yes
mechanism: preview copy names what the reader knows

@iamwhatever

iamwhatever commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=75e11f0a9de2

Acknowledged: this PR will carry both producers before it is ready. The two lines live in files another open PR owns and is changing now: pod/runtime.py build_pod_env (the KIROCREW_POD_HOST_SIGN_IN_SOCKET env line) and apps/builtins/dev_fleet/app.json (the permissions.api grant for /api/pods/host-sign-in/*), both in #43519. Once #43519 merges, this branch is rebased and those two lines are added here, so the preview and routes ship with their producer. The preview row and routes stay; nothing else changes in the meantime.

self-added: no
mechanism: preview wiring split across two PRs by file ownership

@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 Nov 27, 2026
@iamwhatever

iamwhatever commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=6f420bf6d7b7

fixed in 23fcbff: the visible summary now carries the safeguard as well as the risk. It says test pods (test copies of Kiro Crew you start on this computer) get a temporary key from this computer's Kiro Crew sign-in instead of asking you to sign in, never the sign-in itself; that each key lasts about an hour and a stopped pod gets no new ones; and that while a pod runs, programs it runs can use your Kiro account and their usage counts on your account. The example of how to start a pod moved to the tooltip, with the Off behaviour and the kiro-cli exception. All 12 locales.

self-added: yes
mechanism: preview copy names what the reader knows

@iamwhatever
iamwhatever force-pushed the feat/pod-host-token-broker branch from fdeb21e to 23fcbff Compare November 28, 2026 07:10
@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 Nov 28, 2026
@iamwhatever

iamwhatever commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=e264b4bb4c37

Acknowledged: agreed, and fixed in this PR before it is ready. The same entry is up for the app repository in KiroCrewCaptain/kirocrew-app-dev-fleet#15 (only /api/pods/host-sign-in/*, plus its builtin fixture). When it merges, this PR moves the dev-fleet pin in src/kiro_crew/apps/adoption-pins.json (commit, version, tree and archive hashes) to that merge commit, so adopted hosts carry the grant. The body names it on an App repo: line and in its Adopted hosts section.

self-added: yes
mechanism: app-agnostic route grant read from the adopted app's manifest

@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 Nov 28, 2026
@iamwhatever

iamwhatever commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=95f55de7d69e

fixed in aaed717: the host's rate limit is keyed by the route and the kernel-attested peer pid from the socket's peer credentials, not by the pod name the caller claims, so a refused caller spends only its own budget. It still runs before the grant and pod-gateway checks, so refused callers stay bounded. Keys whose window has passed are pruned once 1024 are held.
Tests: a refused peer naming a running pod gets 403, 403, 429 while the real gateway still gets 200, 200, 429, on both routes; stale keys are pruned.

self-added: yes
mechanism: per-peer-pid pre-admission rate limit

@iamwhatever
iamwhatever force-pushed the feat/pod-host-token-broker branch from 23fcbff to aaed717 Compare November 28, 2026 07:28
@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 Nov 28, 2026
@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 Nov 29, 2026
bolichen97 pushed a commit to KiroCrewCaptain/kirocrew-app-dev-fleet that referenced this pull request Nov 30, 2026
* feat: grant the pod host sign-in routes

Declare /api/pods/host-sign-in/* in permissions.api, matching the Kiro Crew built-in's manifest (kirodotdev/KiroCrew#43525). The routes let a test pod's own gateway borrow the host's Kiro Crew sign-in; the host gateway answers them only while its pod_host_sign_in preview is on and only to the named pod's gateway process, and reads this entry as the owner's grant.

* test: match the pod-e2e skill's fixture to the file since 969ae54

969ae54 added a line to skills/pod-e2e/SKILL.md (the same change KiroCrew's built-in got in #37740) without updating tests/fixtures/builtin-skills.sha256, so test_bundled_skills_are_the_builtins_byte_for_byte has failed on main since then. The fixture row now carries the file's current digest; the skill itself is unchanged.

---------

Co-authored-by: zejiangg <zejiangg@amazon.com>
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 30, 2026
@iamwhatever
iamwhatever force-pushed the feat/pod-host-token-broker branch from 27a2903 to dac48e3 Compare November 30, 2026 05:16
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 30, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override ux dac48e3 The UX finding is about one settings-page line for a feature behind a default-off preview. The line has been revised 11 times; each round's ask conflicts with the GPT wording rules or with an earlier UX round (conflicts listed in the PR comment). GPT, Opus, Design and First Principles all pass on this head.

@github-actions

Copy link
Copy Markdown
Contributor

AI-review override not recorded: the command shape is not recognised. Use /ai-review override <fable|gpt|design|ux|first-principles|scope|all> <current-sha> <class>[ #N]: <reason, 20 to 500 characters>, where <class> is one of false-positive, not-applicable, pre-existing, evidence-supplied, infra-failure, reissue, deferred, owner-decision. What each class needs: docs/ci/ci-and-reviews.md#risk-release-records.

@bolichen97

Copy link
Copy Markdown
Contributor

Reviewed the head 5d141630a1. The design reads well: lending is off by default behind a Feature previews toggle, the token goes over a unix socket rather than a staged refresh token, and the residual-risk section states the one-hour access-token exposure plainly.

One blocker before I approve:

Real-machine run is needed. The description says N/A because no host gateway with a Crew sign-in was available. This change crosses a trust boundary (a pod borrows the host's sign-in) and changes what runs at pod start, so the real-machine-verify reviewer rule does not accept N/A here: unit tests over a socket prove the halves agree, not that a real pod on a real host gets a working KAS engine and nothing more. Could you add a ## Real-machine verification run on a host running this branch, signed in, with the toggle on:

  • Before (main): start a Dev Fleet pod, show its bundled KAS engine is not signed in.
  • After (this head): same pod start, show the engine signs in through the host and one model call succeeds.
  • Negative: toggle off, show the pod gets nothing; and one check that the lent token stops working after the pod stops (or say how long it stays valid).
  • Cleanup line.

A DevSpace or your own cloud desktop with a Dev Fleet pod is enough. Everything else is non-blocking.

AI-assisted review by Bolin Review bot

@KiroCrewCaptain

KiroCrewCaptain commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver deep review: Changes still requested

This follow-up read the description as edited on 12-05, on head 3bc7312739. It does not approve: the earlier change request still stands, and the review confirmed no code defect.

Earlier item 1, the real-machine run of the lending path: still stands. Thank you for running it and for reporting the result plainly. The new ## Real-machine verification section says "Partial" and that the full lend "was not observed". Both runs on this head ended with the pod "Not signed in to Kiro" and no pod.host_sign_in.* row in the host's Security Event Log. So no run yet shows a pod borrowing the host's sign-in, which is the Goal's own case and the run a maintainer asked for on this head.

What is still needed in the description (no code change, unless the run fails):

  • After, on this head: the run the section itself names as next. A non-pod host gateway on the default data home, preview on, Dev Fleet enabled, a non-company Kiro Crew sign-in. Show KIROCREW_POD_HOST_SIGN_IN_SOCKET in the pod's environment, one answered bundle chat, and the pod.host_sign_in.token row.
  • Before, on main: the same pod start, with the bundled engine not signed in.
  • Negative: preview off, the pod gets nothing.
  • ## Manual verification still says the end-to-end run was not done. Please update it when the run is in.

I checked your explanation of the failed runs against the code and it fits. The pod unit's own boot calls build_pod_env (pod/runtime_boot.py:700 in the kiro_crew package), which calls apply_to_pod_env (pod/runtime.py:1551). host_socket_for_pod returns no socket when that process reads the preview as off (pod_host_sign_in.py:174). Whether the lend works on a default-data-home host is unknown until the run shows it.

Two things for the maintainer who decides:

  • The UX lane on this head was released by the author's own override. The finding was about the wording of one settings row. Its original text is no longer in the thread.
  • The diff lets two new routes pass token auth while the preview is on (dashboard/token_auth_paths.py:240), and the handler can then return the host's access token. The reviewers read the handler's checks and found no hole. The widening is declared, default off, and off on LTS.

One AI review lane was running again when this review read the head. Its result is not part of this review.

Optional:

  • A host gateway on a non-default KIROCREW_HOME never lends, and nothing tells the operator why. The docstrings at pod_host_sign_in.py:161 and :195 say "Host side", and the Wiring bullet says "only while the host preview is on", but the pod's boot process makes that decision. Correct the three texts, and consider one info log line when a pod is given no socket.
  • acp/kas_route.py:236 counts a pod as signed in whenever it holds the host socket. With a host that has nothing lendable, a pod can move to the bundled engine and then be refused, while "Not a goal" says the relay route is unchanged. Either keep the socket from selecting the bundle by itself, or state this route change in the description.
  • apps/builtins/dev_fleet/app.json:41 grants the prefix /api/pods/host-sign-in/*. Two exact entries, or a test that pins the namespace to the two routes, keeps a later route from inheriting the grant. This note from two earlier reviews has no reply yet.

The change request on this commit stays until a new commit or a reply answers these items; a maintainer can still decide.

Tier: 2, held for a person: changes requested by the deep review.

A deep review by the code change approver, not by a person · commit 3bc7312739 · 1862 changed lines. If it is wrong, reply here: replies are how the approver is evaluated.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • span=e264b4bb4c37

deferred by the owner's decision: the finding is accurate, and this PR does not move the dev-fleet pin on purpose. The app repository already carries /api/pods/host-sign-in/* (KiroCrewCaptain/kirocrew-app-dev-fleet#15), but main moved the live-target cutover into core (#45591) and the app changed the same area on its own, so no app commit matches this repository's wheel copy today and a true Wheel-copy base: line cannot be written. The re-pin is a separate follow-up PR once the two match again. Until then the description's "Adopted hosts" section states that adopted hosts answer 403 app_not_enabled on the host sign-in route, and the feature stays behind the default-off pod_host_sign_in preview. The same finding passed on the previous head (5d14163) with the same pin state; this head only resolved an import-line conflict in test/conftest.py.

self-added: yes
mechanism: app-agnostic route grant read from the adopted app's manifest

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A non-blocking note on the new grant row in the Dev Fleet app.json, "/api/pods/host-sign-in/*".

Today that prefix reaches exactly two routes, POST /api/pods/host-sign-in/token and POST /api/pods/host-sign-in/refused. Both are internal paths gated on the core route grant holder, so nothing else is reachable through it right now. The open end is the namespace itself: any route added under /api/pods/host-sign-in/ later would be covered by grants owners have already approved, with no fresh consent, and /token hands an access token to the grant holder.

Either of these would close that without changing behaviour today:

  • list the two routes as exact rows instead of the /* prefix, or
  • add a pin test asserting the namespace holds exactly those two routes, so a third one fails CI and forces a fresh consent decision.

This does not block the PR.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override ux 3bc7312 owner-decision: The UX finding is about one settings-page line for a feature behind a default-off preview. The line has been revised 11 times; each round's ask conflicts with the GPT wording rules or with an earlier UX round (conflicts listed in the PR comment). The same text passed UX on head 5d14163.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

AI-review override not recorded: class owner-decision needs a link to the owner's decision comment (https://github.com/<owner>/<repo>/pull/<n>#issuecomment-<id>) in the reason. Use /ai-review override <fable|gpt|design|ux|first-principles|scope|all> <current-sha> <class>[ #N]: <reason, 20 to 500 characters>, where <class> is one of false-positive, not-applicable, pre-existing, evidence-supplied, infra-failure, reissue, deferred, owner-decision. What each class needs: docs/ci/ci-and-reviews.md#risk-release-records.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override ux 3bc7312 owner-decision: Owner decision: #43525 (comment) lists the conflicts. The UX finding is one settings-page line for a feature behind a default-off preview, revised 11 times; each round conflicts with the GPT wording rules or an earlier UX round. The same text passed UX on head 5d14163.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Human judgment recorded

@iamwhatever recorded a owner-decision release (class owner-decision) for the ux AI finding on 3bc731273929880f9195b447324ad3a10f83b846.

Owner decision: #43525 (comment) lists the conflicts. The UX finding is one settings-page line for a feature behind a default-off preview, revised 11 times; each round conflicts with the GPT wording rules or an earlier UX round. The same text passed UX on head 5d14163.

This decision applies only to this commit. A new push requires a new judgment.

@bolichen97

Copy link
Copy Markdown
Contributor

Re-checked the new head 3bc7312739. The Real-machine section still says N/A, so my blocker from 12-02 stands. This diff changes what a pod's bundled KAS engine signs in with, so it needs one real run: a host gateway on this branch with a Kiro Crew sign-in, lending turned on, a pod started, and the pod's KAS reaching the service with the lent token. Then the same steps on main showing the pod has no sign-in. I'll approve with auto merge once that run is in the description.

AI-assisted, sent by Bolin Review bot

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested by the code change approver's deep review, not by a person.

The review found no code defect on head 3bc7312739, and PR Readiness is green. One thing is missing before this can be approved: the real-machine run a maintainer asked for on this head. No code change is needed.

  1. Real-machine run of the lending path (description, ## Real-machine verification; pod/runtime.py:1551 in the kiro_crew package). The section says N/A, and "Manual verification" says the end-to-end run with a real host sign-in was not done. The diff runs code at every pod start (pod_host_sign_in.apply_to_pod_env), adds two host routes that return the host's access token, and lets them pass token auth while the preview is on. The tests patch the parts a real run would prove: test/test_pod_host_sign_in.py:140-147 patches the preview, the app grant and the pod unit's main pid, and line 156 mounts the handlers with no token-auth middleware. A maintainer asked for this run on 12-02 and again on this head on 12-04. Please run it on a host gateway built from this branch, with a Kiro Crew sign-in, and paste the commands and outputs into the section:
    • Before (main): start a Dev Fleet pod and show its bundled KAS engine is not signed in.
    • After (this head, preview on): the same pod start, the engine signs in through the host, and one model call succeeds.
    • Negative: with the preview off, the pod gets nothing. Also show whether a lent token still works after the pod stops, or state how long it stays valid.
    • The cleanup line.

What is done well: every refusal in the host handler fails closed, the answer carries no refresh token, and each decision goes to the Security Event Log.

Optional:

  • apps/builtins/dev_fleet/app.json:41 grants the prefix /api/pods/host-sign-in/*, while its neighbours are exact entries. Listing the two routes exactly, or adding a test that pins the namespace to these two routes, keeps a later route from inheriting the grant. An earlier review note on this has no reply.
  • acp/kas_route.py:236 treats a pod as signed in whenever it holds the host socket. If the host has no sign-in it can lend (signed in only through kiro-cli, or a company sign-in), the pod may move to the bundled engine and then be refused. Could host_socket_for_pod also check that the host holds a lendable sign-in? If the current behaviour is intended, please say so in the description.
  • Several refusal checks in dashboard/handlers/pod_host_sign_in.py have no negative test that I could find: a gateway that is itself a pod (line 144), the agent-socket and peer-credential refusals (lines 98-101), the start-id read before and after (lines 116, 130), and a namespace result of None (lines 133, 135). One test per line would keep a later edit from dropping a refusal unnoticed.

This block is withdrawn automatically when a new commit fixes these items or a reply shows one is wrong: the approver reviews it again. Any maintainer can dismiss this review at any time.

Tier: 2, held for a person: 52 files, more than 20.

Commit 3bc7312739 · 1862 changed lines.

@bolichen97

Copy link
Copy Markdown
Contributor

Re-checked the new head e98eea5085. Two new reds, both small:

  1. Flake Pattern Ratchet: test/test_pod_cli.py now has 19 short literal duration arguments against a ratchet of 18, so the new test adds one. Please drive that wait from a signal or an injected clock. If the literal is really deliberate, mark that line with # flake-ok: <reason>.
  2. UX Review (BLOCK): on the new Settings > Feature Previews > Publishing and Sign-in row, "Dev Fleet" is only defined inside the info tooltip, so a reader who never opens it cannot tell what the switch does. Please move the definition into pod_host_sign_in_desc_summary in every locale, for example "Test copies of {{productName}} that the Dev Fleet app starts sign in as you...".

The earlier request still stands: the Real-machine verification section needs a before and after run on a real machine. Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants