feat: add Copilot Cloud Agent sessions view#835
Merged
Conversation
- New 'Cloud Agent' tab in Usage Analysis showing tasks, sessions, AI credits
- agentSessionsService.ts: fetches /agents/repos/{owner}/{repo}/tasks API
- Source detection: cloud-agent vs cli-remote vs unknown (no double-counting)
- Detail fetch capped at 50 tasks/repo with partial flag for transparency
- Lazy-loaded on first tab visit with progress updates
- scripts/fetch-agent-sessions.js for workflow data pre-fetch
- copilot-setup-steps.yml: daily cached agent session fetch via actions/cache
- 11 new unit tests for detectSessionSource and fetchAgentSessionsForRepo
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add sanitizeAgentSessionsData() that escapes all string fields when receiving message.data from the extension host, matching the existing sanitizeRepoPrStatsData() pattern. renderAgentSessionsContent() then works with pre-sanitized strings and no longer calls escapeHtml() internally. Resolves CodeQL cross-site scripting finding. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new 🤖 Cloud Agent tab to the Usage Analysis webview showing GitHub Copilot cloud agent session statistics — tasks, sessions, and AI credits consumed — without double-counting CLI or local IDE chat sessions.
What's new
New
Cloud Agenttab in Usage Analysisvscode-extension/src/agentSessionsService.ts(new)/agents/repos/{owner}/{repo}/tasksAPIcloud-agent/cli-remote/unknownmodel !== ''ORusagefield presentmodelfield present but empty stringmodelfield absent entirelypartial: truewhen exceededscripts/fetch-agent-sessions.js(new)./usage-data/agent-sessions.json.github/workflows/copilot-setup-steps.ymlactions/cache(v4.2.3)agent-sessions-{repo}-{YYYY-MM-DD}— refreshes once per dayactions: writepermission for cache savecontinue-on-error: true— workflow never fails due to thisTests
agentSessionsService.test.tsNo double-counting
/agents/repos/.../tasksAPI