Skip to content

fix(qwen): forward role-specific model config on launch and restore#2971

Open
Ashutsoh1729 wants to merge 1 commit into
AgentWrapper:mainfrom
Ashutsoh1729:fix/qwen-role-model-config-2893
Open

fix(qwen): forward role-specific model config on launch and restore#2971
Ashutsoh1729 wants to merge 1 commit into
AgentWrapper:mainfrom
Ashutsoh1729:fix/qwen-role-model-config-2893

Conversation

@Ashutsoh1729

Copy link
Copy Markdown

What

Forward the configured role model to the qwen CLI on both launch and restore, and advertise the model config field.

Why

Fixes #2893.

GetLaunchCommand and GetRestoreCommand built their argv without reading cfg.Config.Model, so a worker or orchestrator configured with a specific model silently started on Qwen Code's global default. The adapter also inherited the empty agentbase.Base.GetConfigSpec, so it never advertised a model field.

How

Mirrors the Codex fix in #2869:

  • appendModelFlag appends --model <trimmed model> when strings.TrimSpace(cfg.Config.Model) != "", called from both GetLaunchCommand and GetRestoreCommand.
  • GetConfigSpec override advertising model as ports.ConfigFieldString.

The flag is appended right after the permission flags so it sits with the other append*Flags output, ahead of --prompt or --resume. Qwen Code gives the CLI flag the highest precedence, so this wins over a user's config file value as intended.

Model values stay in Qwen's provider/model form; the adapter passes the string through untouched apart from trimming.

Testing

cd backend && go build ./... && go test -v ./internal/adapters/agent/qwen/...

Three new tests, proven to fail on main before the fix:

--- PASS: TestGetLaunchCommandAppendsConfiguredModel (0.00s)
--- PASS: TestGetLaunchCommandOmitsBlankConfiguredModel (0.00s)
--- PASS: TestGetRestoreCommandAppendsConfiguredModel (0.00s)
--- PASS: TestGetConfigSpecReportsModelField (0.00s)

TestGetLaunchCommandOmitsBlankConfiguredModel passes both before and after, so it pins the blank/whitespace case rather than restating the fix.

Checklist

  • Branched from main
  • One focused change; links the related issue
  • Follows AGENTS.md conventions and PR hygiene
  • Tests added for user-visible behavior
  • Relevant CI checks pass for the area touched

@somewherelostt

Copy link
Copy Markdown
Collaborator

Thanks for contributing to Agent Orchestrator.

This PR is being picked up by the current external contributor on-call pair:

If someone is already working on this, please continue as usual.
The on-call pair is added for visibility, tracking, and support, not to take over the work.
If you need help with review, direction, reproduction, or next steps, please tag @illegalcall and @Pulkit7070 here.

For faster context or live questions, you can also join the AO Discord.

Join the session here:
https://discord.gg/H6ZDcUXmq

Come by if you want to see what is being built, ask questions, or just hang around with the community.

@Ashutsoh1729

Copy link
Copy Markdown
Author

Review request

This PR mirrors the model-config forwarding pattern from #2869 (Codex) and #2969 (Auggie).

What I've verified

  • qwen v0.20.1 installed via brew install qwen-code — confirmed -m, --model <id> and -r, --resume <sessionId> flags exist and can coexist in the same command.
  • go build ./...
  • go test -v ./internal/adapters/agent/qwen/... ✅ (all 25 tests pass, including 4 new ones)
  • go vet ./internal/adapters/agent/qwen/...

Open question: godoc for invalid-model handling

In the Auggie PR (#2969), a reviewer asked to document what happens when the model is invalid. The decision was to treat the model as an opaque value — trimmed and forwarded as-is, with the CLI validating it and surfacing the error, and no silent fallback. The author added a godoc comment on appendModelFlag to state this explicitly.

Our appendModelFlag currently has only a minimal godoc: "appendModelFlag appends --model if a non-empty model is configured." Would you like me to expand it to match the Auggie convention and document the passthrough-and-surface behavior? Happy to add it if that's the preferred convention.

Anything else?

Let me know if there are any other gaps or changes needed before this can be merged.

@Pulkit7070 @nikhilachale

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.

Qwen Code ignores role-specific model config on launch

4 participants