Skip to content

fix(copilot): Update models for GitHub Copilot Tasks API field migrations#111890

Merged
JoshFerge merged 3 commits into
masterfrom
fix/copilot-api-field-migration
Mar 31, 2026
Merged

fix(copilot): Update models for GitHub Copilot Tasks API field migrations#111890
JoshFerge merged 3 commits into
masterfrom
fix/copilot-api-field-migration

Conversation

@JoshFerge
Copy link
Copy Markdown
Member

@JoshFerge JoshFerge commented Mar 31, 2026

Summary

  • Update GithubCopilotTask, GithubCopilotSession, and related models to match the current live GitHub Copilot Tasks API response shape
  • creator_id/owner_id (int) → creator/owner (object with id field)
  • last_updated_atupdated_at
  • user_collaborators changed from list[int] to list[Any] to handle the upcoming migration from int IDs to User objects
  • Added new fields: repository, html_url, url, slug on collaborators
  • Removed deprecated status field from GithubCopilotTask — our code only reads state
  • Removed legacy {"task": {...}} response envelope handling and GithubCopilotTaskResponse model — the API returns task objects directly now

Context: GitHub is rolling out breaking changes to their Copilot Tasks API. We verified the current API state by testing against a live repo — last_updated_at, creator_id, owner_id, and the {"task": ...} envelope are already gone. status is still present alongside state but deprecated. user_collaborators type change (int → object) is coming soon.

Our polling flow (poll_github_copilot_agents) only reads task.state and task.artifacts, so it's unaffected. These changes prevent Pydantic validation failures when parsing API responses with the new field shapes.

Test plan

  • All existing tests pass (54 tests across test_client.py + test_coding_agent.py)
  • Verified against live GitHub Copilot API

…ions

GitHub is migrating several fields on their Copilot Tasks API:
- creator_id/owner_id (int) → creator/owner (object with id)
- last_updated_at → updated_at
- user_collaborators will change from list[int] to list[User]
- repo_id → repository object
- status is deprecated in favor of state

Update our Pydantic models to match the current live API response shape
and handle the upcoming user_collaborators type change gracefully.

Agent transcript: https://claudescope.sentry.dev/share/rNNf31sxU5AKRpBHV8KBbVC0ZlYKtV-jniNfeaRfnus
@JoshFerge JoshFerge requested review from a team as code owners March 31, 2026 16:06
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 31, 2026
Our code only reads task.state; Pydantic ignores the extra field in API
responses, so keeping it on the model is misleading.
…askResponse

The API no longer wraps responses in {"task": {...}}. Remove the dead
code path, the unused model, and the test that covered it.
Copy link
Copy Markdown
Member

@sehr-m sehr-m left a comment

Choose a reason for hiding this comment

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

yay more copilot changes

@JoshFerge JoshFerge enabled auto-merge (squash) March 31, 2026 16:25
@JoshFerge JoshFerge merged commit a5f6160 into master Mar 31, 2026
67 checks passed
@JoshFerge JoshFerge deleted the fix/copilot-api-field-migration branch March 31, 2026 16:36
dashed pushed a commit that referenced this pull request Apr 1, 2026
…ions (#111890)

## Summary
- Update `GithubCopilotTask`, `GithubCopilotSession`, and related models
to match the current live GitHub Copilot Tasks API response shape
- `creator_id`/`owner_id` (int) → `creator`/`owner` (object with `id`
field)
- `last_updated_at` → `updated_at`
- `user_collaborators` changed from `list[int]` to `list[Any]` to handle
the upcoming migration from int IDs to User objects
- Added new fields: `repository`, `html_url`, `url`, `slug` on
collaborators
- Removed deprecated `status` field from `GithubCopilotTask` — our code
only reads `state`
- Removed legacy `{"task": {...}}` response envelope handling and
`GithubCopilotTaskResponse` model — the API returns task objects
directly now

**Context:** GitHub is rolling out breaking changes to their Copilot
Tasks API. We verified the current API state by testing against a live
repo — `last_updated_at`, `creator_id`, `owner_id`, and the `{"task":
...}` envelope are already gone. `status` is still present alongside
`state` but deprecated. `user_collaborators` type change (int → object)
is coming soon.

Our polling flow (`poll_github_copilot_agents`) only reads `task.state`
and `task.artifacts`, so it's unaffected. These changes prevent Pydantic
validation failures when parsing API responses with the new field
shapes.

## Test plan
- [x] All existing tests pass (54 tests across `test_client.py` +
`test_coding_agent.py`)
- [x] Verified against live GitHub Copilot API
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants