Search before asking
What happened
The collectOrgMetrics subtask in the gh-copilot plugin fails immediately with error parsing response when collecting organization-level Copilot usage metrics via the organization-1-day report endpoint. The error occurs for every configured organization, blocks the entire pipeline, and prevents other tasks (Jenkins, Jira, etc.) from completing.
Error from logs:
level=error msg=" [pipeline service] [pipeline #24] [task #5234] subtask collectOrgMetrics ended unexpectedly
Wraps: (2) error parsing response from orgs/REDACTED_ORG/copilot/metrics/reports/organization-1-day
Error types: (1) *hintdetail.withDetail (2) *errors.errorString"
The subtask completes in ~1 second (not a timeout), suggesting the GitHub API responds successfully but the response body cannot be unmarshalled into the expected reportMetadataResponse struct.
Environment:
- DevLake version: v1.0.3-beta10
- Database: MySQL (CloudSQL)
- Authentication: Classic PAT with scopes
manage_billing:copilot, read:enterprise, read:org
- Copilot Metrics API policy: enabled
- PAT owner: organization owner
- Deployment: Helm on GKE
What do you expect to happen
The collectOrgMetrics subtask should either:
- Successfully parse the response from
GET /orgs/{org}/copilot/metrics/reports/organization-1-day, or
- Provide a clear error message including the HTTP status code and response body when parsing fails (e.g., "unexpected response format, expected JSON object with download_links")
How to reproduce
- Deploy DevLake v1.0.3-beta10
- Create a
gh-copilot connection with a classic PAT and an organization
- Add the connection to a blueprint and trigger a pipeline
- Observe
collectOrgMetrics fails with "error parsing response"
Analysis
The ResponseParser in org_metrics_collector.go expects the response to unmarshal into a reportMetadataResponse struct (containing DownloadLinks). The GitHub API at GET /orgs/{org}/copilot/metrics/reports/organization-1-day?day=YYYY-MM-DD may be returning a response in a format that doesn't match this struct.
Additionally, this error is fatal — it causes the entire pipeline to fail, blocking unrelated tasks like Jenkins and Jira collection that run in the same pipeline stage.
Suggested improvements
- Add verbose logging of the raw response body (or at least the HTTP status code and first N bytes) when parsing fails, to make debugging easier
- Validate the response format and provide a clear error message (e.g., "unexpected response format, expected JSON object with download_links")
Version
v1.0.3-beta10
Are you willing to submit PR?
Code of Conduct
Search before asking
What happened
The
collectOrgMetricssubtask in thegh-copilotplugin fails immediately witherror parsing responsewhen collecting organization-level Copilot usage metrics via theorganization-1-dayreport endpoint. The error occurs for every configured organization, blocks the entire pipeline, and prevents other tasks (Jenkins, Jira, etc.) from completing.Error from logs:
The subtask completes in ~1 second (not a timeout), suggesting the GitHub API responds successfully but the response body cannot be unmarshalled into the expected
reportMetadataResponsestruct.Environment:
manage_billing:copilot,read:enterprise,read:orgWhat do you expect to happen
The
collectOrgMetricssubtask should either:GET /orgs/{org}/copilot/metrics/reports/organization-1-day, orHow to reproduce
gh-copilotconnection with a classic PAT and an organizationcollectOrgMetricsfails with "error parsing response"Analysis
The
ResponseParserinorg_metrics_collector.goexpects the response to unmarshal into areportMetadataResponsestruct (containingDownloadLinks). The GitHub API atGET /orgs/{org}/copilot/metrics/reports/organization-1-day?day=YYYY-MM-DDmay be returning a response in a format that doesn't match this struct.Additionally, this error is fatal — it causes the entire pipeline to fail, blocking unrelated tasks like Jenkins and Jira collection that run in the same pipeline stage.
Suggested improvements
Version
v1.0.3-beta10
Are you willing to submit PR?
Code of Conduct