Bug
After configuring a town to use anthropic/claude-opus-4.6 for all agent models (via the per-role model settings), the mayor reverts to kilo/auto-free after a container restart. Changing the model via the settings page has no effect — the mayor continues using kilo/auto-free.
Observed Behavior
- Created a new org town
- Configured all models to
anthropic/claude-opus-4.6 in town settings
- Mayor initially used Opus 4.6 correctly
- Container restarted (deploy, eviction, or manual restart)
- Mayor came back using
kilo/auto-free instead of the configured model
- Changing the model in settings did not fix it — the mayor kept using
kilo/auto-free
- Had to manually use
/models in the mayor CLI to select Opus 4.6
Likely Cause
The model is baked into KILO_CONFIG_CONTENT at agent dispatch time (container/src/agent-runner.ts:buildKiloConfigContent). When the container restarts and the mayor is re-dispatched, the model is resolved from townConfig.default_model (or townConfig.role_models.mayor). If the town config read at dispatch time returns a stale or default value, the model defaults to kilo/auto-free.
This may be related to #1614 (settings save hangs for 15s — the updateMayorModel call may not be completing), #1438 (model change doesn't update running session), or #1756 (org billing context lost after model change — the same config propagation gap).
The settings page change not taking effect suggests syncConfigToContainer or updateMayorModel is failing silently, or the container is reading a cached config rather than the latest from the TownDO.
Files
src/dos/Town.do.ts — ensureMayor, sendMayorMessage (model resolution at dispatch)
src/dos/town/config.ts — buildContainerConfig (what gets synced)
container/src/agent-runner.ts — buildKiloConfigContent (model injection)
src/trpc/router.ts — updateTownConfig mutation (model change propagation)
Acceptance Criteria
Bug
After configuring a town to use
anthropic/claude-opus-4.6for all agent models (via the per-role model settings), the mayor reverts tokilo/auto-freeafter a container restart. Changing the model via the settings page has no effect — the mayor continues usingkilo/auto-free.Observed Behavior
anthropic/claude-opus-4.6in town settingskilo/auto-freeinstead of the configured modelkilo/auto-free/modelsin the mayor CLI to select Opus 4.6Likely Cause
The model is baked into
KILO_CONFIG_CONTENTat agent dispatch time (container/src/agent-runner.ts:buildKiloConfigContent). When the container restarts and the mayor is re-dispatched, the model is resolved fromtownConfig.default_model(ortownConfig.role_models.mayor). If the town config read at dispatch time returns a stale or default value, the model defaults tokilo/auto-free.This may be related to #1614 (settings save hangs for 15s — the
updateMayorModelcall may not be completing), #1438 (model change doesn't update running session), or #1756 (org billing context lost after model change — the same config propagation gap).The settings page change not taking effect suggests
syncConfigToContainerorupdateMayorModelis failing silently, or the container is reading a cached config rather than the latest from the TownDO.Files
src/dos/Town.do.ts—ensureMayor,sendMayorMessage(model resolution at dispatch)src/dos/town/config.ts—buildContainerConfig(what gets synced)container/src/agent-runner.ts—buildKiloConfigContent(model injection)src/trpc/router.ts—updateTownConfigmutation (model change propagation)Acceptance Criteria
role_models.mayor) respected at dispatch time