feat(agentbase): add shared model-forwarding helpers#3025
Open
anuj7511 wants to merge 1 commit into
Open
Conversation
Add AppendModelFlag and ModelConfigField to agentbase so adapters whose CLI accepts a launch-time --model override can forward the resolved ports.AgentConfig.Model through one tested implementation instead of each re-implementing the same trim-and-append plus config-field literal. AppendModelFlag appends --model <trimmed> when the configured model is non-blank and is a no-op otherwise; ModelConfigField returns the standard user-facing model config field. The opt-in stays per-adapter: agentbase never forces the field on embedders, so adapters whose CLI spells the override differently (a config-file key, a -m-only alias) are unaffected.
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.
Summary
Adds two reusable helpers to
agentbaseso adapters whose CLI accepts a launch-time--modeloverride can forward the resolvedports.AgentConfig.Modelthrough one tested implementation, instead of each adapter re-implementing the same trim-and-append plus a hand-written config-field literal:AppendModelFlag(cmd, cfg)— appends--model <trimmed>when the configured model is non-blank; no-op otherwise.ModelConfigField(description)— the standard user-facingmodelconfig field.Context
AO stores a per-role model in
agentConfig.model;session_manager.effectiveAgentConfigresolves it and forwards it to every adapter ascfg.Config.Model, but each adapter must opt in to passing it to its CLI. A family of ~15 adapters currently drops it. This is the shared base those adapter fixes build on.The opt-in stays per-adapter by design:
agentbasenever forces the field on embedders, so adapters whose CLI spells the override differently (a config-file key, a-m-only alias) are unaffected. Adapters just call the helpers where they apply.Tests
New
agentbase_test.gocoversAppendModelFlag(trimmed append / blank no-op) andModelConfigField.go build ./...,go vet, andgofmtare clean.Follow-ups
The per-adapter fixes rebase onto this base as independent, single-adapter PRs (Cursor #2926, Devin #2927, then the remaining sisters).