Commit Graph
47 Commits
Author SHA1 Message Date
Rohit Agrawal - MSFT 3bf9306bd0 Record CAPI X-GitHub-Copilot-Request-Te on GitHub telemetry events (#339087)
* Record CAPI X-GitHub-Copilot-Request-Te on GitHub telemetry events

* PR feedback changes
2026-10-01 16:28:44 -07:00
Dirk Bäumer f2abb9c2d3 Support continuous reads and improve session management (#338380)
* Support continuous reads

* Remove adjusted read requests if grep result is not managing it anymore

* Improve adjustment code

* Improve reservation code

* Only emit event if a session is evicted

* More telemetry

* Add setting to package.json

* Refactor code for readability

* Fix test
2026-09-28 16:00:26 +00:00
Dirk Baeumer 0b0b34303f Address Copilot comments 2026-09-10 21:10:22 +02:00
Dirk Baeumer 0f525cd6dd Update grep result handling to include session URI and improve event firing 2026-09-10 19:05:01 +02:00
Dirk Bäumer d536fa603e Add node paths for telemetry in region context (#334320)
* Add node paths to the region for telemetry purpose

* Address CCRs
2026-09-03 17:47:58 +00:00
Dirk Bäumer ff8ef0b06d Send language ID for read file telemetry (#334231) 2026-09-03 11:34:51 +00:00
Dirk BäumerandCopilot Autofix powered by AI e6094c9396 Add GrepResultService and RegionContextProviderService implementations (#333727)
* First cut of GrepResultService

* Wire up a TS7 implementation

* WIP

* WIP

* WIP

* Add TS6 implementation

* WIP

* WIP

* Align implementation

* Polish telemetry and fix tests

* Potential fix for pull request finding

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

* Potential fix for pull request finding

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

* Enable developer action only for typescript and javascript

* More review comments fixed

* Handle dispose correctly

* Correct parent for property access

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-09-01 10:14:25 +00:00
Martin Aeschlimann 611c5dfed2 local harness: simplity checking for external resources (#331816)
* local harness: simplity checking for external resources

* fix test
2026-08-20 16:12:57 +00:00
Martin Aeschlimann 680caf21e4 warn when reading linked files (#331799)
* warn when reading symlinked files

* fix windows tests
2026-08-20 15:12:45 +00:00
Martin Check 09b07fe400 chat: avoid splitting surrogate pairs in read_file (#331005) 2026-08-16 07:59:52 +00:00
Martin AeschlimannandCopilot Autofix powered by AI 83535b58f9 Move ComputeAutomaticInstructions to extension (#314402)
* Move ComputeAutomaticInstructions to extension

* Potential fix for pull request finding

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

* update missing fullReferenceName

* update

* update

* update

* update

* update

* Remove ComputeAutomaticInstructions migration plan document

* Potential fix for pull request finding

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

* Potential fix for pull request finding

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

* Potential fix for pull request finding

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

* Potential fix for pull request finding

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

* Potential fix for pull request finding

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

* update

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-16 19:51:49 +00:00
Connor PeetandCopilot 65c56ba499 copilot: truncate long lines in read_file results (#317862)
Long lines in read_file output were getting pruned by the token-budget
prompt renderer, so the agent saw an empty result and looped — adding
unbounded session log size each retry. Truncate any line over 2000
characters at the source with a `[truncated]` marker, and append a
notice when any line was truncated so the model knows the data is
abbreviated rather than missing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-21 15:10:50 -07:00
Alex Dima 27ecfb15cf Thread session workingDirectory through tools, prompts, and confirmations
In the agents window, each chat session has its own working directory
that may differ from the current workspace folders (which change when
switching between sessions). This caused tools to search the wrong
folder, show spurious 'Allow reading external files?' prompts, and
render incorrect workspace_info in the system prompt.

Core plumbing:
- Add workingDirectory to IToolInvocationContext, IToolInvocationPreparationContext,
  ILanguageModelToolConfirmationRef, and IChatAgentRequest
- Enrich tool invocation context from model.workingDirectory in invokeTool()
- Include workingDirectory in toolInvocationToken built in extHostTypeConverters
- Pass workingDirectory through LanguageModelToolInvocationOptions and
  LanguageModelToolInvocationPrepareOptions (proposed API)
- Revive workingDirectory URI in extHostLanguageModelTools

Tool fixes (when workingDirectory is set, use it exclusively):
- chatExternalPathConfirmation: auto-approve paths within workingDirectory
- isFileExternalAndNeedsConfirmation / isDirExternalAndNeedsConfirmation /
  assertFileOkForTool: treat workingDirectory as workspace-internal
- createEditConfirmation: use workingDirectory for edit trust checks
- All edit tools (create_file, replace_string, multi_replace, apply_patch,
  insert_edit, edit_notebook, create_directory): pass workingDirectory
- resolveToolUri: resolve relative paths against workingDirectory
- inputGlobToPattern: scope unscoped globs to workingDirectory
- file_search / grep_search: scope searches to workingDirectory
- semantic_search: prefer workingDirectory for cwd
- run_in_terminal: prefer workingDirectory for terminal cwd
- fetchPageTool: check workingDirectory for file URI trust
- readFileTool / listDirTool / viewImageTool: pass workingDirectory

Prompt fixes:
- WorkspaceFoldersHint: show workingDirectory instead of workspace folders
- AgentMultirootWorkspaceStructure: generate file tree from workingDirectory
2026-05-08 16:15:11 +02:00
Paul da39f2813c Add support for load skill tool (#311800) 2026-04-24 16:42:16 -07:00
Abhitej John 487cc1bb1c Rename skillContentRead telemetry properties to use 'skill' prefix (#311945) 2026-04-22 14:39:06 -07:00
Abhitej John ee913ec5e6 Add skillContentRead telemetry event for skill provenance tracking (#4884)
* Add skillContentRead telemetry event for skill provenance tracking

Adds a new skillContentRead telemetry event fired when the read_file tool
successfully reads a skill file. Separate from readFileToolInvoked and
deferred via queueMicrotask to stay off the critical path.

Captures: skillNameHash, skillStorage (extension/internal/user/local),
extensionIdHash, extensionVersion, contentHash (GH event), plus plaintext
skillName, skillPath, extensionId (enhanced GH event).

Addresses https://github.com/microsoft/vscode/pull/306520#issuecomment-4160588650

* Address review: check skill before getText, use non-caching hash for content

- Move getSkillInfo/getExtensionSkillInfo check before getText() so
  non-skill reads don't materialize document text unnecessarily
- Export createSha256HashSyncInsecure and use it for contentHash to
  avoid retaining full file content in the global hash cache
- Fix TS2345: new Promise<void>(resolve => queueMicrotask(() => resolve()))

* Address PR review comments: consolidate telemetry, add internal MSFT event

- Merge sendSkillContentReadTelemetry into sendReadFileTelemetry to reuse
  already-computed extensionSkillInfo/skillInfo (pwang347 feedback)
- Remove queueMicrotask since sendReadFileTelemetry is already async
  fire-and-forget (pwang347 feedback)
- Switch back to getCachedSha256Hash for content hash - skill files are
  small and rarely change so caching is appropriate (pwang347 feedback)
- Add sendInternalMSFTTelemetryEvent with plaintext properties (digitarald)
- Extract shared plaintextProps to reduce duplication across GH, enhanced
  GH, and internal MSFT events
- Revert createSha256HashSyncInsecure export in crypto.ts (no longer needed)

* Address PR feedback: merge skill telemetry into sendReadFileTelemetry, use hash() from vscode core, add internal MSFT event, remove queueMicrotask

* Move skillStorage classification into platform layer

Borrowed from #4914: adds SkillStorage enum and ISkillInfo interface to
the platform layer, refactors _matchInstructionLocationsFromSkills to
tag storage provenance (Personal/Workspace/Extension/Internal) at
discovery time. Removes local getSkillStorage() from ReadFileTool.

Also adds isSkillMdFile(uri) guard so skillContentRead only fires for
SKILL.md files, not other assets in skill folders.

Switches skillContentRead hashes from SHA-256 to vscode core's hash()
for consistency with skillLoadedIntoContext event.
2026-04-01 23:39:12 +00:00
Paul 41b7ef8514 Support dynamic prompt variables (#4742)
* wip

* fixes

* update

* update

* updates

* updates

* clean

* clean

* clean

* fix tests

* update

* fix test
2026-03-27 21:55:42 +00:00
Bhavya U 46ab74fb49 feat: formalize deferred vs non-deferred tool status as opt-in on ICopilotTools (#4750)
Move the hardcoded nonDeferredToolNames set from the Anthropic networking
layer to an opt-in `nonDeferred` static property on each tool class.

- Add `nonDeferred?: boolean` to ICopilotToolCtor interface
- Add IToolDeferralService with isNonDeferredTool() for DI-based access
- Mark all 18 frequently-used tools as nonDeferred = true at declaration
- Register IToolDeferralService in prod, unit test, and vscode-node test
- Remove centralized nonDeferredToolNames set from anthropic.ts
- Fix latent bug: old 'ask_questions' entry never matched the real
  'vscode_askQuestions' tool name; now correctly included via
  ToolName.CoreAskQuestions

Fixes microsoft/vscode#303545
2026-03-27 05:40:52 +00:00
Vijay Upadya 9a4dc95e9b Support session references in troubleshoot skill + write models.json to debug logs (#4729)
* session reference for troubleshoot

* feedback update

* handle non-local session schemes

* handle non local path decode

* fix test failure
2026-03-26 21:24:07 +00:00
Martin Aeschlimann d275a7ed1e sessionLogDir not set for new chats (#4416)
* sessionLogDir not set for new chats

* fix test
2026-03-15 18:18:45 +00:00
Rob Lourens cc86f3c7a3 Split image viewing out of read file (#4394)
* Add dedicated view image tool (Written by Copilot)

* Remove stale read file test import (Written by Copilot)

* Add image extension coverage test (Written by Copilot)

* Update test snapshots
2026-03-13 06:01:55 +00:00
PaulandCopilot 1b74623ae7 Improve troubleshoot command session detection reliability (#4386)
* more reliable

* Apply suggestion from @Copilot

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

* PR

* revert

* update

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-12 23:33:12 +00:00
PaulandVijay Upadya 6eb5dbdbed Add feature flag for troubleshoot skill, misc cleanup and fixes (#4382)
* Add user-visible settings for chat debug file logging

* feedback updates

* update

* fix test

---------

Co-authored-by: Vijay Upadya <41652029+vijayupadya@users.noreply.github.com>
2026-03-12 21:20:57 +00:00
Paul 2472428c0d Move troubleshoot skill to files-based approach (#4365)
* v3

* wip

* wip

* nit

* wip

* permissions

* update

* update

* clean

* update

* clean

* update

* nit

* update
2026-03-12 07:22:28 +00:00
Paul f38eaa7850 Add chat troubleshoot skill (#4351)
* wip

* clean

* update

* nit
2026-03-11 08:35:30 +00:00
Connor Peet 7e7c1a6cc7 tools: add binary file support with hexdump display (#4331)
* tools: add binary file support with hexdump display

Adds support for reading and displaying binary files in the read file tool
with a hexdump-formatted view. This enables better handling of binary content
in the IDE context without attempting to interpret them as text.

- Adds hexdump utility to format binary data in a readable hex/ASCII view
- Extends readFileTool to detect binary files and provide formatted output
- Adds binaryFileHexdump prompt component for displaying binary content
- Integrates binary file variable support in file variable display
- Updates test fixtures with binary file handling scenarios

Fixes https://github.com/microsoft/vscode/issues/284178
Fixes https://github.com/microsoft/vscode/issues/299973

(Commit message generated by Copilot)

* pr comments

* baseline update

* baseline update
2026-03-10 21:49:13 +00:00
Rob Lourens 508d3f9a27 Support reading images with read_file (#4247)
* Support reading images with read_file

* Fix oversized image test to avoid 21MB allocation
2026-03-10 17:34:02 +00:00
Paul a83c989c99 Fix flaky extra external instructions confirmation for userData schemes (#3912)
* fix

* fix
2026-02-21 01:00:57 +00:00
Harald KirschnerandHarald Kirschner a1709b8fce Add skill name to readFileToolInvoked telemetry (#3739)
* Add skill name to readFileToolInvoked telemetry

* Rename telemetry field to nameField

---------

Co-authored-by: Harald Kirschner <digitarald@gmail.com>
2026-02-13 23:27:52 +00:00
Connor Peet 121ef83031 tools: avoid putting fences into file reads by default (#3528)
* tools: avoid putting fences into file reads by default

We've seen the model get confused here. Looking at vendor tools from Gemini and Codex CLIs, they don't add explicit line number messages like we do (which was motivation behind having the fences there in the first place. So let's try removing them. Controllable with EXP for sanity checking.

* tests and comments
2026-02-06 22:17:56 +00:00
Henning Dieterichs fabc136a7b Add chat.additionalReadAccessPaths setting for read-only access to external folders (#3520)
* Add chat.additionalReadAccessPaths setting for read-only access to external folders

Implements a new setting that allows users to specify folders outside the
workspace that Copilot Chat read-only tools (read_file, list_dir) can
access without requiring confirmation.

- Add github.copilot.chat.additionalReadAccessPaths setting (string array)
- Gate additional access behind a readOnly flag on assertFileOkForTool,
  isFileExternalAndNeedsConfirmation, and isDirExternalAndNeedsConfirmation
- Edit tools remain workspace-restricted (isFileOkForTool does not pass readOnly)
- .copilotignore rules are still respected for additional paths

Closes microsoft/vscode#293386

* Addresses PR feedback
2026-02-06 19:18:37 +00:00
Martin AeschlimannandCopilot b51d1a0f23 Use instruction index files to do file access checks (#3179)
* init

* update

* add skill folder check

* Update src/platform/customInstructions/common/customInstructionsService.ts

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

* Update src/extension/tools/node/toolUtils.ts

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

* Update src/platform/test/common/testCustomInstructionsService.ts

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

* Update src/platform/customInstructions/common/customInstructionsService.ts

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

* Update src/platform/test/common/testCustomInstructionsService.ts

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-26 20:58:19 +00:00
SteVen Batten e716a77b4c Support reading files outside of the current workspace (#3052)
* support reading files outside of the current workspace

* address comment
2026-01-22 23:20:18 +00:00
PaulandCopilot 339297e789 Handle extension-contributed skills for skill read UX (#3020)
* fix

* Update src/platform/customInstructions/common/customInstructionsService.ts

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

* PR

* fix

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-21 02:13:29 +00:00
Paul 447f836019 Custom chat render for agent skills (#2756)
* load

* updates

* update

* PR

* PR

* test

* fix test

* PR
2026-01-14 22:29:19 +00:00
Paul 749a8a92f9 Updates for Agent Skills alignment (#2634)
* update

* update telemetry

* update

* PR
2025-12-18 21:23:00 +00:00
Sandeep Somavarapu fedde4f1f1 clean up: (#2040)
* clean up:
- simplify namespaces
- simplify defining settings

* fix unused configs
2025-11-17 14:32:52 +00:00
Don Jayamanne 30c867c483 Move formatUriForFileWidget into common (#1973) 2025-11-13 06:00:21 +00:00
Bryan Chen 764f0d6a63 tool can give alternative definition by model (#1400)
* tool can give alternative definition by model

* Pass IChatEndpoint in getEnabledTools for calling tools' alternativeDefinition

* Introduce a ICopilotToolExtension to support override existing built-in tools and provide alternative definition.

* Fix errors

* add gpt-5-codex

* remove gpt-5
2025-11-07 22:42:45 +00:00
Copilotandroblourens 856d7ee051 Validate read_file offset parameter and report actual line count when out of bounds (#1759)
* Initial plan

* Add out-of-bounds offset validation for read_file tool

Co-authored-by: roblourens <323878+roblourens@users.noreply.github.com>

* Add test for offset 0 clamping behavior

Co-authored-by: roblourens <323878+roblourens@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: roblourens <323878+roblourens@users.noreply.github.com>
2025-11-03 16:25:56 +00:00
Rob Lourens 9eda1cb04b Fix read_file tool in askagent (#1201)
Fix #269223
2025-10-01 05:25:11 +00:00
Rob Lourens 4aad4912eb Enable claude code agents (#734)
* Codex agent test

* more

* Fix model server for openai

* Some improvements

* Fix tool calling

* Get it building again

* Add output delta event

* stuff

* Add claude-code dependency

* Fix

* Clean up copied anthropic types, and message conversion code

* Update cc sdk

* Set up permission MCP server

* Basic mcp permission tool

* Bump version

* Use a chat session provider for claude code

* Use IChatEndpoint instead of ext api lm

* Cleanup

* Bump engine version

* Delete codex tool

* try to fix paths
2025-08-24 05:40:29 +00:00
Connor Peet 2732a9f48f tools: initial implementation of virtual tools (#310)
This behavior is enabled behind a setting `"github.copilot.chat.virtualTools.enabled": true,`

When enabled, if the tool count is over a threshold value, we'll group
tools into 'virtual tools'. The virtual tools act as directories that
only activate and show the tools they contain when the model calls them.
Grouping is done for an entire extension or MCP server if it presents
a small number of MCP tools, or for a categorization of tools when there
are a large number. Built-in tools are never grouped.

Expanded tool groups are automatically re-collapsed, based on LRU, if
the too limit is exceeded, or optimistically to a lower threshold during
summarization when there's going to be a cache miss anyway.

Todo:
- Better validation of LM categorization (ensure no missing tools)
- General Telemetry
- And logic to ensure that the tool limit can never be hit (heirarchal grouping)
- Explore embeddings as better pre-selection of expanded virtual tools
- Explore subagents as an alternative to expansion
- Success telemetry based on mirrored requests
2025-07-19 01:56:21 +00:00
Connor Peet aa74d01da2 tools: add trajectory telemetry for read_file (#118) 2025-07-03 22:19:43 +00:00
Rob Lourens fbbdf3da82 Add proper path to some file tool errors, send read_file telemetry for invalid input 2025-06-29 10:06:07 -07:00
Rob Lourens b8141c0342 Fix swallowed error for some read_file failures 2025-06-29 10:03:21 -07:00
kieferrmandcopilot-swe-agent[bot] 333d9a4053 Hello Copilot
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2025-06-27 11:35:20 +02:00