Skip to content

Conversation

@sylwia-budzynska
Copy link
Contributor

This PR will improve error handling when a user supplies an unsupported API endpoint to display supported endpoints.

E.g. if AI_API_ENDPOINT is:
.env

AI_API_ENDPOINT="models.github.ai"

The error the agent will show:

$ hatch run main -p seclab_taskflow_agent.personalities.assistant 'explain modems to me please'
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/workspaces/seclab-taskflow-agent/src/seclab_taskflow_agent/__main__.py", line 18, in <module>
    from .agent import DEFAULT_MODEL, TaskRunHooks, TaskAgentHooks
  File "/workspaces/seclab-taskflow-agent/src/seclab_taskflow_agent/agent.py", line 30, in <module>
    raise ValueError(f"Unsupported Model Endpoint: {api_endpoint}\n"
ValueError: Unsupported Model Endpoint: models.github.ai
Supported endpoints: ['https://models.github.ai/inference', 'https://api.githubcopilot.com']

AI_API_TOKEN=<your_github_token>
# MCP configs
GH_TOKEN=<your_github_token>
CODEQL_DBS_BASE_PATH="/app/my_data/codeql_databases"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
CODEQL_DBS_BASE_PATH="/app/my_data/codeql_databases"
CODEQL_DBS_BASE_PATH="/app/data/codeql_databases"

Should we change it to data since we removed my_?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves error handling when users supply an unsupported API endpoint by adding a new to_url() method to the AI_API_ENDPOINT_ENUM class and updating error messages throughout the codebase to display supported endpoints in their full URL format.

Key changes:

  • Added to_url() method to AI_API_ENDPOINT_ENUM to convert endpoint values to their full URLs
  • Enhanced error messages in three locations to list supported endpoints when an unsupported endpoint is provided
  • Updated README.md documentation to explicitly show the AI_API_ENDPOINT configuration option

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/seclab_taskflow_agent/capi.py Added to_url() method to enum class and updated error messages in list_capi_models() and supports_tool_calls() to display supported endpoints
src/seclab_taskflow_agent/agent.py Updated error message in the default model initialization to display supported endpoints
README.md Added AI_API_ENDPOINT configuration example and updated database path example

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings December 8, 2025 22:10
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


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

AI_API_MODELS_GITHUB = 'models.github.ai'
AI_API_GITHUBCOPILOT = 'api.githubcopilot.com'

def to_url(self):

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error, as implicit returns always return None.
Copilot AI review requested due to automatic review settings December 8, 2025 22:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


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

Copilot AI review requested due to automatic review settings December 9, 2025 19:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings December 9, 2025 19:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


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

Copilot AI review requested due to automatic review settings December 10, 2025 13:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


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

@sylwia-budzynska sylwia-budzynska merged commit 6113b00 into GitHubSecurityLab:main Dec 10, 2025
15 checks passed
@sylwia-budzynska sylwia-budzynska deleted the sylwia-api-errors branch December 10, 2025 14:51
@sylwia-budzynska sylwia-budzynska mentioned this pull request Dec 10, 2025
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