Subagents: a new chat reads /models again, so subagents switched on later show
ci / check (push) Failing after 3s
ci / start (push) Failing after 3s

The Subagents chip on a new chat follows `/models` -> model.subagents.offered, the same
team_run.offered the web page renders from. The app read /models once, at sign-in, and kept
it while it stayed open in the tray: subagents switched on afterwards (or a model added)
never reached a new chat until a restart. startNew() now re-reads it (at most every 5 s,
keeping the last list if the read fails) and redraws the draft's chips (modelsChanged()).
An open chat already re-reads its own `subagents` with GET /chats/{id}.

tests/ui: A5 cases -- parallel model offered: chip, slider to the server's cap, no note;
one-request model offered named_only: the `own` note; offered false everywhere: no chip;
switched on while open: the next new chat has it; an open chat follows its `subagents`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Opus 5.5 committed 2026-11-10 08:17:30 +00:00
1 parent 5a87eec28d
commit ec32bca644
4 files changed
+132 -3

No files matched your search

+12
View File
@@ -996,6 +996,18 @@ export function draftKind() {
return draft?.kind || lastKind
}
/** `/models` was read again: a new chat being written is drawn with what it says now. */
export function modelsChanged() {
if (!draft) return
const models = ctx.models()
if (!models.some((m) => m.id === draft.model)) {
const start = models.find((m) => m.default) || models[0]
draft.model = start?.id || ""
draft.effort = levelsOf(start).start
}
renderChips()
}
/** The greeting of a new chat, and the choice of what it is. */
function renderHello() {
const box = $("new-chat")