Skip to content

refactor(coder): use first_available model selection with multi-provider fallbacks - #2996

Merged
dgageot merged 1 commit into
docker:mainfrom
dgageot:board/85d0e4d3f87f3577
Jun 4, 2026
Merged

dgageot merged 1 commit into
docker:mainfrom
dgageot:board/85d0e4d3f87f3577

Conversation

@dgageot

@dgageot dgageot commented Jun 3, 2026

Copy link
Copy Markdown
Member

The builtin coder agent previously hardcoded Anthropic models, which meant users without Anthropic credentials had to manually configure alternative providers. This change leverages the new first_available model selection feature to work seamlessly with any configured provider.

The coder agent's default and fast models now each list candidate provider/model combinations across Anthropic, OpenAI, and Google, with a fallback to the local dmr model. The agent automatically selects the first available option based on the user's configured credentials, eliminating the need for manual configuration in most cases.

The fast model was renamed from haiku for consistency, and the librarian sub-agent reference was updated accordingly.

@dgageot
dgageot requested a review from a team as a code owner June 3, 2026 17:03

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟡 NEEDS ATTENTION

provider: anthropic
model: claude-haiku-4-5
first_available:
- anthropic/claude-opus-4-8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Speculative model IDs in default first_available list may cause runtime API failures

The new default model candidates include anthropic/claude-opus-4-8, openai/gpt-5.5, and google/gemini-3.5-flash. None of these are known public model identifiers. The first_available selector picks the first candidate whose credentials are configured — not whether the model ID is valid — so a user with Anthropic credentials will always resolve to anthropic/claude-opus-4-8, and the subsequent API call will fail if Anthropic's API does not recognize that model ID.

The old config used claude-opus-4-6 (also non-public), so this project likely uses pre-release/internal model names. If these are intentional internal identifiers, this is expected. If they are typos or speculative future names, users with cloud credentials will get runtime failures instead of a working fallback — the local dmr/ai/qwen3 fallback is only reached when no cloud credentials are configured at all.

Consider verifying these model IDs against the provider's current API catalog (e.g., Anthropic's model list, OpenAI's /v1/models, Google's Gemini API).

fast:
first_available:
- anthropic/claude-haiku-4-5
- openai/gpt-5.4-mini

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Unrecognized model IDs in fast first_available list may cause runtime API failures

openai/gpt-5.4-mini and google/gemini-3.1-flash-lite are not recognized public model identifiers. The current OpenAI fast/mini model is typically gpt-4o-mini; gpt-5.4-mini is not a known offering. Similarly gemini-3.1-flash-lite does not match any known Gemini model name.

As with the default list, the first_available runtime resolves on credential availability, not model validity. A user with OpenAI credentials will select openai/gpt-5.4-mini and receive an API error at inference time if the model ID is wrong.

anthropic/claude-haiku-4-5 (unchanged from the old config) follows the same versioning pattern, so this may be an intentional pre-release naming scheme — but worth confirming that all three provider IDs are correct before shipping.

@aheritier aheritier added area/agent For work that has to do with the general agent loop/agentic features of the app area/providers For features/issues/fixes related to LLM providers (Bedrock, LiteLLM, Qwen, custom, etc.) kind/refactor PR refactors code without behavior change labels Jun 3, 2026
@dgageot
dgageot merged commit 16deb2e into docker:main Jun 4, 2026
10 checks passed
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
docker-agent 1.74.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>This release introduces self-update functionality, session read-only mode, and 1Password CLI integration, along with model selection improvements and various bug fixes.

## What's New

- Adds opt-in self-update functionality via `DOCKER_AGENT_AUTO_UPDATE` environment variable with interactive confirmation
- Adds `--session-read-only` flag to view sessions without sending messages in TUI mode
- Adds 1Password CLI integration for secret resolution using `op://` references
- Adds `first_available` model selection for automatic fallback across multiple model candidates
- Adds `user_steering_messages_submit` and `user_followup_submit` hooks for queued user messages

## Improvements

- Updates default agent to use `first_available` model selection with multi-provider fallbacks
- Updates default model versions: OpenAI from `gpt-5-mini` to `gpt-5`, Google from `gemini-2.5-flash` to `gemini-3.5-flash`
- Updates coder agent to use `first_available` model selection instead of hardcoded Anthropic models

## Bug Fixes

- Fixes tool call being dropped when finish_reason shares the same chunk in streaming responses
- Fixes orphaned tool results on session resume that caused validation errors on AWS Bedrock
- Fixes agent field not being preserved during command expansion, causing incorrect routing to root agent
- Fixes binary files being processed in content search operations
- Fixes self-update validation to prevent arbitrary file deletion and detect help flags properly
- Fixes IPv6 6to4, NAT64, site-local and CGNAT ranges not being blocked in SSRF protection

## Technical Changes

- Hardens self-update download and re-exec process against tampering with digest and checksum verification
- Uses SSRF-safe HTTP client for MCP OAuth metadata fetches
- Hardens 1Password provider against silent pass-through and PATH hijacking
- Fixes custom-base-image evaluation template to include docker-agent binary and entrypoint
- Removes broken MCP servers from configuration

---

## What's Changed
* docs: update CHANGELOG.md for v1.73.0 by @docker-read-write[bot] in docker/docker-agent#2990
* feat: add first_available model selection by @dgageot in docker/docker-agent#2991
* fix: don't drop tool call when finish_reason shares the chunk by @Sayt-0 in docker/docker-agent#2992
* chore: bump go dependencies (acp-go-sdk, goja) by @dgageot in docker/docker-agent#2995
* feat: add opt-in self-update by @dgageot in docker/docker-agent#2993
* docs: update agent config reference, custom provider api_type, and slash command behavior by @aheritier in docker/docker-agent#2999
* feat: update default agent to use first_available model selection by @dgageot in docker/docker-agent#2997
* refactor(coder): use first_available model selection with multi-provider fallbacks by @dgageot in docker/docker-agent#2996
* feat: add user_steering_messages_submit and user_followup_submit hooks by @simonferquel-clanker in docker/docker-agent#3000
* docs: add thinking/reasoning guide and expand provider thinking docs by @rumpl in docker/docker-agent#3004
* docs: update default model examples to gpt-5 and gemini-3.5-flash by @aheritier in docker/docker-agent#3003
* fix: drop orphaned tool results on session resume by @Sayt-0 in docker/docker-agent#3001
* docs: sync config examples with updated default models (gpt-5, gemini-3.5-flash) by @aheritier in docker/docker-agent#3012
* fix: preserve agent field during command expansion by @dgageot in docker/docker-agent#3007
* docs: update remaining gpt-5-mini → gpt-5 examples across docs by @aheritier in docker/docker-agent#3025
* feat: add --session-read-only flag to view sessions without sending messages by @gtardif in docker/docker-agent#3026
* fix: skip binary files in content search by @dgageot in docker/docker-agent#3006
* docs: document --session-read-only flag for TUI read-only mode by @aheritier in docker/docker-agent#3028
* fix(evals): copy docker-agent binary + entrypoint in custom-base-image template by @hamza-jeddad in docker/docker-agent#3029
* chore: bump go dependencies by @dgageot in docker/docker-agent#3005
* fix: block IPv6 6to4, NAT64, site-local and CGNAT ranges in IsPublicIP by @ronan-thibaut-glitch in docker/docker-agent#3031
* Remove broken MCP servers by @dgageot in docker/docker-agent#3032
* chore: bump go dependencies by @dgageot in docker/docker-agent#3033
* fix: use SSRF-safe HTTP client for MCP OAuth authorization server metadata fetch by @ronan-thibaut-glitch in docker/docker-agent#3035
* feat: add 1Password CLI integration for secret resolution by @dgageot in docker/docker-agent#3036

## New Contributors
* @ronan-thibaut-glitch made their first contribution in docker/docker-agent#3031

**Full Changelog**: docker/docker-agent@v1.73.0...v1.74.0
</pre>
  <p>View the full release notes at <a href="https://github.com/docker/docker-agent/releases/tag/v1.74.0">https://github.com/docker/docker-agent/releases/tag/v1.74.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!11097
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent For work that has to do with the general agent loop/agentic features of the app area/providers For features/issues/fixes related to LLM providers (Bedrock, LiteLLM, Qwen, custom, etc.) kind/refactor PR refactors code without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants