A chat stream fails live with: 400 Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead. The provider path must choose the parameter by model class rather than always sending max_tokens, and classic models must keep the existing behaviour. Observed as a failed turn recorded in the store, not a hypothetical.
Acceptance criteria
A reasoning-class model streams without the 400; a classic model still gets max_tokens; red-first test covering both
Close reason
Shipped in 148c81af: maxTokensForRequest returns 0 for reasoning-class models so the OpenAI chat-completions provider sends no max_tokens (chat turn path + MCP sampling); classic models keep the bound. Red-first tests model_output_bound_test.go and gateway/turn_test.go.
Imported from beads archie-core-7zu3 · GitHub #1419 · type bug · priority P1 · created 2026-10-02 · closed 2026-10-02
A chat stream fails live with: 400 Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead. The provider path must choose the parameter by model class rather than always sending max_tokens, and classic models must keep the existing behaviour. Observed as a failed turn recorded in the store, not a hypothetical.
### Acceptance criteria
A reasoning-class model streams without the 400; a classic model still gets max_tokens; red-first test covering both
### Close reason
Shipped in 148c81af: maxTokensForRequest returns 0 for reasoning-class models so the OpenAI chat-completions provider sends no max_tokens (chat turn path + MCP sampling); classic models keep the bound. Red-first tests model_output_bound_test.go and gateway/turn_test.go.
---
_Imported from beads `archie-core-7zu3` · GitHub #1419 · type bug · priority P1 · created 2026-10-02 · closed 2026-10-02_
sam
added the highbug labels 2026-10-27 13:39:09 +00:00
Investigated (lane l21): the parameter name is chosen inside the ai-sdk module, not archie-core. provider/openai/chat_completions.go emits max_tokens; responses.go emits max_output_tokens. Runtime.Chat/ChatStream resolve ModelInfo.Reasoning and drop it before the provider call; chat.Request carries only MaxTokens and ai-sdk v0.1.39 (latest) has no MaxCompletionTokens path. Routing is name-hardcoded (modelDefaultsToReasoning matches only gpt-5.5/5.6), so a reasoning model outside that list (e.g. gpt-5.4) takes chat completions and gets max_tokens -> the 400. Fix requires an ai-sdk change + tag + archie-core pin bump, outside this lane's worktree. Full evidence: /tmp/lane-l21-openai-report.md. Blocked pending captain decision (ai-sdk fix vs archie-core mitigation).
_sam wrote (originally 2026-10-02):_
Investigated (lane l21): the parameter name is chosen inside the ai-sdk module, not archie-core. provider/openai/chat_completions.go emits max_tokens; responses.go emits max_output_tokens. Runtime.Chat/ChatStream resolve ModelInfo.Reasoning and drop it before the provider call; chat.Request carries only MaxTokens and ai-sdk v0.1.39 (latest) has no MaxCompletionTokens path. Routing is name-hardcoded (modelDefaultsToReasoning matches only gpt-5.5/5.6), so a reasoning model outside that list (e.g. gpt-5.4) takes chat completions and gets max_tokens -> the 400. Fix requires an ai-sdk change + tag + archie-core pin bump, outside this lane's worktree. Full evidence: /tmp/lane-l21-openai-report.md. Blocked pending captain decision (ai-sdk fix vs archie-core mitigation).
Lane l26-openai2 implemented the archie-core mitigation on branch crew/l26-openai2 (commit 63aafa26). archie-core now sends no output-token bound for any model the catalog marks reasoning (messaging.ModelDetails.Reasoning): the chat turn path reads it from the gateway's resolved catalog details and MCP sampling reads it from the chat model manager. Classic models keep their bound unchanged. Red-first HTTP-capture tests cover both call sites (reasoning => no max_tokens; classic => max_tokens preserved); scoped go test -short, go vet and golangci-lint are clean on internal/app/archied and internal/gateway. Residual: the ai-sdk max_completion_tokens path (separate bead) is still needed to ever bound a reasoning model; this lane avoids the 400 rather than setting a bound.
_sam wrote (originally 2026-10-02):_
Lane l26-openai2 implemented the archie-core mitigation on branch crew/l26-openai2 (commit 63aafa26). archie-core now sends no output-token bound for any model the catalog marks reasoning (messaging.ModelDetails.Reasoning): the chat turn path reads it from the gateway's resolved catalog details and MCP sampling reads it from the chat model manager. Classic models keep their bound unchanged. Red-first HTTP-capture tests cover both call sites (reasoning => no max_tokens; classic => max_tokens preserved); scoped go test -short, go vet and golangci-lint are clean on internal/app/archied and internal/gateway. Residual: the ai-sdk max_completion_tokens path (separate bead) is still needed to ever bound a reasoning model; this lane avoids the 400 rather than setting a bound.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
A chat stream fails live with: 400 Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead. The provider path must choose the parameter by model class rather than always sending max_tokens, and classic models must keep the existing behaviour. Observed as a failed turn recorded in the store, not a hypothetical.
Acceptance criteria
A reasoning-class model streams without the 400; a classic model still gets max_tokens; red-first test covering both
Close reason
Shipped in
148c81af: maxTokensForRequest returns 0 for reasoning-class models so the OpenAI chat-completions provider sends no max_tokens (chat turn path + MCP sampling); classic models keep the bound. Red-first tests model_output_bound_test.go and gateway/turn_test.go.Imported from beads
archie-core-7zu3· GitHub #1419 · type bug · priority P1 · created 2026-10-02 · closed 2026-10-02sam wrote (originally 2026-10-02):
Investigated (lane l21): the parameter name is chosen inside the ai-sdk module, not archie-core. provider/openai/chat_completions.go emits max_tokens; responses.go emits max_output_tokens. Runtime.Chat/ChatStream resolve ModelInfo.Reasoning and drop it before the provider call; chat.Request carries only MaxTokens and ai-sdk v0.1.39 (latest) has no MaxCompletionTokens path. Routing is name-hardcoded (modelDefaultsToReasoning matches only gpt-5.5/5.6), so a reasoning model outside that list (e.g. gpt-5.4) takes chat completions and gets max_tokens -> the 400. Fix requires an ai-sdk change + tag + archie-core pin bump, outside this lane's worktree. Full evidence: /tmp/lane-l21-openai-report.md. Blocked pending captain decision (ai-sdk fix vs archie-core mitigation).
sam wrote (originally 2026-10-02):
Lane l26-openai2 implemented the archie-core mitigation on branch crew/l26-openai2 (commit 63aafa26). archie-core now sends no output-token bound for any model the catalog marks reasoning (messaging.ModelDetails.Reasoning): the chat turn path reads it from the gateway's resolved catalog details and MCP sampling reads it from the chat model manager. Classic models keep their bound unchanged. Red-first HTTP-capture tests cover both call sites (reasoning => no max_tokens; classic => max_tokens preserved); scoped go test -short, go vet and golangci-lint are clean on internal/app/archied and internal/gateway. Residual: the ai-sdk max_completion_tokens path (separate bead) is still needed to ever bound a reasoning model; this lane avoids the 400 rather than setting a bound.