Repository navigation
session: under one model every role resolves to the one model, through one reader - #2129
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
Under
--one-model, a long run ondeepseek/deepseek-v4.1-flashstill 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) checkedOneModel, 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) readRolesSourcedirectly 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.gois 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).RolesSourcereads ininternal/sessionnow go through the reader. Copying the source into a childConfigis still allowed, andOneModeltravels 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,TestOneModelErrandsGoOutOnTheConversationModelandTestOneModelReflexGoesOutOnTheConversationModelenumerateroles.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.TestEveryRoleResolutionGoesThroughTheRoleReaderis a structural test. It fails if any non-test session file readsRolesSourceother than to copy it into a child config.TestOneModelFlagHoldsForEveryRegisteredRoleandTestSavedOneModelSettingHoldsForEveryRegisteredRole(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 savedmodels.tasks.mode=one.Live check
Two short real runs used
codeaf chat --one-model --model deepseek/deepseek-v4.1-flashon OpenRouter. The profile pinnedmarkreadertoopenai/gpt-6.1-sol,reflextogoogle/gemini-2.5-flash, and every tier to non-DeepSeek models. The call log recorded 52 completed calls. All 52 (100%) went todeepseek/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
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