Skip to content

fix(gateway): use default agent model for session defaults#1038

Open
BingqingLyu wants to merge 3 commits into
mainfrom
fork-pr-50210-codex-fix-session-default-agent-model
Open

fix(gateway): use default agent model for session defaults#1038
BingqingLyu wants to merge 3 commits into
mainfrom
fork-pr-50210-codex-fix-session-default-agent-model

Conversation

@BingqingLyu

@BingqingLyu BingqingLyu commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes openclaw#50156.

sessions.list.defaults was resolving the fallback model from the global hardcoded default path, which ignored the default agent's effective model.primary. In Control UI this surfaced as a misleading extra "Default (...)" choice when a single configured agent had its own primary model.

This changes getSessionDefaults() to resolve through resolveDefaultModelForAgent() using the repo's default agent id, so the gateway reports the same primary model the default agent will actually run.

Changes

  • src/gateway/session-utils.ts: resolve session defaults from the default agent's effective model instead of the hardcoded global fallback path.
  • src/gateway/session-utils.test.ts: add a regression test covering a default agent with model.primary = minimax/MiniMax-M2.5 and no global agents.defaults.model.primary.

Test plan

  • pnpm exec oxfmt --check src/gateway/session-utils.ts src/gateway/session-utils.test.ts
  • Attempted: pnpm test -- src/gateway/session-utils.test.ts -t "getSessionDefaults prefers the default agent primary model over the hardcoded fallback"
    • Blocked locally by an existing dependency skew in this checkout: node_modules/@mariozechner/pi-ai is still linked to 0.54.1, so the suite fails during import on @mariozechner/pi-ai/oauth before the test runs.

AI-assisted

This PR was authored with AI assistance. I reviewed the change and verified the root cause in code before submitting.

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.

Control UI shows two "default" model options when only one agent is configured[Bug]:

2 participants