Skip to content

fix: append /chat/completions for prefixed v1 base URLs#8521

Merged
jh-block merged 3 commits into
aaif-goose:mainfrom
aravind4219:main
Apr 20, 2026
Merged

fix: append /chat/completions for prefixed v1 base URLs#8521
jh-block merged 3 commits into
aaif-goose:mainfrom
aravind4219:main

Conversation

@aravind4219
Copy link
Copy Markdown
Contributor

Summary

Fixed a bug where custom OpenAI-compatible providers with a prefixed base_url like https://opencode.ai/zen/go/v1 would fail with a 404 because goose was hitting …/zen/go/v1 directly instead of …/zen/go/v1/chat/completions.

The path detection logic in from_custom_config knew to append /chat/completions when the URL path was exactly /v1, but didn't handle the case where /v1 came after a custom prefix. One line of logic, but easy to miss when you're configuring a provider that doesn't follow the standard api.example.com/v1 pattern.

Testing

Added 7 unit tests for the new derive_base_path helper covering the broken case and making sure existing patterns (bare /v1, already-full endpoint paths, non-v1 custom paths) still work correctly. All existing tests pass.

Related Issues

Relates to #ISSUE_ID : 8517
Discussion: LINK (if any): #8517

@jh-block jh-block added this pull request to the merge queue Apr 20, 2026
Merged via the queue into aaif-goose:main with commit 5205540 Apr 20, 2026
20 checks passed
lifeizhou-ap added a commit that referenced this pull request Apr 21, 2026
* main:
  feat(hooks): add Husky git hooks for ui/goose2 (#8577)
  fix: links in chat could not be opened (#8544)
  fix: run setup before dev and dev-debug in goose2 justfile (#8718)
  Manage skills as sources over ACP (#8675)
  handle full node paths in goose2 kill recipe (#8709)
  overhaul provider inventory and agent/model selection (#8652)
  Remove unused import (#8676)
  delete the goose2 migration plan prompt (#8678)
  Add health score badge to README (#8677)
  feat(goose2): voice dictation via direct-ACP pattern (#8609)
  consistently use actions-rust-lang/setup-rust-toolchain (#8671)
  fix(developer): run shell tool under bash/sh regardless of login shell (#8659)
  refactor(providers): extract shared OAuth device-flow helper (#8619)
  Add a goose2 release workflow (#8629)
  chore(deps): bump ncipollo/release-action from 1.20.0 to 1.21.0 (#8664)
  docs: add blog post about Mesh LLM provider option (#8655)
  fix: append /chat/completions for prefixed v1 base URLs (#8521)
  Reset ChatGPT Codex auth during OAuth setup (#8569)
  chore(deps): bump EmbarkStudios/cargo-deny-action from 2.0.15 to 2.0.17 (#8665)
  Add dependabot config for pnpm workspace, cargo, and actions (#8660)
spikewang pushed a commit to spikewang/goose that referenced this pull request Apr 22, 2026
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.

2 participants