Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/seclab_taskflow_agent/capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ def get_AI_endpoint():
def get_AI_token():
"""
Get the token for the AI API from the environment.
The environment variable can be named either AI_API_TOKEN
or COPILOT_TOKEN.
The environment variable can be named either AI_API_TOKEN,
COPILOT_TOKEN, or GITHUB_TOKEN.
"""
token = os.getenv("AI_API_TOKEN")
if token:
return token
token = os.getenv("COPILOT_TOKEN")
if token:
return token
token = os.getenv("GITHUB_TOKEN")
if token:
return token
raise RuntimeError("AI_API_TOKEN environment variable is not set.")
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

The error message at line 61 only mentions "AI_API_TOKEN environment variable is not set" but the function now accepts three different environment variables (AI_API_TOKEN, COPILOT_TOKEN, or GITHUB_TOKEN). The error message should be updated to reflect all three options to provide accurate guidance to users when none of them are set.

Suggested change
raise RuntimeError("AI_API_TOKEN environment variable is not set.")
raise RuntimeError(
"No API token found. Please set one of: AI_API_TOKEN, COPILOT_TOKEN, or GITHUB_TOKEN."
)

Copilot uses AI. Check for mistakes.
Comment on lines 46 to 61
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

The new GITHUB_TOKEN fallback behavior and the fixed COPILOT_TOKEN check lack test coverage. Given that tests/test_api_endpoint_config.py contains comprehensive tests for the related get_AI_endpoint() function, similar tests should be added for get_AI_token() to verify the fallback chain works correctly (AI_API_TOKEN -> COPILOT_TOKEN -> GITHUB_TOKEN) and that the error is raised when none are set.

Copilot uses AI. Check for mistakes.
Expand Down
Loading