Skip to content

refactor(providers): extract http_status module and rename handle_status_openai_compat#8620

Merged
jh-block merged 1 commit into
aaif-goose:mainfrom
soilSpoon:refactor/rename-handle-status
Apr 22, 2026
Merged

refactor(providers): extract http_status module and rename handle_status_openai_compat#8620
jh-block merged 1 commit into
aaif-goose:mainfrom
soilSpoon:refactor/rename-handle-status

Conversation

@soilSpoon
Copy link
Copy Markdown
Contributor

@soilSpoon soilSpoon commented Apr 17, 2026

Summary

  • Rename handle_status_openai_compathandle_status
  • Rename handle_response_openai_compathandle_response
  • Extract these helpers into a dedicated providers::http_status module

Motivation

The status-mapping helpers (handle_status, handle_response, map_http_error_to_provider_error) are format-agnosticextract_message already parses both OpenAI ({"error":{"message":"..."}}) and Anthropic ({"message":"..."}) error shapes. They are used by 12 providers including anthropic, google, ollama, and kimicode.

The _openai_compat suffix was misleading, and housing them in openai_compatible.rs implied a format dependency that doesn't exist. Per @jh-block's suggestion, they now live in their own module.

Changes

  • New: crates/goose/src/providers/http_status.rs — contains handle_status, handle_response, map_http_error_to_provider_error, and the private check_context_length_exceeded helper
  • Modified: openai_compatible.rs — re-exports the helpers for backward compatibility
  • Modified: 11 provider files — import path updated (handle_status_openai_compathandle_status)

Test plan

  • cargo clippy -p goose --all-targets -- -D warnings clean
  • Existing openai_compatible::tests still pass (they use re-exported symbols)
  • Compiler verifies no missed call sites

Follow-up to #8466.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: efaad41e59

ℹ️ 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".

Comment thread ui/desktop/src/api/core/params.gen.ts Outdated
@soilSpoon soilSpoon force-pushed the refactor/rename-handle-status branch from eebc545 to f5a5e94 Compare April 19, 2026 12:28
@jh-block
Copy link
Copy Markdown
Collaborator

Since we're doing the big rename anyway, maybe this helper should move out of the openai_compatible module since it's no longer specific to that provider?

@jh-block jh-block self-assigned this Apr 20, 2026
@soilSpoon soilSpoon force-pushed the refactor/rename-handle-status branch from f5a5e94 to 5a3ae34 Compare April 20, 2026 14:32
@soilSpoon
Copy link
Copy Markdown
Contributor Author

Done — moved handle_status, handle_response, and map_http_error_to_provider_error into a dedicated providers::http_status module. openai_compatible re-exports them so existing import paths still work.

@soilSpoon soilSpoon changed the title refactor(providers): rename handle_status_openai_compat to handle_status refactor(providers): extract http_status module and rename handle_status_openai_compat Apr 20, 2026
@jh-block jh-block added this pull request to the merge queue Apr 20, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Apr 20, 2026
@soilSpoon soilSpoon force-pushed the refactor/rename-handle-status branch from 5a3ae34 to 9ec8a2c Compare April 20, 2026 15:47
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ec8a2cdf7

ℹ️ 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".

})
}
// Legacy alias kept for callers that haven't migrated their import path yet.
pub use super::http_status::handle_response as handle_response_openai_compat;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Re-export legacy handle_status_openai_compat alias

This refactor removes the public handle_status_openai_compat symbol without a compatibility alias, even though this section explicitly promises legacy import support. Any downstream crate that still imports providers::openai_compatible::handle_status_openai_compat will now fail to compile, which is a breaking API change introduced by this commit; adding a pub use ... as handle_status_openai_compat alias (like the one kept for handle_response_openai_compat) would preserve compatibility.

Useful? React with 👍 / 👎.

…ttp_status module

The status-mapping helpers (`handle_status`, `handle_response`,
`map_http_error_to_provider_error`) are format-agnostic — they parse
both OpenAI and Anthropic error shapes and are used by 12 providers.

- Rename `handle_status_openai_compat` → `handle_status` and
  `handle_response_openai_compat` → `handle_response`.
- Move these helpers from `openai_compatible` into a dedicated
  `providers::http_status` module. `openai_compatible` re-exports
  them for convenience.

Pure refactor, no logic changes.

Signed-off-by: DaeHee Lee <lee111dae11@proton.me>
@soilSpoon soilSpoon force-pushed the refactor/rename-handle-status branch from 9ec8a2c to 6f7c934 Compare April 21, 2026 01:39
@soilSpoon
Copy link
Copy Markdown
Contributor Author

@jh-block Rebased to resolve conflicts from #8652 (provider inventory overhaul). Import conflicts in anthropic.rs and ollama.rs — resolved and build verified. Ready for another look when you get a chance.

@jh-block jh-block added this pull request to the merge queue Apr 22, 2026
Merged via the queue into aaif-goose:main with commit d18bb6e Apr 22, 2026
20 checks passed
lifeizhou-ap added a commit that referenced this pull request Apr 22, 2026
* main: (41 commits)
  removed the specific code owner for documentation change (#8749)
  fix(providers): handle missing delta field in streaming chunks (#8700)
  refactor(providers): extract http_status module and rename handle_status_openai_compat (#8620)
  fix(providers/openai): accept streaming chunks with both reasoning fields (#8715)
  feat: associate threads with projects (#8745)
  upgrade goose sdk and tui to be compatible with the latest agentclientprotocol/sdk package (#8667)
  feat: extend goose2 context window ux with auto-compaction (#8721)
  improve goose2 agent management flows (#8737)
  alexhancock/tui-improvements (#8736)
  fix: add strict:false to Responses API tools and gpt-5.4 to known models (#8636)
  persist and reliably apply chat model selection (#8734)
  merge goose-acp crate into goose (#8726)
  docs: AGENTS.md section on goose2 desktop backend architecture (#8732)
  feat: goose2 message bubble + action tray (#8720)
  consolidate provider ACP methods onto inventory (#8710)
  ci: declare and enforce MSRV of 1.91.1 (#8670)
  fix(ui): correct grammar in apps view description (#8668) (#8679)
  Stop load openai fast model for openapi compatible custom endpoint (#8644)
  feat(hooks): add Husky git hooks for ui/goose2 (#8577)
  fix: links in chat could not be opened (#8544)
  ...
lifeizhou-ap added a commit that referenced this pull request Apr 23, 2026
* main: (34 commits)
  fix(goose-server): cache TLS cert to disk to avoid slow startup on first launch (#8174)
  feat: add Exa AI-powered search tool (#8487)
  fix: preprompt would show after loading session (#8744)
  commands to acp+ migration: extensions management (#8733)
  feat: desktop notification when goose finishes a task (#8647)
  harden code review skill for async state and default-resolution bugs (#8740)
  Feature/at agent mention (#8571)
  fix: removed hardcoded dependency of goose-acp-macro (#8753)
  perf: split agent setup into staged phases to reduce startup blocking (#8746)
  Add /skills command (#8600)
  Replace deprecated Claude ACP package links (#8625)
  removed the specific code owner for documentation change (#8749)
  fix(providers): handle missing delta field in streaming chunks (#8700)
  refactor(providers): extract http_status module and rename handle_status_openai_compat (#8620)
  fix(providers/openai): accept streaming chunks with both reasoning fields (#8715)
  feat: associate threads with projects (#8745)
  upgrade goose sdk and tui to be compatible with the latest agentclientprotocol/sdk package (#8667)
  feat: extend goose2 context window ux with auto-compaction (#8721)
  improve goose2 agent management flows (#8737)
  alexhancock/tui-improvements (#8736)
  ...
@soilSpoon soilSpoon deleted the refactor/rename-handle-status branch April 23, 2026 01:50
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