Skip to content

fix(kas): list models on the relay signed in only through Kiro Crew - #35890

Merged
bolichen97 merged 1 commit into
mainfrom
fix/27049-kas-relay-model-picker
Nov 12, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/27049-kas-relay-model-picker

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: on KAS signed in only through Kiro Crew, with kiro-cli signed out, the chat model picker lists the account's models instead of refusing with kiro_prerequisite_required.

On the default KAS setup, a user signed in with kirocrew kas login (or the dashboard's Sign in) but not with kiro-cli login can chat, yet the model picker stays empty: GET /api/models answers 503 kiro_prerequisite_required and tells them to sign in to kiro-cli. The relay spawn on that host enters through kiro-cli-chat and draws its credential from Kiro Crew's vault, so kiro-cli's own sign-in is not what the turn runs on.

Why it matters

Every KAS user who signed in only through Kiro Crew has no model choice, and is pushed toward a kiro-cli login the turn does not need. On a remote host that browser login can fail outright (reported on #27049). The recorded decision docs/decisions/2026-10-30-choosing-kas-runs-kiro-crews-own-engine-when-kiro-cli-cannot.md says every KAS prompt points to the Kiro sign-in, not to kiro-cli login.

Not a goal

What changed (motivation → approach → change)

The picker asked kiro-cli for its catalog on every KAS relay, so a signed-out kiro-cli decided the list for a spawn that never uses its sign-in. The right list already exists. Every KAS session records the engine's own model list for the account the vault names, and the bundle route serves it today.

KAS host /api/models before after
Relay through kiro-cli-chat, Kiro Crew sign-in, kiro-cli gate refuses 503 kiro_prerequisite_required the engine's recorded list for that account; auto alone until the first chat
Launcher relay, or no usable Kiro Crew sign-in 503 unchanged
kiro-cli gate passes --list-models unchanged
Bundle route recorded list unchanged
  • crew_sign_in_starts_spawn() in acp/kas_route.py, which the dashboard reaches through agent_sdk/kas_bundle.py, asks one question: does the next KAS spawn start on Kiro Crew's usable sign-in alone? That means the relay entered through kiro-cli-chat, or the bundle route.
    • It is not vault_holds_identity, which the usage poll asks. That one names whose credential a spawn uses; this one asks whether Kiro Crew's own usable sign-in alone starts the spawn.
    • A lapsed vault entry answers no, so that host keeps today's path.
  • api_models asks it only where kiro-cli's gate has already refused, and only for backend == "kas". A passing gate keeps the kiro-cli catalog as before, warm-up included.
  • On a yes, the gate's 503 is replaced by the recording, served by models_kas_bundle.api_models_kas_crew_relay through the bundle route's vault-fenced recording reader. No cold probe and no --list-models read start for it; only the gate's existing sign-in check runs.
  • model-selection.md, acp-client.md, harness-parity.md and the docstrings of agent_sdk/kas_model_catalog.py and models_kas_bundle.py name the relay case.

Merge order with #25562: none needed. It states that a Kiro Crew sign-in never authorizes a kiro-cli spawn, and this PR starts no spawn of its own. Its test_api_models_off_the_bundle_route_never_consults_the_crew_signin passes either way, because a test home holds no vault sign-in.

Backwards compatibility

Compatible: the only answer that changes is the first row of the table, from a 503 to a 200. A passing kiro-cli gate and every other harness take the same path as before. On that relay a gate refusal of either kind, signed out or a timed-out check, answers the recording, or auto while cold, instead of the 503.

Removes nothing: no key, field, route or error code is removed; the 503 still answers every other host.

Tests

  • test/test_api_models_kas_bundle.py::TestTheCrewSignInRelay:
    • a refused gate on that relay serves the recording, with no --list-models spawn and no cold probe;
    • a cold read answers auto and spawns nothing;
    • the launcher relay keeps the gate's 503;
    • a passing gate keeps the kiro-cli path without reading the predicate.
  • test/test_kas_route.py::TestCrewSignInStartsSpawn: the kiro-cli-chat relay and the bundle route start on Kiro Crew's sign-in alone; the launcher relay and a lapsed sign-in do not.

Determinism: the three changed classes passed 20 runs at -n0 and 10 at -n 4 --dist loadgroup beside test_api_models_retry.py and test_kas_model_catalog.py; both changed files passed in a shuffled order (seed 21571).

Proof: PROVEN test/test_api_models_kas_bundle.py::TestTheCrewSignInRelay::test_a_refused_gate_serves_the_recording (head 0f40ae4)

Manual verification

Not run on a live gateway: it needs a host signed in through Kiro Crew with kiro-cli signed out, and this host has neither account to sign in with. The handler tests drive api_models end to end with the route, latch and vault replaced.

Related Issues

Part of #27049

Sibling sweep

Swept: git grep -n "reject_if_kiro_unverified(" -- src/kiro_crew
Sibling: src/kiro_crew/dashboard/chat_regenerate.py -- tracked in #27049
Sibling: src/kiro_crew/dashboard/chat_rewind.py -- tracked in #27049
Sibling: src/kiro_crew/dashboard/openai_compat.py -- tracked in #27049
Sibling: src/kiro_crew/dashboard/handlers/sessions.py -- not affected -- the usage routes skip the gate when the vault owns usage
Sibling: src/kiro_crew/dashboard/handlers/agents.py:1359 -- not affected -- the background --list-models refresh runs only on the kiro-cli path this change leaves as is

Pattern harvest

Not generalizable: the kiro-cli gate is right for every kiro-cli spawn; the one-off is a KAS relay that takes its credential from Kiro Crew's vault, now named by one predicate the remaining sites will share.

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

Contributed under the project's Apache-2.0 license.

On the KAS harness a user signed in through Kiro Crew's own sign-in,
with kiro-cli signed out, got an empty model picker: /api/models asked
kiro-cli for its catalog and answered 503 kiro_prerequisite_required,
although the relay spawn enters through kiro-cli-chat and draws its
credential from Crew's vault.

When kiro-cli's gate refuses and the next KAS spawn starts on Crew's
usable sign-in alone, the picker serves the KAS engine's recorded model
list for that account (auto alone until the first chat), the answer the
bundle route already gives. Nothing is spawned for it. A passing gate,
the launcher relay and every other harness keep the kiro-cli path and
its kiro-cli login remedy.

Part of #27049.
@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 12, 2026 16:19
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 0f40ae4d3cac8c33d16f41d2b1a8f92e6d4fbfa7 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@bolichen97
bolichen97 enabled auto-merge (squash) November 12, 2026 16:20
@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

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

Nothing blocks. Each item answers the defect reported on #27049, and the fix is in the predicate that decides which sign-in counts, not at the 503 call site.

What this change ships

Inventory (6 items) — 6 justified

Intent: let a KAS user who is signed in only through Kiro Crew pick a chat model without running kiro-cli login. This is a FIX.

  1. On a KAS relay entered through kiro-cli-chat with a usable Crew sign-in, a refused kiro-cli gate now gets the recorded model list instead of a 503 — justified
  2. With nothing recorded yet, that relay answers auto and starts no background probe — justified
  3. A gate that refuses because its check timed out also gets the recording on that relay, not the 503 — justified
  4. A KAS route that falls back to the bundled engine on its own while agent.kas_bundle is off gets the same treatment once the gate refuses — justified
  5. New predicate acp.kas_route.crew_sign_in_starts_spawn, plus an agent_sdk/kas_bundle.py passthrough built like its neighbours kas_route and last_kas_route; it has 1 consumer, api_models_kas_crew_relay — justified
  6. The model-selection, acp-client and harness-parity specs and two docstrings now describe the relay case — justified

[FIRST-PRINCIPLES-REVIEWED] 0f40ae4

Description read

[DESCRIPTION-READ] 149051e0527866faabfb6b36885228b4cb71f9030f959c90f6ebb41b77b7f0f4

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

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

No design-level concerns: the fallback runs only after kiro-cli's gate has refused, only for backend == "kas", and only on a spawn that Kiro Crew's own sign-in starts, so every other path behaves as before.

Notes

  • A cold read answers auto alone until the first chat, and this depends on the dashboard refetching the list when that chat spawns. No test in this PR covers the refetch, so a missed refetch would leave the picker on auto until the page reloads.

[DESIGN-REVIEWED] 0f40ae4

Description read

[DESCRIPTION-READ] c39884c56669e502793b11229a7327d7dd1191aaa24d6605b43d10ad0e9fa532

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 0f40ae4

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

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

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 0f40ae4

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

@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider thinks the change is probably fine but estimates a 15% chance that this change introduces a defect, above the 12% limit for approving on its own.

Narrow, correct fix. The fallback runs only for the KAS backend and only after kiro-cli's sign-in check has refused. The new crew_sign_in_starts_spawn check matches how resolve_spawn chooses kiro-cli-chat versus the launcher: it requires a usable Kiro Crew sign-in and answers no on any failure, so nothing fails open. It reuses the bundle route's account-scoped reader for the recorded list and starts no spawn. Tests cover each branch, and the specs are updated in the same change. No regression found on other paths.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 0f40ae4d3c · 264 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@buluoray buluoray 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.

Approve on 0f40ae4. On KAS's relay entered through kiro-cli-chat, a person signed in only through Kiro Crew now gets the engine's recorded model list for their own account (or auto until the first chat) instead of a 503 that told them to sign in to kiro-cli. The fallback runs only after kiro-cli's own gate has refused, only for the KAS backend, and only when Kiro Crew's sign-in is usable; a person signed in through kiro-cli keeps the same list, and a person signed in through neither keeps the same refusal. The new path reads no credential value and starts no process. Tests cover each branch, and four of the five guards turn a test red when broken. One follow-up: no test covers the backend == "kas" guard. Decisive lines: src/kiro_crew/dashboard/handlers/agents.py:1463, src/kiro_crew/dashboard/handlers/models_kas_bundle.py:153-166, src/kiro_crew/acp/kas_route.py:307-334

@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 Nov 12, 2026
@bolichen97
bolichen97 merged commit 0b5a222 into main Nov 12, 2026
98 checks passed
@bolichen97
bolichen97 deleted the fix/27049-kas-relay-model-picker branch November 12, 2026 17:19
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 12, 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.

3 participants