Repository navigation
Keep ACP-native model state in sync with the agent - #5053
Merged
ymichael merged 1 commit intoOct 8, 2026
Merged
Conversation
get-bb#5141 applies changed model, effort, and tier on follow-up turns, but its snapshot of the agent's current selection could go stale in three ways: - Setters answering without state (session/set_model's spec response is an empty object, which Hermes Agent sends) left the snapshot on the agent's startup model, so switching back to that model was skipped and the turn ran on the previous one. - A model the agent switched itself was never re-asserted, because the bridge compared the request only with the previous request. - A model acknowledged before a later effort or tier setter failed was dropped from the snapshot. Selectors now record each acknowledged setting on the session as it lands, fall back to the requested value when the response carries no state, and reconciliation re-applies the selection when the snapshot's model differs from the requested one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
codex/fix-acp-live-model-selection
branch
from
October 8, 2026 04:19
f1e00d8 to
6a1144c
Compare
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.
Human comments
What was wrong
#5141 fixed #5051 by applying a changed model, effort, or tier before each follow-up prompt. It decides whether to call a setter by comparing the request with
AcpThreadSession.nativeConfig, its snapshot of the agent's current selection. That snapshot could go stale in three ways, and then bb skipped a switch it needed to make:session/set_modelresponse is an empty object. Hermes Agent returns{}. The snapshot then stayed on the agent's startup model, so switching back to that model was skipped and the turn ran on the previous one.reconcileExecutionSettingscompared the request only with the previous request, so aconfig_option_updatethat moved the agent off the requested model was never corrected.What changed
All changes are in
packages/provider-bridge-acp/src/bridge/bridge.ts. The PR was rebased onto #5141 and keeps its design. It no longer carries this PR's original parallel implementation.selectAcpNativeModel,selectAcpNativeReasoning, andselectAcpNativeServiceTierwrite each acknowledged setting tosession.nativeConfigas it lands. When the response carries no state, they record the requested value.reconcileExecutionSettingsalso re-applies the selection when the snapshot's model differs from the requested one (acpNativeModelDrifted).nullresult like the model setters.No wire, CLI, or SDK surface changes.
How you verified
src/bridge/bridge.test.ts: A → B → A with empty setter results (config option andmodelsstate), an agent self-switch, a tier failure after an acknowledged model change, and a queued steer that changes the model. The first four fail on main and pass with the fix. The steer test passes on both and stays as a regression guard.fake-acp-agent.mjsgainsFAKE_ACP_EMPTY_MODEL_RESULTand aself-switch-modelprompt.pnpm exec turbo run typecheck lint test --filter=@bb/provider-bridge-acp: passed (385 tests, 4 skipped).pnpm start:worktreeinstance, with a wrapper logging ACP traffic and each agent's own records as ground truth:gpt-6.1-sol, thengpt-6-luna, then back togpt-6.1-sol. With main's bridge, bb sent noset_modelon the third turn and Hermes's session ended ongpt-6-luna. With this branch, bb sent the switch and the session ended ongpt-6.1-sol.Fixes #5051
🤖 Generated with Claude Code