Skip to content

fix: Chronicle session_files and session_refs tables always empty#312299

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-empty-session-files-refs
Draft

fix: Chronicle session_files and session_refs tables always empty#312299
Copilot wants to merge 2 commits intomainfrom
copilot/fix-empty-session-files-refs

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 24, 2026

Three independent bugs caused session_files and session_refs to never receive any rows despite the tracking code existing.

Root causes

  • Wrong OTel attribute name_extractToolArgs read from gen_ai.tool.input / gen_ai.tool.input.*, neither of which exists on VS Code tool spans. toolsService.ts stores arguments as gen_ai.tool.call.arguments (GenAiAttr.TOOL_CALL_ARGUMENTS), a JSON string. This made every extractFilePath / extractRefsFromMcpTool call receive {}, so nothing was ever tracked.

  • Missing tool names in FILE_TRACKING_TOOLS — the set only had CLI-era names (str_replace_editor, create) and was missing the VS Code Copilot editing tools: insert_edit_into_file, replace_string_in_file, multi_replace_string_in_file.

  • Unhandled argument shapesapply_patch embeds file paths inside the patch text (*** Add/Update/Delete File: <path>), not in a filePath field; multi_replace_string_in_file nests filePath inside a replacements array. Neither was handled by extractFilePath.

Changes

  • sessionStoreTracker.ts — rewrite _extractToolArgs to parse span.attributes[GenAiAttr.TOOL_CALL_ARGUMENTS]

  • sessionStoreTracking.ts:

    • Expand FILE_TRACKING_TOOLS with the three missing VS Code tool names (CLI names retained for compat)
    • Add dedicated extractFilePath branches for apply_patch (regex over patch text) and multi_replace_string_in_file (first entry of replacements array); uses existing getStringField helper
  • standupPrompt.spec.ts — replace the previously incorrect apply_patch test (which passed a synthetic { filePath } that never occurs at runtime) with tests covering all actual argument shapes

Copilot AI requested review from Copilot and removed request for Copilot April 24, 2026 04:34
Three root causes fixed:

1. _extractToolArgs used wrong OTel attribute name ('gen_ai.tool.input' /
   'gen_ai.tool.input.*') which never exists on VS Code tool spans. The
   actual attribute is GenAiAttr.TOOL_CALL_ARGUMENTS ('gen_ai.tool.call.arguments'),
   set by toolsService.ts. This caused every extractFilePath and
   extractRefsFromMcpTool call to receive an empty object.

2. FILE_TRACKING_TOOLS only contained CLI-era names (str_replace_editor, create)
   and was missing the VS Code Copilot file-edit tools: insert_edit_into_file,
   replace_string_in_file, multi_replace_string_in_file.

3. extractFilePath had no handling for the unique argument shapes of apply_patch
   (file paths embedded in patch text) and multi_replace_string_in_file (filePath
   inside replacements array).

Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/b403eb82-9561-4be5-81d6-56934aa9f936

Co-authored-by: digitarald <8599+digitarald@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot April 24, 2026 04:45
Copilot AI changed the title [WIP] Fix empty session_files and session_refs tables in Chronicle fix: Chronicle session_files and session_refs tables always empty Apr 24, 2026
Copilot AI requested a review from digitarald April 24, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chronicle: session_files and session_refs tables are always empty locally

2 participants