Skip to content

fix(models): backport the cold model list fill to 0.12.1 (batch 24) - #32112

Merged
buluoray merged 1 commit into
release/0.12.0from
crew/slack/0.12.1-batch-24
Nov 7, 2026
Merged

buluoray merged 1 commit into
release/0.12.0from
crew/slack/0.12.1-batch-24

Conversation

@buluoray

@buluoray buluoray commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Needs Bolin's OK before merge. #31569 lets a cold read of the model list start one background session, so it touches a shared session path. That is above the low-risk bar the other 0.12.1 batches use, so it is in a PR of its own.

Problem / Motivation

Goal: Bring #31569, a model-picker fix that merged on main after v0.12.0, onto release/0.12.0 as one commit in a PR of its own, so it can be reviewed and reverted apart from the low-risk batches.

Why it matters

PR Reported in What a 0.12.0 user sees today
#31569 #31280 (mrbeag), #31566 On the KAS engine bundle route, and on Codex and the other harnesses that learn their models from session/new, the model picker shows only "auto" after every gateway restart or re-sign-in, until a first chat message is sent.

Not a goal

  • No fix that is not already merged on main; nothing is changed only here.
  • No version bump, no tag, no CHANGELOG.md change. Cutting v0.12.1-rc.N and the bare tag follow docs/build/release.md and stay with the maintainers.
  • Not merged into any other 0.12.1 batch.

What changed (motivation → approach → change)

The main squash commit was cherry-picked with -x onto release/0.12.0 @ 3c7bb81811, keeping its original author.

PR main commit release commit Pick
#31569 fill a cold model list without waiting for the first chat 2552c90918 928a58916d clean

File line cap. The pick takes src/kiro_crew/dashboard/handlers/agents.py from 2,000 to 2,002 lines, over the 2,000-line cap that scripts/check_file_line_cap.py enforces. main carries the same 2,002 lines. Nothing was trimmed by hand and no baseline row was added. This PR does not wait for the split: #32123 on main moves api_effort_levels into handlers/agents_effort_levels.py, and once it merges it is picked into the next release batch so agents.py on this branch goes back under the cap.

No hunk was resolved by hand; the pick's added and removed lines are identical to its main commit. Every session-manager helper it calls (_configured_bg_backend, _bg_backend_supports_runtime, get_bg_session) already exists on this branch.

What it does. When GET /api/models finds no advertised models for the configured harness, it answers at once as before and starts one throwaway background session in a background task. That session's session/new records the models through the same capture a chat session uses. The session is then destroyed, and an empty models_changed frame tells each dashboard to read the list again.

The guard. The probe is bounded so it cannot loop or pile up sessions. It does not wait for other background work to finish; it opens its own handle on the shared runtime beside it.

Guard Effect
One at a time a probe still running starts nothing
Shared runtime only the probe runs only when the configured backend serves background work from the shared runtime (_bg_backend_supports_runtime), where get_bg_session hands each caller its own short-lived session handle, so destroying it closes no other session
5-minute cooldown per backend (COLD_PROBE_COOLDOWN_SECS = 300) a harness that advertises nothing stays cold, and its re-read starts no second session until the cooldown passes
Configured harness only a picker asking about another harness (a Bot's own ?backend=) keeps today's answer
No frame on failure a probe that cannot start a session sends no models_changed, so nothing re-reads in a loop
Never raises any error leaves today's cold answer

test/test_models_cold_probe.py and test/test_api_models_kas_bundle.py pin these, and website/src/test/useWebSocket.modelListRefetch.test.ts pins the dashboard's re-read on models_changed.

builder-security checked: no new route, bind, listener or auth check. The probe runs inside the existing authenticated GET /api/models handler, and the models_changed frame carries an empty payload to dashboards already connected.

Backwards compatibility

Compatible: the change is the one already merged on main, and its own compatibility note applies unchanged. /api/models answers the same body as before; a cold read now also starts one bounded background probe.

Removes nothing: no setting, route or behaviour that 0.12.0 accepts is removed.

Tests

Proof: not provable -- other: a backport of a main commit whose proof ran on its own PR

  • CI does not run the backend suite on PRs into release/*, so the related set was run here: every touched test file plus every test file that imports a touched module or reads /api/models, 134 files, one pytest process per batch of 20, -n 0. 5405 passed, none failed.
  • Frontend: useWebSocket.modelListRefetch.test.ts plus every test that imports useWebSocket or the app SDK index, 41 files, 370 passed.
  • flake8 passes on the changed Python files.

Manual verification

N/A - the fix was verified on its own main PR. The 0.12.1 RC soak is the end-to-end check.

Screenshots / video

Why no screenshot: the frontend change only re-reads the model list on a new frame; it is applied from main unchanged and reviewed on its own PR.

Related Issues

Backport to the 0.12 line for 0.12.1 of #31569. Source issues: #31280, #31566.

Sibling sweep

Siblings: none -- the source PR carried its own sibling sweep; this PR only carries that fix.

Pattern harvest

Not generalizable: this PR only carries a fix already on main. The source PR has its own harvest.

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

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 7, 2026 05:05
@buluoray
buluoray requested review from tim-finnigan and removed request for a team November 7, 2026 05:05
#31569)

* fix(models): fill a cold model list without waiting for the first chat

Codex and the other advertised-selection harnesses, and KAS on the
engine bundle, learn their models only from a session's session/new
answer. Before one runs, /api/models answers auto alone with a 200 the
dashboard keeps, so the picker shows only Auto until a first message.

On a cold read for the configured harness, start the deferred
background session in a background task and answer at once. Its
session/new fills the list through the existing capture, and a
models_changed frame makes the dashboard re-read. One probe at a time,
none while a background session is live, and no frame when the start
fails, so a harness that advertises nothing cannot loop.

Closes #31566
Closes #31280

* test: wait on the cold probe task by signal, not a 5s bound

The wait-discipline ratchet refuses a short fixed wait_for in a new
test file. await_until takes the task the test already holds and uses
the lost-run bound instead.

(cherry picked from commit 2552c90)
@buluoray
buluoray force-pushed the crew/slack/0.12.1-batch-24 branch from 0e3ba3e to 928a589 Compare November 7, 2026 05:14
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings (all downgraded on adjudication)

GPT 6.1 flagged blocking issues on 928a58916d014052d7a713b14bd511a77d4bb3ea; Opus 5.5 adjudication downgraded every one of them. Downgraded: the remedy each one needs is disproportionate to the harm it prevents. Adjudication downgraded all 1 blocking finding(s): the remedy each one requires is disproportionate to the harm it prevents.

This comment is updated in place on each push.

Review details

BLOCKING -- src/kiro_crew/dashboard/handlers/models_cold_probe.py:98 -- Cold-list refresh is lost before the first WebSocket connects

state.broadcast_ws(MODELS_CHANGED_EVENT, {})
Trigger: On a cold chat-page load, /api/models starts _probe while the initial WebSocket upgrade fails and retries. The probe finishes before socket registration; WebSocketHub.broadcast_ws drops the frame because no clients are connected.
Outcome: The successful Auto-only response disables model-list polling and remains fresh indefinitely. The first successful connection runs runFirstConnect, which does not refetch models, so the picker stays Auto-only until a reload or session-spawn event despite the populated server catalog.
Anchor: defect
Fix: Refetch available-model queries on the first successful WebSocket connection, sequencing that refetch after any pending initial model fetch settles.

[BLOCK-MERGE-DOWNGRADED] 928a589
[GPT-REVIEWED] 928a589

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F1: LOW harm. The failure needs two things to happen in order. First, _probe has to finish a full background get_bg_session() and destroy() (models_cold_probe.py:89-95), which means starting the harness's session/new. Second, the dashboard's WebSocket must still be unregistered at that point, so the broadcast at :98 reaches nobody. That only happens when the initial upgrade fails and retries. When it does, the picker shows Auto only, which is how it behaved before this PR. It recovers without help: the first chat's spawned frame invalidates available-models (website/src/hooks/useWebSocket.ts:650-651), and a reload does too. The problem is visible and nothing is lost.
The proposed fix adds a models refetch on every first connect, ordered after any pending initial fetch. That is a new ordering contract inside runFirstConnect (reconnectCatchUp.ts:44), whose comments deliberately avoid redundant boot round-trips. Every page load would carry that cost to cover a rare race whose worst case is the old behavior.

[ADJUDICATION] 928a58916d014052d7a713b14bd511a77d4bb3ea total=1 uphold=0 downgrade=1
DOWNGRADE F1 src/kiro_crew/dashboard/handlers/models_cold_probe.py:98 reason=disproportionate-remedy
[GPT-ADJUDICATED] 928a58916d014052d7a713b14bd511a77d4bb3ea

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

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Nothing to check. This change adds or alters no control, label or string. It only refetches the existing model picker's list when a models_changed frame arrives, so no screenshot is needed.

[UX-REVIEWED] 928a589

Description read

[DESCRIPTION-READ] 6ac77df6ef72186e910fad525d1b7409bc67e6325038bd2c8fa4e0c4b656b054

That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

This is a clean -x pick of a fix that has already been reviewed, and it is bounded by a single-flight guard, a per-backend cooldown and a check that only the configured shared-runtime backend is probed.

Notes

  • The release branch cannot go green until the main split of agents.py lands. Once it does, pick it onto this branch ahead of this commit, as the description says. Do not add a baseline row instead.

[DESIGN-REVIEWED] 928a589

Description read

[DESCRIPTION-READ] 3350a0d1a29dc7903ee1ee5233d04a4fc0828f6171cf51f30294b919e8c74e1c

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

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

This is a clean backport of #31569, whose defect is reported in #31280 and #31566. Every item fixes the cold-list mechanism directly and has one emitter and one consumer.

What this change ships

Inventory (6 items) — 6 justified

Intent: let a 0.12.0 user see their harness's real models in the picker after a restart or re-sign-in, without sending a chat first. This is a FIX, backported unchanged from main.

  1. When /api/models finds the model list empty on an advertised-selection harness, it starts one throwaway background session to fill the list — justified
  2. The KAS bundle route does the same when nothing is recorded for the signed-in account — justified
  3. A new models_changed dashboard frame tells every open dashboard to read the list again (case 'refresh' invalidates every cache, so reusing it is not a smaller option) — justified
  4. The probe is limited to one at a time, one per backend every 300 s, and only on the configured harness on the shared runtime — justified
  5. models_changed joins the tier-0 lists in ws_event_scope.py and app-sdk/index.ts, so apps receive it too — justified
  6. The model-selection, app-kit-platform and feature-map docs describe the cold fill — justified

[FIRST-PRINCIPLES-REVIEWED] 928a589

Description read

[DESCRIPTION-READ] d5f3348b256d0851fc965dc732dc357fd76a584b442b0ac9eaa137f1a4ab447f

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 928a589

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

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

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision labels Nov 7, 2026
@buluoray
buluoray merged commit e908209 into release/0.12.0 Nov 7, 2026
35 of 52 checks passed
@buluoray
buluoray deleted the crew/slack/0.12.1-batch-24 branch November 7, 2026 06:07
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Nov 7, 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.

1 participant