Skip to content

fix(models): say why the picker is short when kiro-cli is signed out - #39183

Merged
buluoray merged 1 commit into
mainfrom
crew/slack/models-prereq-notice
Nov 18, 2026
Merged

buluoray merged 1 commit into
mainfrom
crew/slack/models-prereq-notice

Conversation

@buluoray

@buluoray buluoray commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: When kiro-cli's own login is missing or expired, the model picker and Settings ▸ Chat say why the model list is short and offer an in-app way to sign kiro-cli in.

With kiro-cli signed out, GET /api/models answers 503 kiro_prerequisite_required. The chat model picker then lists only Default and says nothing, so the list just looks broken. Settings ▸ Chat names the cause, but its only remedy is "Run 'kiro-cli login' in your terminal".

Why it matters

Anyone on the Kiro CLI harness, or on KAS started through kiro-cli's own sign-in, can hit this after kiro-cli's login lapses. Nothing in the picker points to the cause. The one hint, in Settings, expects the user to open a terminal and type a command.

Not a goal

What changed (motivation → approach → change)

The frontend already records that /api/models failed with kiro_prerequisite_required (markModelsAuthRequired). Only the Settings banner read that flag, and neither composer picker did. kiro-cli has no sign-in the dashboard can drive, so the in-app path is the dashboard Terminal panel. Run in terminal already opens it, behind a confirm that shows the exact command.

  • New KiroCliSignInInTerminal.tsx: a hook that runs the prerequisite status's login_command (falling back to kiro-cli login) through the existing Run in terminal flow, a Sign in to Kiro CLI button, and the picker's notice row.
  • Both composer pickers (ModelEffortDropdown from ComposerDockView, and the split-pane ChatPanePickerMenus) show the notice while the configured list is held back. The button closes the picker first, and the confirm is mounted outside the picker so it survives that. A harness's own list (models_backend) never shows the row.
  • Where no Terminal panel here can run the command, the button copies it instead (the run-yourself card does the same). That covers a terminal turned off, an embed or popout window with no dock, and a chat that is not known to run on this machine (a Session Environment, another crew, or a placement not read yet), where a local run is refused. One hook, useKiroCliCanRunHere, decides this for all three hosts. The split pane also needs the page's active chat to run here, because that chat owns the terminal receiver. In the copy state the Settings banner says to copy the command instead of naming a button that is not there, and the signed-out banner no longer repeats the fetch error under its lead.
  • The Settings ▸ Chat banner gets the same button, and its text now points to it instead of a terminal. The value changes in all 12 catalogs, and en-XA is regenerated.
  • docs/system-specs/common/model-selection.md describes the row, and website/capture/ gets the capture page and harness used for the screenshots below.

Backwards compatibility

Compatible: the new row and button appear only while /api/models reports kiro_prerequisite_required. Every other picker and banner state renders as before.

Removes nothing: the Settings banner keeps its Retry button, and only its text changes.

Tests

  • website/src/components/KiroCliSignInInTerminal.test.tsx: the button opens the confirm with the status's own command and dispatches mc:run-in-terminal only after Run. It falls back to kiro-cli login with no status and no query client. ModelEffortDropdown shows the row only when its caller passes onKiroCliSignIn.
  • KiroCliSignInInTerminal.test.tsx also checks that a host that cannot run shows only the copy button, and pins useKiroCliCanRunHere for the main window, embed, popout, unread or remote placement, and a terminal turned off.
  • website/src/components/ChatPane.pickerMenus.test.tsx: the split-pane picker shows the row on the signed-out flag, closes on the button, and its confirm stays open. A pane whose chat runs elsewhere gets the copy button. The row is absent otherwise.
  • website/src/test/SettingsChatPanelCoverage.test.tsx: the signed-out banner no longer says "in your terminal" and its button opens the confirm. With the terminal off it shows the copy button and the copy wording. The generic degraded banner has no such button.
  • ChatPane.pickerMenus.test.tsx also covers a local pane while the page's active chat is remote or unread: copy, not Run.

Proof: not provable -- frontend test (prove.py runs Python only)

By hand: with the four production files reset to origin/main, the picker, dropdown and Settings cases fail (3 failed), and they pass on the head.

Manual verification

Component renders with mocked data (below). npx vitest run src/i18n/ (1270 passed), npm run i18n:check with I18N_BASE_REF set, and the neighbouring chat and Settings suites (275 passed) are green.

Real-machine verification

Not run. The change is frontend-only and reuses the existing Run in terminal flow. Unit tests and the component renders below cover the new row, the button and the confirm.

Screenshots / video

Component render, not the live page (mocked data, dark theme).

Terminal can run here No terminal here (off, embed or popout, chat elsewhere)
Picker row with Sign in to Kiro CLI Picker row with Copy the sign-in command

The confirm that Sign in to Kiro CLI opens:

Run in terminal confirm with kiro-cli login

Settings ▸ Chat ▸ Model banner, with a terminal, then without:

Settings banner with the Sign in to Kiro CLI button

Settings banner with the copy fallback and its wording

Related Issues

Closes #39169

Related: #39095, #15346, #18494, #35890

Sibling sweep

Swept: git grep -n "kiro-cli login" -- website/src/i18n/locales/en.json website/src/pages website/src/components
Sibling: website/src/pages/chat/KiroCliSignInRow.tsx -- not affected -- chat error card already shows the sign-in commands and Check again
Sibling: website/src/components/KiroPrerequisiteGate.tsx -- not affected -- first-run gate, owns its own sign-in screen

Pattern harvest

Not generalizable: one cause flag that only one of its three readers drew; the fix wires the other two.

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

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

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the change reads the existing kiro_prerequisite_required flag in the two pickers that ignored it, and reuses the Run in terminal confirm without adding a new auth path.

[DESIGN-REVIEWED] d68109b

Description read

[DESCRIPTION-READ] 325f00f8d22dec1248ac4904bf7acf7de51d466c7544466aa14ecaf12d644672

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 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Nothing blocks. The PR shows both states of the new button (run and copy) in the picker and in Settings, plus the confirm dialog. The blind reader identified each control and would dare to use it.

Notes

  • In the picker's copy state, the only text is models_signed_out. Nothing there says what to do with the copied command, and the blind reader said "after that I'd be stuck" (shot-02). In copy mode, show a picker-specific string, e.g. "Kiro CLI isn't signed in. Copy the sign-in command and run it in a terminal."
  • The copy button's "Copied" and clipboard-refused states (an ErrorNotice plus a <code> block) appear in no screenshot. Attach a still of the refused state.
  • The picker says "the full model list can't load", while Settings says "isn't signed in or its login has expired". The reader could not tell these were the same problem. Use one lead clause on both surfaces.

[UX-REVIEWED] d68109b

Description read

[DESCRIPTION-READ] fb78e9c025cc72c9a743d3dd197f289fdda49ab66486490e754d9ea4e6f4b254

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

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

Every item answers the reported defect (#39169) or the Goal; the only gaps are two small second spellings of helpers that already exist.

Notes

  • Item 2 — duplicate of website/src/components/RunInTerminalBtn.tsx TerminalCopySettingWithConfig: useKiroCliSignInInTerminal reads the copy-instead-of-run setting again, through a one-off unsubscribed lookup (queryClient?.getQueryData<…>(['kirocrewConfig'])), so it can drift from the confirm wording every other Run button shows. Subtraction: delete the lookup and get willCopy from WithTerminalCopySetting where dialog is mounted.
  • Item 3 — duplicate of RunYourselfCard.tsx's copy callback (same copied/failed state, 1500 ms timer, copyCode): KiroCliCopySignIn hand-rolls a third copy of that state machine, and settingRef/CopyCommandButton.tsx is a second one. Subtraction: shrink KiroCliCopySignIn to the labelled <Btn> and reuse one of the existing copy-state owners.

What this change ships

Inventory (8 items) — 6 justified

Intent: when kiro-cli is signed out, the person sees why the model list is short and can sign kiro-cli in without typing a command. FIX.

  1. Both composer model pickers show a "Kiro CLI isn't signed in" row with a Sign in to Kiro CLI button — justified
  2. The button opens the existing Run in terminal confirm with the status's login_command — duplicate of TerminalCopySettingWithConfig's reuse_current read
  3. Where no terminal here can run it (terminal off, embed, popout, remote or unread chat), the button copies the command instead — duplicate of RunYourselfCard copy state
  4. The Settings ▸ Chat model banner gets the same button — justified
  5. The Settings banner text points to the button, or says to copy the command; all 12 catalogs change — justified
  6. The signed-out Settings banner no longer repeats the fetch error under its lead — rides along
  7. A harness's own model list never shows the row — justified
  8. A new capture page and screenshot harness under website/capture/ — rides along

[FIRST-PRINCIPLES-REVIEWED] d68109b

Description read

[DESCRIPTION-READ] 298442447f9a93417251d0b76f7da9860a0c8856c45f1189a0c6285c0eecc01e

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 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] d68109b

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

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

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d68109b

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

@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 18, 2026
@buluoray
buluoray force-pushed the crew/slack/models-prereq-notice branch from ab61ed4 to bb71558 Compare November 18, 2026 19:20
@buluoray

Copy link
Copy Markdown
Contributor Author

span=b42dac35d2c8

  • Settings banner names a button that the copy fallback replaces

fixed in bb71558: with no terminal here the banner now reads "Copy the sign-in command, run it in a terminal, then click Retry." (new key failed_to_load_config_kiro_signed_out_copy, 12 locales), and the fallback is a labelled "Copy the sign-in command" button, not an icon.
The evidence gap is closed: the description now shows the picker and the Settings banner in the copy state. The signed-out banner also drops the repeated fetch error under its lead.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=89b9782d0d65

  • Sign-in availability checks a different chat than the terminal receiver

fixed in bb71558: the split-pane row offers Run only when the pane AND the page's active chat (the receiver's useSlotRunsHere(activeSlot)) both run here; otherwise it copies. Test: ChatPane.pickerMenus.test.tsx, active chat remote or unread.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=e9b5cd5bafd8

  • Settings capture waits for a button its scene never renders

fixed in bb71558: the capture entry calls setTerminalEnabledFlag from a canrun URL param before render, and the harness adds picker-copy and settings-copy shots; a run wrote all 10 PNGs.

@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 18, 2026
@buluoray
buluoray force-pushed the crew/slack/models-prereq-notice branch from bb71558 to bc36927 Compare November 18, 2026 19:39
@buluoray

Copy link
Copy Markdown
Contributor Author

span=1b30fd4713eb

  • Copy-failure notice lacks the required hand-off decision

fixed in bc36927: hand-off stays off, and a No hand-off comment now sits on the notice naming the drafts it protects (the composer's unsent draft in the model picker, and Settings > Chat's localRoleOther / localBudget / localKeepChars).

@buluoray

Copy link
Copy Markdown
Contributor Author

span=af68f7eb27d2

  • Copy-failure notice lacks the required hand-off decision

fixed in bc36927: hand-off stays off, and a No hand-off comment now sits on the notice naming the drafts it protects (the composer's unsent draft in the model picker, and Settings > Chat's localRoleOther / localBudget / localKeepChars).

When kiro-cli's own login is missing or expired, GET /api/models answers
503 kiro_prerequisite_required and the chat model picker falls back to
Default with no reason. Settings > Chat named the cause but told the user
to run `kiro-cli login` in a terminal.

Both composer pickers now show a one-line notice and a "Sign in to Kiro
CLI" button, and the Settings > Chat banner carries the same button. The
button runs the prerequisite status's login_command in the dashboard
Terminal panel behind the usual Run in terminal confirm, so no one has to
type a command. A harness's own list (models_backend) never shows the row.

Closes #39169
@buluoray
buluoray force-pushed the crew/slack/models-prereq-notice branch from bc36927 to d68109b Compare November 18, 2026 20:01
@buluoray

Copy link
Copy Markdown
Contributor Author

span=1b30fd4713eb

  • Copy failure leaves the sign-in command unavailable

fixed in d68109b: when the clipboard refuses, the notice now shows the command as selectable, wrapped text (select-all), so the user can copy it by hand. Test: KiroCliSignInInTerminal.test.tsx mocks copyCode to fail and asserts the command is on screen (red before the fix).

@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 18, 2026
@buluoray
buluoray enabled auto-merge (squash) November 18, 2026 21:31
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider estimates a 12% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 703 lines, more than the 400 it may approve on its own.

This frontend-only PR shows a 'Kiro CLI isn't signed in' row with a Sign in to Kiro CLI button in both composer pickers and in the Settings ▸ Chat banner. The button reuses the existing Run in terminal confirm, or copies the command where no terminal here can run it. I checked each host against the receiver that answers it. Settings on /settings goes to the app-wide fallback receiver. The composer and split pane go to the chat page's receiver, which refuses unless the active chat runs here, and the PR gates on that. Members-page panes go to their own scoped receivers. Embed and popout windows (including /embed/settings) get the copy button, matching the shell's hasDock rule. Placement errors only ever cause an unneeded copy, and a refused run still shows the receiver's own notice. The command comes from the gateway's status and runs only after the existing confirm. The flag the row reads is set only for the configured list and is cleared when the list loads. Tests cover every host and both states, all 12 catalogs are updated, the spec doc is updated, and CI is green. Nothing blocks.

Tier: 2, held for a person: security-sensitive path.

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 d68109b9c7 · 703 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

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

Reviewed on head d68109b. I checked correctness against both composer pickers and the Settings banner, the root and website blocking rules, open PRs for duplicates, and main for an existing fix. I also checked the added tests for determinism and confirmed the screenshots match this head's strings. Nothing blocks.

Security: the sign-in button adds no new way to run a command. It goes through the existing Run in terminal confirm, which shows the exact command and the sensitive-command warning before anything runs. The receiving bridge still applies its own copy, cwd and runs-here refusals. The command comes from the gateway's prerequisite status (the redacted constant for non-owners), not from user or model input. A wrong run-or-copy guess falls back to copying and never runs on the wrong machine.

Done well: one hook (useKiroCliCanRunHere) decides run or copy for all three hosts, and the confirm is mounted outside the picker portal so it survives the picker closing.

Optional:

  • No test renders ComposerDockView or runs the split pane's flag computation. Removing the models_backend === undefined guard or the remote-executor check would not fail any test. One host-level case for each would pin them.
  • The Backwards compatibility line says "Removes nothing", but the signed-out Settings banner no longer shows the fetch error. The comment in modelListHealth.ts and the sentence in acp-client.md still describe the old behaviour.
  • KiroCliSignInInTerminal.tsx reads the prerequisite status and reuse_current with getQueryData, which does not subscribe. A subscribed useQuery, as RunInTerminalBtn does, would keep the confirm's Run or Copy wording current.

@buluoray
buluoray merged commit 7daa179 into main Nov 18, 2026
100 of 101 checks passed
@buluoray
buluoray deleted the crew/slack/models-prereq-notice branch November 18, 2026 21:56
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 18, 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.

Model picker shows only Default with no reason when kiro-cli itself is signed out

2 participants