Skip to content

fix: use GET /v1/models for Anthropic connection test - #106

Merged
CybotTM merged 1 commit into
mainfrom
fix/anthropic-connection-test
Mar 6, 2026
Merged

fix: use GET /v1/models for Anthropic connection test#106
CybotTM merged 1 commit into
mainfrom
fix/anthropic-connection-test

Conversation

@CybotTM

@CybotTM CybotTM commented Mar 6, 2026

Copy link
Copy Markdown
Member

Summary

The setup wizard's connection test for Anthropic providers sent GET /v1/messages, which only accepts POST, causing a 405 Method Not Allowed error.

Changed to GET /v1/models which Anthropic supports and is consistent with how other providers (OpenAI, Gemini) are tested.

Related

Related to #98 (wizard endpoint URL issues)

The setup wizard's connection test sent GET to /v1/messages which
only accepts POST, causing a 405 error. Anthropic's /v1/models
endpoint supports GET and is the correct endpoint for testing
connectivity.

Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
Copilot AI review requested due to automatic review settings March 6, 2026 20:06
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical issue in the setup wizard where Anthropic provider connection tests failed due to an incorrect API endpoint. By switching the test endpoint from '/v1/messages' to '/v1/models', the system now correctly verifies Anthropic API keys and endpoints, preventing '405 Method Not Allowed' errors and ensuring a smoother setup experience for users integrating Anthropic services.

Highlights

  • Anthropic Connection Test Fix: Corrected the API endpoint used for Anthropic provider connection tests in the setup wizard from '/v1/messages' to '/v1/models'. This resolves a '405 Method Not Allowed' error encountered during the connection test.
  • Consistency with Other Providers: The updated Anthropic endpoint '/v1/models' is consistent with how other providers like OpenAI and Gemini are tested, ensuring a standardized approach to model discovery.
Changelog
  • Classes/Service/SetupWizard/ModelDiscovery.php
    • Updated the Anthropic endpoint for connection testing to '/v1/models'.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added the services Service layer changes label Mar 6, 2026
@github-actions

github-actions Bot commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions github-actions Bot 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.

Automated approval for solo maintainer project

This PR has passed all automated quality gates:

  • ✅ Static analysis (PHPStan)
  • ✅ Code style (PHP-CS-Fixer)
  • ✅ Unit & functional tests
  • ✅ Security scanning
  • ✅ Dependency review

See SECURITY_CONTROLS.md for compensating controls documentation.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request fixes a connection test issue for Anthropic providers by changing the test endpoint from "/v1/messages" to "/v1/models". However, the "testConnection" method remains vulnerable to Server-Side Request Forgery (SSRF) and potential API key leakage because it uses an unvalidated user-provided endpoint URL. It is recommended to implement strict URL validation for the provider endpoint. Additionally, I've suggested a refactoring of the endpoint selection logic to improve code clarity and address a similar inconsistency for the "groq" provider.

Comment thread Classes/Service/SetupWizard/ModelDiscovery.php
@codecov

codecov Bot commented Mar 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.48%. Comparing base (7c5a07c) to head (3920d33).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main     #106   +/-   ##
=========================================
  Coverage     92.48%   92.48%           
  Complexity     1937     1937           
=========================================
  Files            77       77           
  Lines          6849     6849           
=========================================
  Hits           6334     6334           
  Misses          515      515           
Flag Coverage Δ
unit 92.48% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
Classes/Service/SetupWizard/ModelDiscovery.php 91.95% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes the Setup Wizard’s Anthropic connection test by switching the probe endpoint from GET /v1/messages (invalid; POST-only) to GET /v1/models (valid), aligning Anthropic with the “list models” style checks used for other providers.

Changes:

  • Update Anthropic connection test endpoint to .../v1/models to avoid 405 responses.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CybotTM
CybotTM merged commit 3920d33 into main Mar 6, 2026
46 checks passed
@CybotTM
CybotTM deleted the fix/anthropic-connection-test branch March 6, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

services Service layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants