-
Notifications
You must be signed in to change notification settings - Fork 6
Add new environment variable named AI_API_TOKEN #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new environment variable named AI_API_TOKEN #104
Conversation
There was a problem hiding this 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 introduces a new environment variable AI_API_TOKEN to replace COPILOT_TOKEN while maintaining backwards compatibility, and converts AI_API_ENDPOINT from a module-level constant to a function to ensure proper initialization order with load_dotenv().
Key Changes:
- Added
get_AI_token()function that checks forAI_API_TOKENfirst, then falls back toCOPILOT_TOKEN - Converted
AI_API_ENDPOINTconstant toget_AI_endpoint()function to avoid premature environment variable reading - Simplified unit tests by eliminating the need for module reloading
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/seclab_taskflow_agent/capi.py | Added get_AI_endpoint() and get_AI_token() functions; updated all references to use function calls instead of constants |
| src/seclab_taskflow_agent/agent.py | Updated to use get_AI_endpoint() function instead of AI_API_ENDPOINT constant |
| src/seclab_taskflow_agent/main.py | Updated to use get_AI_token() for retrieving the API token |
| tests/test_api_endpoint_config.py | Simplified tests to use function-based approach without module reloading |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
|
smoke test |
Deployment Triggered 🚀kevinbackhouse, started a branch deployment to smoketest (branch: You can watch the progress here 🔗 Details{
"type": "branch",
"environment": {
"name": "smoketest",
"url": null
},
"deployment": {
"timestamp": "2025-12-02T17:36:12.636Z",
"logs": "https://github.com/GitHubSecurityLab/seclab-taskflow-agent/actions/runs/19867883743"
},
"git": {
"branch": "71ffdfe454405608a35cfe3945f1ff7311a3cf0d",
"commit": "71ffdfe454405608a35cfe3945f1ff7311a3cf0d",
"verified": true,
"committer": "kevinbackhouse",
"html_url": "https://github.com/GitHubSecurityLab/seclab-taskflow-agent/commit/71ffdfe454405608a35cfe3945f1ff7311a3cf0d"
},
"context": {
"actor": "kevinbackhouse",
"noop": false,
"fork": true,
"comment": {
"created_at": "2025-12-02T17:35:58Z",
"updated_at": "2025-12-02T17:35:58Z",
"body": "smoke test",
"html_url": "https://github.com/GitHubSecurityLab/seclab-taskflow-agent/pull/104#issuecomment-3603222387"
}
},
"parameters": {
"raw": null,
"parsed": null
}
} |
Deployment Results ❌kevinbackhouse had a failure when deploying branch Details{
"status": "failure",
"environment": {
"name": "smoketest",
"url": null
},
"deployment": {
"id": 3407236007,
"timestamp": "2025-12-02T17:37:14.231Z",
"logs": "https://github.com/GitHubSecurityLab/seclab-taskflow-agent/actions/runs/19867883743",
"duration": 62
},
"git": {
"branch": "71ffdfe454405608a35cfe3945f1ff7311a3cf0d",
"commit": "71ffdfe454405608a35cfe3945f1ff7311a3cf0d",
"verified": true
},
"context": {
"actor": "kevinbackhouse",
"noop": false,
"fork": true
},
"reviews": {
"count": 1,
"decision": "APPROVED"
},
"parameters": {
"raw": null,
"parsed": null
}
} |
|
smoke test |
Deployment Triggered 🚀kevinbackhouse, started a branch deployment to smoketest (branch: You can watch the progress here 🔗 Details{
"type": "branch",
"environment": {
"name": "smoketest",
"url": null
},
"deployment": {
"timestamp": "2025-12-02T17:42:31.858Z",
"logs": "https://github.com/GitHubSecurityLab/seclab-taskflow-agent/actions/runs/19868069908"
},
"git": {
"branch": "7dfd75111a64ae19196489e54bc87d0097afef38",
"commit": "7dfd75111a64ae19196489e54bc87d0097afef38",
"verified": true,
"committer": "web-flow",
"html_url": "https://github.com/GitHubSecurityLab/seclab-taskflow-agent/commit/7dfd75111a64ae19196489e54bc87d0097afef38"
},
"context": {
"actor": "kevinbackhouse",
"noop": false,
"fork": true,
"comment": {
"created_at": "2025-12-02T17:42:17Z",
"updated_at": "2025-12-02T17:42:17Z",
"body": "smoke test",
"html_url": "https://github.com/GitHubSecurityLab/seclab-taskflow-agent/pull/104#issuecomment-3603245604"
}
},
"parameters": {
"raw": null,
"parsed": null
}
} |
Deployment Results ✅kevinbackhouse successfully deployed branch Details{
"status": "success",
"environment": {
"name": "smoketest",
"url": null
},
"deployment": {
"id": 3407272574,
"timestamp": "2025-12-02T17:46:03.316Z",
"logs": "https://github.com/GitHubSecurityLab/seclab-taskflow-agent/actions/runs/19868069908",
"duration": 211
},
"git": {
"branch": "7dfd75111a64ae19196489e54bc87d0097afef38",
"commit": "7dfd75111a64ae19196489e54bc87d0097afef38",
"verified": true
},
"context": {
"actor": "kevinbackhouse",
"noop": false,
"fork": true
},
"reviews": {
"count": 1,
"decision": "APPROVED"
},
"parameters": {
"raw": null,
"parsed": null
}
} |
I've also kept the old name,
COPILOT_TOKEN, for backwards compatibility.I've replaced
AI_API_ENDPOINTwith a function. Otherwise,capi.pyreads the value fromos.environas soon ascapi.pyis imported, which is usually beforeload_dotenvis called, so storing the value in a.envfile didn't work.Replacing AI_API_ENDPOINT` with a function also enabled me to make the unit test simpler.