Commit Graph
60 Commits
Author SHA1 Message Date
Alex Ross 8a9656dea5 More complete getErrorCode (#312776)
* More complete getErrorCode

* Use error name
2026-04-27 09:09:34 -07:00
Alex Ross e4a9466953 Add error telemetry for GetPullRequestGlobal (#312362) 2026-04-24 08:36:25 -07:00
Matt BiernerandCopilot cf82f857de Add basic github lexical search
Fixes #312210

This is using the old search endpoint. We'll start switching over the new one once it's ready

Co-authored-by: Copilot <copilot@github.com>
2026-04-23 14:16:49 -07:00
Alex RossandCopilot e923ba6a9e Add telemetry for assignable users (#312104)
* Add telemetry  for assignable users

Co-authored-by: Copilot <copilot@github.com>

* CCR feedback

Co-authored-by: Copilot <copilot@github.com>

---------

Co-authored-by: Copilot <copilot@github.com>
2026-04-23 15:23:40 +02:00
Josh SpicerandCopilot 47a66928de fix: reduce /enabled endpoint traffic and surface unexpected status codes (#308879)
* fix: cache CCA disabled results with 5-min TTL to reduce /enabled traffic

The checkCCAEnabled() method previously only cached enabled=true results
(introduced in 19541d79ea). For the majority of users whose repos have CCA
disabled, every provideChatSessionProviderOptions() call bypassed the cache
and hit the jobs/:owner/:repo/enabled CAPI endpoint unconditionally. With
growing adoption, this became significant upstream traffic.

Fix: cache all /enabled results. enabled=true keeps the 30-min TTL.
enabled=false/undefined uses a new 5-min TTL (CCA_DISABLED_CACHE_TTL_MS),
short enough that users who just enabled CCA won't wait long, but long enough
to dramatically reduce repeated calls.

To support the shorter TTL for disabled entries without changing the enabled
TTL, TtlCache.set() now accepts an optional per-entry ttlMs override that
takes precedence over the cache-wide TTL.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: surface unexpected /enabled status codes (e.g. 429) in telemetry

Previously, isCCAEnabled's default case returned { enabled: undefined }
with no statusCode, swallowing 429 rate-limit and 5xx responses.

Changes:
- Widen CCAEnabledResult.statusCode from 401|403|422 to number so
  unexpected codes can be propagated
- Return statusCode: response.status in isCCAEnabled's default case
- Add sendTelemetryErrorEvent('copilot.codingAgent.CCAIsEnabledUnexpectedStatus')
  in checkCCAEnabled for any status code outside {401, 403, 422}, with
  isRateLimited flag for quick 429 filtering in dashboards

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* refactor: hoist knownStatusCodes to constant and add GDPR annotation

- Extract CCA_KNOWN_STATUS_CODES to file-level Set to avoid re-creating
  it on every call and centralize the list of handled status codes
- Add __GDPR__ comment block for the new
  copilot.codingAgent.CCAIsEnabledUnexpectedStatus telemetry error event

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-09 16:38:16 -07:00
Ladislau Szomoru edd739dacb Cloud Session - include base ref information (#5003) 2026-04-06 19:44:42 +00:00
Tyler James Leonhardt 06ee95266a feat(auth): Enhance GitHub session handling with detailed prompts (#4778)
- Updated `getGitHubSession` method to require `StrictAuthenticationPresentationOptions` for `createIfNone` and `forceNewSession` parameters, ensuring meaningful context is provided to users.
- Modified various service implementations to include localized detail messages for authentication prompts, improving user experience during sign-in.
- Added a comprehensive usage guide for the `IAuthenticationService`, detailing session types, overloads, and constraints.
- GH MCP Feature doesn't bother user over and over for auth
- Introduced a new `AGENTS.md` file to document authentication service usage and best practices.
2026-03-27 20:56:54 +00:00
Logan Ramos 453b84c4c9 Use VS code org to determine team membership (#4769) 2026-03-27 16:33:23 +00:00
Osvaldo OrtegaandCopilot 7ef435dddc sessions: Add pullRequestState metadata for PR status icons (#4675)
* sessions: Add pullRequestMerged metadata for PR status icons

Add `pullRequestMerged` to session metadata so the VS Code session list
can show a git-merge icon for merged PRs vs git-pull-request for open ones.

Changes:
- Add `pullRequestMerged` to `ChatSessionWorktreePropertiesV2` interface
- Cloud provider: derive merged status from `pr.state` in metadata
- CLI provider: propagate merged status through PR detection pipeline
  (`detectPullRequestFromGitHubAPI`, retry logic, session item metadata)
- Update tests with `state` field in mock PR objects

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: Re-check PR merge status periodically

Previously, PR detection was skipped entirely once a pullRequestUrl
existed. This meant pullRequestMerged would never be updated after
the initial detection.

Now the detection pipeline continues re-checking sessions that have
an unmerged PR on a cooldown interval, and only marks detection as
permanently done once the PR is merged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: Use longer cooldown for PR merge-status re-checks

Sessions that already have a pullRequestUrl but aren't yet merged now
use a 10-minute cooldown (_PR_MERGE_RECHECK_INTERVAL) instead of the
1-minute interval used for initial PR detection. This prevents burning
through the GitHub API rate limit when many sessions have open PRs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: Add isDraft to GraphQL, replace pullRequestMerged with pullRequestState

Add `isDraft` field to both PR GraphQL queries and to the
`PullRequestSearchItem` interface. Replace the `pullRequestMerged`
boolean with a `pullRequestState` string ('open' | 'closed' | 'merged'
| 'draft') throughout the detection pipeline:

- New `derivePullRequestState()` helper in githubAPI.ts
- `ChatSessionWorktreePropertiesV2.pullRequestState` replaces
  `pullRequestMerged`
- CLI and Cloud providers both emit `pullRequestState` in metadata
- `shouldDetectPullRequest` checks for `'merged'` state as terminal
- `processPendingPrDetections` compares state strings

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: Update derivePullRequestState to prioritize terminal states over draft

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-25 19:54:11 +00:00
Osvaldo Ortega 54bc8da9ee feat: fallback PR detection via GitHub API when MCP tool fails or PR created externally (#4532)
* feat: implement async pull request detection via GitHub API for completed chat sessions

* refactor: streamline pull request detection logic and improve function naming

* feat: add findPullRequestByHeadBranch method to MockOctoKitService and update tests to use IOctoKitService mock

* fix: instantiate IOctoKitService mock correctly in tests

* feat: implement debounced batch processing for pull request detection in completed chat sessions

* refactor: remove worktreeProperties from pull request detection logic

* Review comments
2026-03-19 23:03:54 +00:00
dc222ef76b Resubmit #4381 (#4395)
* Add new rate limiter

* Fix for service injections

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Sam Cutler <itsibitzi@github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-13 07:46:24 +00:00
Matt BiernerandCopilot Autofix powered by AI 5e103bbab2 Update handling of errors in external ingest (#4389)
* Update handling of errors in external ingest

Make sure we handle error responses and retries  better

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Handle retry-after

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-13 04:04:40 +00:00
Matt Bierner 6ccbe16aa4 Use different throttlers per endpoint (#4376)
Github has different rate limits per endpoint
2026-03-12 22:31:32 +00:00
Josh Spicer e852bd8a42 cloud: patches for GHE (#4235)
* feat: add GHE (GitHub Enterprise) support for cloud agent

- Add host field to GithubRepoId (defaults to github.com)
- Add rawHost to parseRemoteUrl for SSH alias resolution
- Add toGithubWebUrl helper for constructing host-aware URLs
- Use ICAPIClientService.dotcomAPIURL in GithubRepositoryService
  instead of hardcoded https://api.github.com
- Update cloud session error messages and UI links to use repo host
- Support GHE URLs in _normalizeGitUri, remote agent icons, and
  github repo search tool
- Add comprehensive tests for GHE URL parsing and host propagation

* fix: make PR fetch resilient in provideChatSessionItems

Wrap individual getPullRequestFromGlobalId calls in try-catch so
a single failure (e.g. PermissiveAuthRequiredError on GHE) doesn't
prevent all other sessions from loading. Log warnings for failures.

* fix: refresh cloud sessions when CAPI URL changes for GHE

Listen to IDomainService.onDidChangeDomains so that when the GHE
Copilot token arrives and updates the CAPI base URL, the sessions
provider clears caches and re-fetches against the correct endpoint.

Previously, the initial session fetch raced with token minting and
hit the default api.githubcopilot.com with a GHE token, getting 401.

Also cleaned up diagnostic retry logic in getAllSessions and kept
useful debug logging for session fetch diagnostics.

* fix: clear chatSessionItemsPromise on refresh to prevent stale results

refresh() was clearing cachedSessionItems but not chatSessionItemsPromise,
so when the CAPI URL changed and triggered a refresh, the old in-flight
promise (which hit the wrong URL) was still returned by subsequent
provideChatSessionItems calls, preventing the re-fetch.

* tidy
2026-03-11 03:37:36 +00:00
Logan Ramos 553b44e25b Make github api surface less ugly (#4334)
* Make github api surface less ugly

* Fix some broken api calls
2026-03-10 20:29:03 +00:00
Logan RamosandCopilot 93525d253a Add telemetry to keep an eye on the number of network requests we're sending (#4321)
* Add telemetry to keep an eye on the number of network requests we're sending

* Fix unreachable code

* Update src/extension/completions-core/vscode-node/lib/src/networking.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix github api call site

* Apply callsite post spread

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-10 17:42:45 +00:00
Matt BiernerandCopilot 8ce07df287 Extract out IGithubApiFetcherService (#4171)
* Extract out `IGithubApiFetcherService`

This service provides a consistent way to call github apis with throttling and error handling

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-03 23:44:58 +00:00
Logan RamosandCopilot b65327e196 Make Copilot GitHub Status aware (#4165)
* Make Copilot GitHub Status aware

* Update src/platform/chat/common/commonTypes.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix tests

* Tests pass now I hope thanks

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-03 21:28:14 +00:00
Osvaldo Ortega 13f17b76ce Adding branch name to metadata cloud provider (#4138)
* Adding branch name to metadata cloud provider

* Review comment
2026-03-03 02:09:09 +00:00
Paul 8564af0be9 Deprecate infer for org custom agents and support new properties (#3817)
* deprecate

* user-invocable
2026-02-18 21:32:31 +00:00
Paul ded7091497 Don't throw errors for org custom instructions flow in personal repo (#3735)
* fix org error

* update
2026-02-13 23:11:06 +00:00
Paul 232d2269ad Fix for org agents/instructions to handle pagination cases better (#3298)
* fix

* more clean

* nit
2026-01-30 01:02:06 +00:00
Josh SpicerandCopilot 89771ff43a Cloud Agent: check /enabled (#3241)
* Cloud Agent: check /enabled

* Update src/platform/github/common/githubService.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-28 21:02:09 +00:00
PaulandCopilot e8a3ddf7c7 Add support for organization custom instructions (#2310)
* PR

* activation

* fix test

* wip

* update

* tests

* Update src/platform/github/common/githubService.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/extension/agents/vscode-node/organizationInstructionsProvider.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/platform/github/common/octoKitServiceImpl.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* update

* update setting name

* wip

* fix

* use enum

* PR

* nit

* add polling

* tests

* cleanup

* use helper

* remove instructions

* clean

* Revert "clean"

This reverts commit d00db3841282483f0c122d815bf330d715c8e125.

* Revert "remove instructions"

This reverts commit 24f3e2ecabab76163eb32610f4d737d0406f98da.

* update

* update per discussion

* clean

* update

* update

* Update

* update

* update

* clean

* test

* test

* fixes

* fixes

* fix tests

* update test

* yaml

* fix

* config update

* clean

* fix

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-22 20:21:02 +00:00
Osvaldo Ortega f6fa91f512 Repositories picker for cloud sessions (#2815) 2026-01-13 21:30:22 +00:00
31182a90c6 graphql query to detect partner agents (#2775)
* Initial plan

* Add GraphQL-based partner agent detection with caching

- Add GraphQL queries for fetching assignable actors (suggestedActors and assignableUsers APIs)
- Add getAssignableActors method to IOctoKitService interface
- Implement dynamic partner agent detection in CopilotCloudSessionsProvider
- Add caching mechanism to avoid repeated API calls
- Update known Copilot agent logins based on spec
- Fall back to hardcoded list when API is unavailable

Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>

* Fix MockOctoKitService to include getAssignableActors method

Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>

* Use HARDCODED_PARTNER_AGENTS `at` values for partner agents

- Create COPILOT_AGENT_METADATA mapping for known Copilot agent logins
- Look up `at` values from HARDCODED_PARTNER_AGENTS when available
- Preserve the `at` field structure from the hardcoded list

Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>

* Remove COPILOT_AGENT_METADATA and use HARDCODED_PARTNER_AGENTS directly

- Delete COPILOT_AGENT_METADATA mapping
- Simplify getAvailablePartnerAgents to check HARDCODED_PARTNER_AGENTS directly
- Check if agent ID or name matches assignable actors
- Preserve all fields from HARDCODED_PARTNER_AGENTS including `at` values

Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>

* polish

* Update src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix auth

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-09 21:52:46 +00:00
Josh Spicer 32a61ef650 polish partner agent integration (with hardcoded values and no repo checks (#2754) 2026-01-09 03:05:47 +00:00
Josh SpicerandCopilot dc65f64c8c CCA Model picker (#2740)
* CCA Model picker (depends on https://github.com/microsoft/vscode-capi/pull/53)

* bump copilot cli

* Update src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-08 19:57:48 +00:00
Tyler James Leonhardtandcopilot-swe-agent[bot] f407810077 Allow passing in auth behavior into octokit service (#2635)
* Allow passing in auth behavior into octokit service

Commit 1: Internal refactoring that does not influence behavior at all. It just sets us up to have control over the auth behavior.

* Set `createIfNone: false` to prevent auth prompts in organizationAndEnterpriseAgentProvider (#2636)

* Initial plan

* Change createIfNone to false and remove runWithAuthCheck method

Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>

* Update src/extension/agents/vscode-node/organizationAndEnterpriseAgentProvider.ts

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>

* Fixes the bug

* Another case that should be a non-functional change

* Have service throw welknown error

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
2025-12-19 00:39:56 +00:00
Osvaldo Ortega 6a0659daa9 Reduce CCA polling (#2617) 2025-12-17 01:38:36 +00:00
Tyler James Leonhardt c90db9ae49 Move to new auth API shape (#2595)
This will be more intentional on when one token is needed than the other.
2025-12-15 23:39:33 +00:00
Paul c34a120484 Support additional properties for custom org/enterprise agents (#2530)
* add properties

* update test
2025-12-11 19:49:51 +00:00
Matt Bierner 3c8134184b Enable no-unexternalized-strings in repo (#2448)
Enables the same `no-unexternalized-strings` with have in `vscode` in this repo. This make sure we have a more consistent style across repos and when generating edits
2025-12-05 18:45:12 +00:00
Paul 194f649eaa Make organization and enterprise agents available globally (#2393)
* wip

* add extra call

* updates

* use 5
2025-12-04 21:04:52 +00:00
Paul 0b46e30f59 Add support for GH Custom Agents (#2118)
* WIP

* WIP

* use git here

* repo

* Update name

* wip

* wip

* wip

* wip

* updates

* readonly

* revert

* update

* clean

* PR and test

* test update

* test update
2025-11-26 20:57:44 +00:00
Osvaldo Ortega 6c944a5c46 Fetch sessions without nwo (#2143)
* Fetch sessions without nwo

* Revert

* Package update
2025-11-21 23:32:44 +00:00
PaulandCopilot eeec70057e Update CAPI to 0.2.3 (#2135)
* update

* Update src/platform/github/common/githubService.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-21 18:54:42 +00:00
Josh Spicer 057fa609f6 Refactor cloud agent (#2097)
* refactor cloud session class

* pass correct context

* throw errors and fix parameter typo

* remove stale test

* remove debug markdown

* reset confirmations commadn

* some loose ends

* tweaks while rate limited

* update test

* more accurate

* nevermind

* add back cli handleConfirmationData

* nullptr

* restore test

* polish

* this is the pr uri

* polish
2025-11-20 06:47:04 +00:00
Osvaldo Ortegaandcopilot-swe-agent[bot] 4c93aa653e Using capi package for sessions APIs (#2052)
* Using capi package for sessions APIs

* Package update

* Initial plan

* Add error logging and fix logic error in getCustomAgents

Co-authored-by: osortega <48293249+osortega@users.noreply.github.com>

* Remove descriptive message from getAllOpenSessions error logging

Co-authored-by: osortega <48293249+osortega@users.noreply.github.com>

* Change to protected

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2025-11-19 00:12:53 +00:00
Peng Lyu 216cf74887 reenable padawan content provider from chat ext itself (#2027)
* padawan diff: improve missing file content

* reenable content provider from chat ext itself
2025-11-15 06:31:34 +00:00
Alex Ross b40257ca51 Remove anys from githubAPI.ts (#1946)
* Remove anys from githubAPI.ts

* Remove from ignores
2025-11-12 10:47:21 +00:00
Ladislau Szomoru 3208e58b22 CCA - provide number of files modified in the pull request (#1872) 2025-11-08 13:53:18 +00:00
Josh Spicer d7848b3e05 permissive gh auth (#1817)
* permissive gh auth

* remove dead code
2025-11-06 18:59:54 +00:00
Josh SpicerandCopilot 41557e3351 fix cloud agent branch detection (#1786)
* fix cloud agent branch detection

* Update src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/platform/github/common/githubAPI.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-04 21:43:36 +00:00
Peng Lyu b5ff52a6d4 Support file content change part for cloud agent (#1641)
* Support file content change part for cloud agent

* move off Buffer

* 💄
2025-10-30 23:15:48 +00:00
Josh Spicer bc809f83c4 add closePullRequest() and adopt in cloud-agent (#1594)
* remove pr extension check

* add closePullRequest() and adopt in cloud-agent
2025-10-24 19:37:48 +00:00
Josh Spicer f2b112a42c wire up multifilediff part (#1485)
* wire up multifilediff part

* check in src/extension/chatSessions/vscode-node/pullRequestFileChangesService.ts

* pass readOnly flag to ChatResponseMultiDiffPart
2025-10-22 04:21:50 +00:00
Osvaldo Ortega 820098c130 CCA switch to use sessions API (#1455)
* CCA switch to use sessions API

* resource state filtering
2025-10-21 21:18:27 +00:00
Josh Spicer cc0e436fb8 Copilot Cloud Agent: Custom Agents (#1438)
* initial pass at cloud custom_agents

* add exclude_invalid_config=true

* conditionally report option and always report for untitled (adopts https://github.com/microsoft/vscode/pull/272333)
2025-10-20 22:05:57 +00:00
Osvaldo Ortega a79b04606b CCA support for PR card and PR link (#1411)
* CCA support for PR card and PR link

* Name mapping
2025-10-18 00:10:26 +00:00