Skip to content

session: under one model every role resolves to the one model, through one reader - #2129

Merged
santoshkumarradha merged 3 commits into
app/v3from
fix/one-model-covers-aux
Nov 3, 2026
Merged

santoshkumarradha merged 3 commits into
app/v3from
fix/one-model-covers-aux

Conversation

@santoshkumarradha

Copy link
Copy Markdown
Member

What was wrong

Under --one-model, a long run on deepseek/deepseek-v4.1-flash still sent a few auxiliary calls to other models: 4 mark-reader calls went to the mastermind tier's model and 2 reflex calls went to the reflex tier's model (google/gemini-2.5-flash, the build's default reflex model). The rest of the 1896 calls used the one model.

Cause

The session did not enforce the one-model promise itself. The launch kept it by withholding the tier rows and role pins (RolesSource = nil). Inside the session, only the errand door (callRole) checked OneModel, and it changed only the ladder's floor. The pin and tier rungs above the floor still answered whatever source the session had. The reflex client and about twenty other lookups (auditor, guardian, shaper, spell-out, intake, repair, designer, careful grade, task name, team proposal, planner/worker of an adaptive run, task seats, delegate crew, landing settle model, sentinel judge) read RolesSource directly and never checked the flag. So a one-model session that received any roles source sent crew-only roles to their tiers.

Fix

  • internal/session/rolemodel.go is now the one reader that every role lookup in the session uses. Under one model, each text role has exactly one rung: the conversation's live model. Media roles (vision, imagegen, speech, video) keep only their explicit pin, because they are chosen by capability (roles.IsMedia).
  • All direct RolesSource reads in internal/session now go through the reader. Copying the source into a child Config is still allowed, and OneModel travels with it.
  • session.ConfigRoutes(cfg) reports the model each registered role would use on a session built from a config. The door tests use it.

Tests

  • TestOneModelEveryRegisteredRoleResolvesToTheConversationModel, TestOneModelErrandsGoOutOnTheConversationModel and TestOneModelReflexGoesOutOnTheConversationModel enumerate roles.Registered(). Each gives a one-model session a source that names another model for every pin and tier. All three were red before the fix: every errand role, the mark reader included, and the reflex left the one model.
  • TestEveryRoleResolutionGoesThroughTheRoleReader is a structural test. It fails if any non-test session file reads RolesSource other than to copy it into a child config.
  • TestOneModelFlagHoldsForEveryRegisteredRole and TestSavedOneModelSettingHoldsForEveryRegisteredRole (cmd/codeaf) pin every registered role plus the auxiliary (small-jobs) pin to other models. They check that every text role resolves to the one model, both under --one-model (also when the profile's source is handed over) and under the app's saved models.tasks.mode=one.

Live check

Two short real runs used codeaf chat --one-model --model deepseek/deepseek-v4.1-flash on OpenRouter. The profile pinned markreader to openai/gpt-6.1-sol, reflex to google/gemini-2.5-flash, and every tier to non-DeepSeek models. The call log recorded 52 completed calls. All 52 (100%) went to deepseek/deepseek-v4.1-flash: turn 14, memory 21, task 5, caption 3, markreader 3, reflex 2, title 1, taskname 1, handoff 1, handoff-draft 1. The usage ledger recorded 29 rows, all on the same model.

Limits

  • I did not find which launch path handed the original run a roles source. This change makes the session keep the promise whatever the launch hands it.
  • The run engine's own crew factory (internal/run) and factory triage read profile tier rows outside the session. Both already check one model their own way (Seats.One, the launch pin). This PR does not change them.

🤖 Generated with Claude Code

…h one reader

The one-model promise was kept by the doors withholding the tier rows and
role pins. The errand door moved only its floor, so the rungs above it still
answered any source the session held, and the reflex ignored the flag. A
one-model session handed a source sent the mark reader to the mastermind tier
and the reflex to the reflex tier.

Every role lookup in internal/session now goes through rolemodel.go's reader.
Under one model a text role has one rung, the conversation's model; a media
role keeps only its explicit pin. Tests enumerate the role registry for the
flag and the saved one-model setting, and a law test fails any session file
that reads RolesSource directly.
@santoshkumarradha
santoshkumarradha marked this pull request as ready for review November 3, 2026 11:17
@santoshkumarradha
santoshkumarradha merged commit e92a89d into app/v3 Nov 3, 2026
@santoshkumarradha
santoshkumarradha deleted the fix/one-model-covers-aux branch November 3, 2026 11:17
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