Skip to content

Conversation

@kevinbackhouse
Copy link
Collaborator

I've also kept the old name, COPILOT_TOKEN, for backwards compatibility.
I've replaced AI_API_ENDPOINT with a function. Otherwise, capi.py reads the value from os.environ as soon as capi.py is imported, which is usually before load_dotenv is called, so storing the value in a .env file didn't work.
Replacing AI_API_ENDPOINT` with a function also enabled me to make the unit test simpler.

Copilot AI review requested due to automatic review settings December 2, 2025 15:11
Copilot finished reviewing on behalf of kevinbackhouse December 2, 2025 15:12
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 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 for AI_API_TOKEN first, then falls back to COPILOT_TOKEN
  • Converted AI_API_ENDPOINT constant to get_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.

kevinbackhouse and others added 2 commits December 2, 2025 15:19
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings December 2, 2025 15:21
Copilot finished reviewing on behalf of kevinbackhouse December 2, 2025 15:27
@kevinbackhouse kevinbackhouse marked this pull request as ready for review December 2, 2025 15:56
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@kevinbackhouse
Copy link
Collaborator Author

smoke test

@github-actions
Copy link

github-actions bot commented Dec 2, 2025

Deployment Triggered 🚀

kevinbackhouse, started a branch deployment to smoketest (branch: 71ffdfe454405608a35cfe3945f1ff7311a3cf0d)

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
  }
}

@github-actions
Copy link

github-actions bot commented Dec 2, 2025

Deployment Results ❌

kevinbackhouse had a failure when deploying branch 71ffdfe454405608a35cfe3945f1ff7311a3cf0d to smoketest

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
  }
}

@kevinbackhouse
Copy link
Collaborator Author

smoke test

@github-actions
Copy link

github-actions bot commented Dec 2, 2025

Deployment Triggered 🚀

kevinbackhouse, started a branch deployment to smoketest (branch: 7dfd75111a64ae19196489e54bc87d0097afef38)

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
  }
}

@github-actions
Copy link

github-actions bot commented Dec 2, 2025

Deployment Results ✅

kevinbackhouse successfully deployed branch 7dfd75111a64ae19196489e54bc87d0097afef38 to smoketest

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
  }
}

@kevinbackhouse kevinbackhouse merged commit 98c254d into GitHubSecurityLab:main Dec 2, 2025
9 checks passed
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