fix(openai): route gpt-5 codex via responses and map base paths#7254
Conversation
Signed-off-by: Vadim Polulyakh <bavadim@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3959e3af66
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
crates/goose/src/providers/openai.rs
Outdated
There was a problem hiding this comment.
Preserve absolute base paths when remapping endpoints
normalize_base_path removes leading /, so when a user configures OPENAI_BASE_PATH as an absolute path (for example /v1/chat/completions), map_base_path now produces relative paths like v1/models/v1/responses instead of /v1/models//v1/responses. Since ApiClient::build_url resolves these with Url::join, this changes routing whenever OPENAI_HOST already includes a path prefix (e.g. https://proxy.example.com/v1), causing discovery/responses calls to hit the wrong URL (.../v1/v1/...).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Valid point, thanks. This was a regression from normalize_base_path stripping leading /.
Fixed in a3c69b96:
- preserve absolute paths in
normalize_base_path(keep leading/, normalize trailing/only) - preserve absolute form in
map_base_pathfallback as well - added tests for absolute-path mapping/fallback (
/v1/chat/completions->/v1/responses,/custom/path->/v1/models)
This keeps Url::join behavior correct when OPENAI_HOST already has a path prefix.
4f4db52 to
3c334ff
Compare
Signed-off-by: Vadim Polulyakh <bavadim@gmail.com>
michaelneale
left a comment
There was a problem hiding this comment.
looks good - should we do manual testing for this?
I already checked - it works |
…led-extensions-cmd * 'main' of github.com:block/goose: (24 commits) Set up direnv and update flake inputs (#6526) fix: restore subagent tool call notifications after summon refactor (#7243) fix(ui): preserve server config values on partial provider config save (#7248) fix(claude-code): allow goose to run inside a Claude Code session (#7232) fix(openai): route gpt-5 codex via responses and map base paths (#7254) feat: add GoosePlatform to AgentConfig and MCP initialization (#6931) Fix copied over (#7270) feat(gemini-cli): add streaming support via stream-json events (#7244) fix: filter models without tool support from recommended list (#7198) fix(google): handle more thoughtSignature vagaries during streaming (#7204) docs: playwright CLI skill tutorial (#7261) install node in goose dir (#7220) fix: relax test_basic_response assertion for providers returning reasoning_content (#7249) fix: handle reasoning_content for Kimi/thinking models (#7252) feat: sandboxing for macos (#7197) fix(otel): use monotonic_counter prefix and support temporality env var (#7234) Streaming markdown (#7233) Improve compaction messages to enable better post-compaction agent behavior (#7259) fix: avoid shell-escaping special characters except quotes (#7242) fix: use dynamic port for Tetrate auth callback server (#7228) ...
* origin/main: (263 commits) working_dir usage more clear in add_extension (block#6958) Use Canonical Models to set context window sizes (block#6723) Set up direnv and update flake inputs (block#6526) fix: restore subagent tool call notifications after summon refactor (block#7243) fix(ui): preserve server config values on partial provider config save (block#7248) fix(claude-code): allow goose to run inside a Claude Code session (block#7232) fix(openai): route gpt-5 codex via responses and map base paths (block#7254) feat: add GoosePlatform to AgentConfig and MCP initialization (block#6931) Fix copied over (block#7270) feat(gemini-cli): add streaming support via stream-json events (block#7244) fix: filter models without tool support from recommended list (block#7198) fix(google): handle more thoughtSignature vagaries during streaming (block#7204) docs: playwright CLI skill tutorial (block#7261) install node in goose dir (block#7220) fix: relax test_basic_response assertion for providers returning reasoning_content (block#7249) fix: handle reasoning_content for Kimi/thinking models (block#7252) feat: sandboxing for macos (block#7197) fix(otel): use monotonic_counter prefix and support temporality env var (block#7234) Streaming markdown (block#7233) Improve compaction messages to enable better post-compaction agent behavior (block#7259) ... # Conflicts: # crates/goose/src/providers/openai.rs
…ions-fallback * 'main' of github.com:block/goose: (43 commits) Added cmd to validate bundled extensions json (#7217) working_dir usage more clear in add_extension (#6958) Use Canonical Models to set context window sizes (#6723) Set up direnv and update flake inputs (#6526) fix: restore subagent tool call notifications after summon refactor (#7243) fix(ui): preserve server config values on partial provider config save (#7248) fix(claude-code): allow goose to run inside a Claude Code session (#7232) fix(openai): route gpt-5 codex via responses and map base paths (#7254) feat: add GoosePlatform to AgentConfig and MCP initialization (#6931) Fix copied over (#7270) feat(gemini-cli): add streaming support via stream-json events (#7244) fix: filter models without tool support from recommended list (#7198) fix(google): handle more thoughtSignature vagaries during streaming (#7204) docs: playwright CLI skill tutorial (#7261) install node in goose dir (#7220) fix: relax test_basic_response assertion for providers returning reasoning_content (#7249) fix: handle reasoning_content for Kimi/thinking models (#7252) feat: sandboxing for macos (#7197) fix(otel): use monotonic_counter prefix and support temporality env var (#7234) Streaming markdown (#7233) ... # Conflicts: # crates/goose/src/config/extensions.rs
Summary
Fix OpenAI endpoint routing so
gpt-5.*-codexuses Responses API by default while preserving explicitOPENAI_BASE_PATHcompatibility overrides.The change also unifies how derived paths are constructed (
responses,models) for OpenAI-compatible custom base paths.Type of Change
AI Assistance
Testing
cargo fmt --allcargo test -p goose openai:: -- --nocapturecargo clippy --all-targets -- -D warningsAll commands passed locally.
Related Issues
Relates to #7253
Related: #5500, #6089, #5270
Discussion: #5783
Screenshots/Demos (for UX changes)
Before: N/A
After: N/A