Skip to content

feat(apps): per-app model setting under Settings → Chat → Model - #19507

Merged
bolichen97 merged 2 commits into
mainfrom
fix/4754-per-app-model
Oct 13, 2026
Merged

bolichen97 merged 2 commits into
mainfrom
fix/4754-per-app-model

Conversation

@cruisercohen

@cruisercohen cruisercohen commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Let a user choose, per app, the model that app's sessions and background agents start on, without touching the global default.

Today you can switch the model for one session from the composer. Research has a per-campaign model, and Spec Builder has a default model for new spec sessions. Every other app inherits the global default unless the user re-pins each session by hand. So there is no way to say "this app should use the strong model" or "this app should use the cheap one".

Why it matters

Users want a strong model for high-stakes app workflows and a cheaper one for routine app work. Without a per-app choice, they pay for the flagship everywhere or keep re-pinning sessions by hand.

Not a goal

  • No app-declared model. A manifest hint such as modelTier would resolve through decisions.model_route. That map is documented as the Auto router's tier models, so an operator who pinned the complex tier would see app sessions silently move to that model. That changes a configured value's meaning and its cost.
  • No change to automatic routing. model.route and decisions.model_route are untouched.
  • No default changes. Unset means inherit, for every app.
  • The issue stays open as a real gap. It is not closed as already delivered.

What changed (motivation → approach → change)

The issue leaves open whether an app's preferred model is declared by the app author or chosen by the user. This PR takes the user-chosen setting:

  • it is strictly opt-in;
  • it moves no default and no cost;
  • model ids stay user-written.

Config. apps.<name>.model is a new top-level record map (AppSettingsConfig, model: str = "").

  • It loads, round-trips, and preserves unmodelled keys, like workspaces / memory_stores.
  • A malformed table or entry reads as inherit.
  • config-baseline.json is regenerated.

Precedence, highest first:

  1. the model picked for the session (the composer, or a pin on the slot)
  2. the app's own pick: a Research campaign's model and the Spec Builder default, which both ride the slot's model and so still win
  3. a model pinned on the agent or crew
  4. the per-app setting (new)
  5. the global default

Sessions. resolve_effective_model(..., app_name=) gains the per-app tier after the agent/crew tiers. With no app_name the call is unchanged.

  • The chat turn and the pre-warmed session both pass the slot's owning app (slot._app), so non-app sessions never read the setting.
  • The per-app id becomes the session's model request, which every inherited default already rides. The provider therefore withholds an id the account cannot run, exactly as today.
  • The id is never written into the slot's own model, so the slot keeps inheriting.

App spawns. A spawn that passes no model gets the per-app setting, unless the spawned template pins its own model. A crew that shares the template's name does not count: an app spawn allocates the template with no crew, so its session never reads that crew's pin. Because it fills the spawn's model, a set value also outranks agent.role_models.subagent for that app's spawns.

Settings write. The config PATCH allowlist matches apps.<kebab-name>.model by the manifest name grammar, since apps install at runtime. It applies the same grammar and entitlement check as the agent.role_models.* pins, so a model the account cannot run is refused.

Settings UI. An Apps group sits at the end of Settings → Chat → Model. There is no Apps tab in Settings, so the per-app rows sit with the other model defaults.

  • One picker per enabled app, by display name. The first option is Inherit, labelled with what it falls back to: Inherit (), or Inherit (auto) when that row is unset. The advertised models follow, except auto.
  • Each row's (i) hint lists what still wins over the setting.
  • A retained pin the account stopped advertising stays shown, and a refused save shows an inline error.
  • Strings are in every locale, plus the pseudo-locale and translator context.
  • The settings-search map registers the file. Its rows are labelled with each app's name, so no registry entry is added.

Composer chip. GET /api/agents/resolved-model takes an optional app: a kebab-case app name, and anything else is ignored. The composer passes the slot's owning app, so an app session's chip names the model the session starts on rather than the global default.

Docs. The model-selection spec names the new tier, and the feature map's chat row lists it.

Backwards compatibility

Compatible: the apps table is new and empty by default. Every resolver call without an app name is unchanged, and an app with no setting resolves exactly as before.

Removes nothing: the change only adds a config table, a resolver tier that is empty by default, a PATCH path and a Settings group; no key, path, validator or reader is narrowed or removed.

Tests

test/test_app_model_setting.py:

  • The table loads, round-trips and preserves unmodelled keys. Malformed input, "", "auto" and an unknown app all read as inherit.
  • Unset or "" resolves exactly as without the setting, for the resolver, a real chat turn on an app-owned slot, the pre-warm path and an app spawn.
  • A set value wins over the global default, and is the session's model request (not a slot pin).
  • An explicit slot pick, the Spec Builder and Research picks, a crew pin and a template pin each beat the setting.
  • Non-app slots and other apps are unaffected.
  • The PATCH writes under the app, accepts Inherit, and refuses an unentitled or malformed id. Path grammar is covered.
  • The spawn tier differs from the chat session's agent tier for a template name when the default crew pins a model: the spawn still gets the per-app setting. The test shows the spawn's session would not run on that crew pin.
  • A crew sharing the spawned template's name does not hide the setting, and the spawn's own model verdict (_spawn_effective_model with no crew) runs on the app's model.
  • The resolved-model endpoint includes the owning app's setting, is unchanged without app, and ignores a value that is not an app name.
  • Red without the fix: the turn, pre-warm and spawn tests fail against main.

website/src/pages/settings/AppModelsSection.test.tsx:

  • Default Inherit rows for enabled apps only.
  • The Inherit label names the Default Model, or auto when that row is unset.
  • A pick, and an Inherit pick, PATCH that app's path.
  • A retained pin stays shown.
  • A refused save is reported.
  • The empty and failed app list.

Other test changes:

  • The ChatPanel model tests mock the app list the panel now reads.
  • The settings coverage test accounts for the dynamic row label.
  • AcpAdapter.defaults.test.ts and useChatPageComposerChips.test.tsx cover the chip passing the slot's owning app to the resolver, and passing none for a slot no app owns.

Manual verification

Captured the built SPA with fixtures (screenshots below):

  • an app with a stored pick shows that model;
  • unset apps show Inherit, naming the Default Model;
  • a disabled app is not listed;
  • the open picker lists Inherit, then the advertised models;
  • the row hint;
  • the empty, load-failure and refused-save states.

Locally, these pass on touched files:

  • black, isort, flake8, mypy;
  • tsc, eslint, the i18n check (with its diff-scoped base ref);
  • the fast-gate scripts.

Screenshots / video

Settings → Chat → Model → Apps. Meetings is pinned to a model, and the other enabled apps inherit the Default Model (named in the option). The disabled app Papyrus is not listed:

Per-app model rows

A row's picker: Inherit first, then the account's advertised models.

Per-app model picker open

A row's (i) hint, naming what still wins over the setting:

Per-app model row hint

Empty and error states

No enabled app:

No apps are enabled

The app list cannot be read:

Could not load your apps

A refused save. The row returns to its stored value, and the inline error names the app:

Could not save the model for Mochi

Composer chip in an app session. Both rows run the real composer-chip hook and the real resolved-model request. Meetings is set to claude-haiku-5 and the Default Model is claude-opus-5. The Meetings session asks with app=meetings, so its chip names claude-haiku-5. An ordinary session asks with no app and still names claude-opus-5:

Composer chip in a Meetings session and an ordinary session, dark theme

Composer chip in a Meetings session and an ordinary session, light theme

Related Issues

Fixes #4754

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.

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

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🟡 CONCERNS

UX-level review of 74b33b675d5a8e77b4c461317d3e5d06a91a16e7 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

People can't tell "Inherit (claude-opus-5)" apart from "claude-opus-5" in the per-app picker, and the help text repeated on every row names things the user can't see.

Watch

  • Inherit and the explicit model look the same. optionLabels puts the fallback model in the Inherit label, so the same model name appears twice in the list. The blind reader said: "I can't tell why 'Inherit (claude-opus-5)' and plain 'claude-opus-5' are separate choices". So users won't know that picking the explicit model pins it and stops it following later Default Model changes. This hits every user who opens the picker, on the PR's main control.
  • The row hint confuses more than it explains. Every row repeats the same row_hint. It points to a "Default Model above" the reader couldn't find, and it cites "Research Lab" and "Spec Builder", which weren't in the app list. The reader also took "still win" to mean "this setting might be ignored. I can't tell when." The rule really applies to the whole section, yet the reader had to hover each row to find it.
  • The empty and error states leave the user stuck. For "No apps are enabled." the reader said it "doesn't tell me where to turn apps on". For "Couldn't load your apps." they said "no 'try again' button… I don't know what I should do next". This only happens occasionally, but the user hits a dead end every time.

Suggestions

  • Rename the first option to Same as Default Model (claude-opus-5), so it can't be mistaken for the plain model entry.
  • Move the precedence rule out of every row's (i) and into the section description, once, in plain words: "Unless a session, app or agent already picks a model." Drop the app names Research Lab and Spec Builder from it.
  • Add a link to Apps → Library on none_enabled, and a "Try again" button on load_failed that refetches the app list.

[UX-REVIEWED] 74b33b6

Description read

[DESCRIPTION-READ] 8aef4eacbd1f72a373bf60d1bd41852e134e74075a039697195c5a6e575ac557

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 74b33b675d5a8e77b4c461317d3e5d06a91a16e7 — 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/CONCERNS are advisory.

First-Principles-Verdict: PASS

Check that operators accept a set apps.<name>.model taking precedence over agent.role_models.subagent for that app's background spawns.

What this change ships

Inventory (8 items) — 8 justified

Intent: let a user pick, per app, which model that app's sessions and background agents start on, without changing the global default. This is an ADDITION, and every app defaults to Inherit.

  1. New "Apps" group at the end of Settings → Chat → Model, with one picker per enabled app (Inherit plus the advertised models) — justified
  2. Chat sessions an app owns start on that app's chosen model when no session, app or agent/crew pick wins over it — justified
  3. App background spawns with no explicit model run on the app's chosen model, unless the spawned template pins its own — justified
  4. A set per-app model takes precedence over agent.role_models.subagent for that app's spawns — justified
  5. The composer model chip on an app session names the per-app model (new optional app query on GET /api/agents/resolved-model) — justified
  6. New persisted config table apps.<name>.model; it round-trips unknown keys, and malformed values read as inherit — justified
  7. Config PATCH accepts apps.<kebab-name>.model, checked against the manifest name grammar, with the same validation as role-model pins — justified
  8. A saved pin the account no longer advertises stays shown, and a refused save shows an inline error — justified

[FIRST-PRINCIPLES-REVIEWED] 74b33b6

Description read

[DESCRIPTION-READ] f510ddf6a1a256b7349050c4a6ee984cc1e62f839d0890b090f80db080d331c2

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 Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 74b33b675d5a8e77b4c461317d3e5d06a91a16e7 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check that the stored apps.<name> entry is removed when an app is uninstalled. Otherwise a different app installed later under the same manifest name silently picks up the old model.

[DESIGN-REVIEWED] 74b33b6

Description read

[DESCRIPTION-READ] 9b45dd181e51f34c1ef7757d318db8eb3119ee8d9f6892205560ab10e6a888d1

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 Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 74b33b6

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable 74b33b675d5a8e77b4c461317d3e5d06a91a16e7: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 74b33b6

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 74b33b675d5a8e77b4c461317d3e5d06a91a16e7: <one-sentence reason>

@cruisercohen
cruisercohen force-pushed the fix/4754-per-app-model branch from 3e007ff to bdf0601 Compare October 12, 2026 19:36
@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 Oct 12, 2026
@cruisercohen
cruisercohen force-pushed the fix/4754-per-app-model branch from bdf0601 to 976af30 Compare October 12, 2026 20:18
@cruisercohen

Copy link
Copy Markdown
Contributor Author

UX Review, addressed on the new head:

Evidence gaps. The PR body now has stills for:

  • the empty state ("No apps are enabled.");
  • the failed app list ("Couldn't load your apps.");
  • a refused save ("Couldn't save the model for Mochi.").

"Inherit" doesn't say what it inherits. The option now names its source. It reads Inherit (<Default Model>), for example "Inherit (claude-opus-5)", or Inherit (auto) when the Default Model row is unset. A test pins both forms.

The description is a long paragraph. The group description is now one line: "The model each app's sessions and background agents start on." The list of what still wins moved into each row's (i) hint, the same tooltip the sibling Subagent Model and fallback rows carry. There is a still of it open.

Placement. Kept under Settings → Chat → Model:

  • Settings has no Apps tab.
  • Every model default the user can set already sits on this page: the Default Model, role models and fallbacks. Inherit falls back to the Default Model row directly above, which the hint says.
  • A link to this group from each app's page would be a new entry point on a different surface. It is left out of this PR.

@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 Oct 12, 2026
@cruisercohen
cruisercohen force-pushed the fix/4754-per-app-model branch from 976af30 to cfdc818 Compare October 12, 2026 20:53
@cruisercohen

Copy link
Copy Markdown
Contributor Author

Review findings, addressed on the new head:

GPT 6.1 (blocking), autouse fixture on the shared monkeypatch. TestAppSpawn._known_agent now patches through _floor_monkeypatch.

Opus 5.5, the chip on an app-owned slot names the global default.

  • GET /api/agents/resolved-model now takes an optional app and passes it to resolve_effective_model as app_name. Only a kebab-case app name is used; anything else is ignored, so the answer without app is unchanged.
  • The composer passes the slot's owning app (slot.app), so the chip names the model the session starts on.
  • Tests cover the endpoint (with an app, without one, and with a value that is not an app name), the adapter passing the app through, and the composer hook asking with the owning app (and with none for a slot no app owns).

First Principles, resolve_app_spawn_model re-spells _agent_tier_model. The two tiers must give different answers for the same agent, so the spawn keeps its own rule. _agent_tier_model follows the chat session: a name that is no crew reads as the default crew, whose pin is that session's agent tier. A spawn's session (session._session_model) does not apply the default crew's pin to a template name.

Going through _agent_tier_model would therefore drop the per-app setting for a spawn that never runs on the crew's model. test_the_default_crews_pin_does_not_block_a_spawn pins this:

  • _agent_tier_model(cfg, "worker", …) returns the default crew's pin;
  • session._session_model(cfg, "worker") returns the global default;
  • resolve_app_spawn_model(cfg, app, "worker") returns the app's model.

The docstring of resolve_app_spawn_model says why it follows the spawn session's rule.

@cruisercohen

Copy link
Copy Markdown
Contributor Author

GPT 6.1 (blocking), the error notice had no hand-off decision. The Apps group's ErrorNotice now carries the explicit No hand-off decision. The group mounts inside ChatPanel, whose localRoleOther / localBudget / localKeepChars drafts stay mounted while the Model page is open, so the agent-chat navigation would discard them. A refused save is retried by picking again, and the row already shows its stored value.

@cruisercohen
cruisercohen force-pushed the fix/4754-per-app-model branch from cfdc818 to 44be407 Compare October 12, 2026 21:46
@cruisercohen

Copy link
Copy Markdown
Contributor Author

Advisory notes on cfdc818a7b:

Design Review: two precedence rules for one setting. Each path takes the agent tier of the session it actually starts, and that is what the issue's ruled design asks for. The per-app setting fills the chain right after the session's agent model (slot.model or agent_model or …).

  • App chat session. A slot with no named agent runs as the default crew, so that crew's pin is its agent model. The session runs on that pin with or without this PR.
  • App spawn. The spawn's session does not run as the default crew (session._session_model), so that pin never applies to it. The setting fills the gap the spawn really has.
  • Why the paths differ. test_the_default_crews_pin_does_not_block_a_spawn pins this. Judging the spawn by the chat tier would drop the setting for a spawn that would otherwise run on the global default, not on the crew pin.

Letting the per-app setting outrank the default crew's pin for chat sessions would reorder the ruled precedence (agent or crew above the per-app setting), so this PR does not do it. It is a reasonable follow-up decision for the issue owner, and so is a notice on the Apps group when the default crew pins a model.

UX Review (CONCERNS). Taken as follow-ups, not changed here:

  • Inherit label. The Inherit label names its source next to the plain model list. Wording such as "Same as Default Model (…)" is a copy change for every locale.
  • Empty and error states. A Library link on the empty state and a Retry on the failed app list are new controls. Reopening the page re-reads the list today.
  • Refused save. The row returns to its stored value, which the still in the PR body shows. The notice sits above the group, as the other model rows on this page report theirs.

@cruisercohen
cruisercohen force-pushed the fix/4754-per-app-model branch from 44be407 to f06310e Compare October 12, 2026 22:30
@cruisercohen

Copy link
Copy Markdown
Contributor Author

Advisory notes on 44be407feb, answered on f06310e9a0:

First Principles Review: the app-name grammar was written out twice. Fixed. The PATCH allowlist no longer has its own regex. It splits the path on . and checks the middle segment with the manifest's KEBAB_RE.fullmatch, the same grammar crew_records.py imports. test_the_app_name_grammar_is_the_manifests fails without the change, and two trailing-newline paths were added to the rejected cases.

Design Review: an app's spawn model beats agent.role_models.subagent. That is intended, and it only happens when the user sets the app's model. With apps.<name>.model unset or "", an app spawn resolves exactly as before, role_models.subagent included (the inherit tests cover this). Once the user sets it, they have chosen a model for that one app's work, which is narrower than a global per-role pin. The order is the ruled one: an explicit pick, then the app's own pick, then a pinned agent or crew model, then the per-app setting, then the global tiers.

UX Review (advisory), not changed in this PR:

  • Inherit doesn't say what it follows. The label names the model the row inherits today (Inherit (claude-opus-5)), and the hint names the Default Model it follows. Rewording it as "Same as Default Model" is a copy choice, so I've left it for a maintainer to decide.
  • The hint repeats on every row. The per-row hint was added to clear the earlier UX BLOCK, which asked for the precedence to be visible at the row. Moving it back to the section heading would undo that fix.
  • The save error shows above the card. Each row saves with its own PATCH, and the shared notice names the failure. This path is rare, so it stays out of this change.
  • Library link and Retry. Both are outside this issue's scope.

@cruisercohen cruisercohen changed the title feat(apps): per-app model setting in Settings → Apps feat(apps): per-app model setting under Settings → Chat → Model Oct 12, 2026
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 12, 2026
@cruisercohen
cruisercohen force-pushed the fix/4754-per-app-model branch 2 times, most recently from e789606 to 057b2b3 Compare October 13, 2026 00:13
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention labels Oct 13, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 13, 2026
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 13, 2026
@cruisercohen
cruisercohen force-pushed the fix/4754-per-app-model branch from 36f1210 to 6c0a24d Compare October 13, 2026 08:05
@cruisercohen

Copy link
Copy Markdown
Contributor Author

Rebased onto current main; adapted 3 tests (and the matching docstring) to #18342's default-template change; no other change.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 13, 2026

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

This PR adds an opt-in apps.<name>.model setting. It resolves after the agent/crew tiers and before the global default for app-owned chat turns and pre-warm, fills the model of app spawns that pick none, and gets a Settings → Chat → Model picker plus an app query on the resolved-model chip. The session side and the PATCH path (KEBAB_RE.fullmatch plus _validate_role_model entitlement) look correct, and I found no way to write outside apps.<kebab>.model. The spawn tier has one real defect, the GPT 6.1 finding on 6c0a24d, and it has no reply. resolve_app_spawn_model (src/kiro_crew/config/loader.py, the crew = config.agents.get(agent_name) branch) treats a same-named crew's pin as the spawn's agent tier and returns "". But spawn_sdk only spawns templates from list_agents(), _selection_kind reads an explicit agent as "template", and subagent_manager/run.py:2288 then passes crew_agent="", so resolve_crew_identity and session._session_model ignore that crew entirely. A user who sets a model for the app therefore gets the template pin, role_models.subagent or the global default whenever a crew shares the template's name, with no notice, and test_a_crew_pin_wins (resolve_app_spawn_model(cfg, APP, "default") == "") pins that wrong answer instead of the real spawn's. Fix: drop the same-name crew branch and check only the spawned template's own pin (_resolve_named_agent_model(agent_name)). Then change that test to assert the app pin, and add one that drives _spawn_effective_model(model, agent, crew_agent="") to show the spawn actually runs on the app's model. — crew-pr-reviewer (deep re-check)

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 13, 2026
An app's sessions and background spawns can start on a model the user
chooses for that app. Unset or empty inherits, so nothing changes for
anyone who does not set it. Precedence, highest first: the session's own
pick, the app's own pick (Research campaign, Spec Builder default), the
agent or crew pin, the per-app setting, the global default. The value is
a model pin like the role-model pins: the Settings write validates it
against the account, and the session layer withholds an id the account
cannot run.

Refs #4754
One picker per enabled app writes apps.<name>.model. Its Inherit option
names the Default Model it falls back to, and each row's hint says what
still wins. A retained pin the account stopped advertising stays shown.
The composer chip asks the resolved-model endpoint with the slot's
owning app, so an app session names the model it starts on. Strings in
every locale; the model selection spec and the feature map name the
new tier.

Refs #4754
@cruisercohen
cruisercohen force-pushed the fix/4754-per-app-model branch from 6c0a24d to 74b33b6 Compare October 13, 2026 17:42
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 13, 2026
@cruisercohen

Copy link
Copy Markdown
Contributor Author

@iamwhatever thanks, the spawn tier was wrong. Addressed on 74b33b675d5a8e77b4c461317d3e5d06a91a16e7:

A same-named crew hid the app's model from a spawn. resolve_app_spawn_model no longer reads config.agents. It checks only the spawned template's own pin (_resolve_named_agent_model(agent_name), skipping the built-in kirocrew as the factory does). An app spawn allocates the template with crew_agent="", so a crew that shares its name is never its agent tier. The docstring and the PR body's "App spawns" paragraph now say this.

test_a_crew_pin_wins pinned the wrong answer. Renamed to test_a_same_named_crews_pin_does_not_win, and it now asserts the app pin (resolve_app_spawn_model(cfg, APP, "default") == APP_PIN while the default crew pins another model).

Show the spawn actually runs on the app's model. New test_the_spawn_runs_on_the_apps_model drives _spawn_effective_model(model, "default", crew_agent="") with that same pinned crew. With no model it runs on the global default, not the crew pin. With the model resolve_app_spawn_model returns, it runs on the app's model.

Tests. Both tests fail without the code change ('' == 'claude-haiku-5' and 'claude-opus-5' == 'claude-haiku-5') and pass with it. The rest of the file, the spawn backend, reasoning-effort and config tests are unchanged and pass.

Fold. The PR is at the two-commit cap, so the fix is folded into the second commit. The branch was also conflicting with main, so it is rebased onto e044ebaa30. The conflicts were four spots where main and this PR each added a line (two imports, a docstring list and a translator-context entry), and both sides are kept. The fold changes only resolve_app_spawn_model (the crew branch is gone, the docstring is updated) and the two tests above; git range-diff shows nothing else.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 13, 2026

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

Reviewed at 74b33b6: no blocking defects found.

@bolichen97
bolichen97 merged commit edd1166 into main Oct 13, 2026
107 of 114 checks passed
@bolichen97
bolichen97 deleted the fix/4754-per-app-model branch October 13, 2026 21:19
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 13, 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.

feat: Per-app / per-task model routing + quick session model switching

3 participants