fix: Chronicle session_files and session_refs tables always empty#312299
Draft
fix: Chronicle session_files and session_refs tables always empty#312299
Conversation
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
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
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.
Three independent bugs caused
session_filesandsession_refsto never receive any rows despite the tracking code existing.Root causes
Wrong OTel attribute name —
_extractToolArgsread fromgen_ai.tool.input/gen_ai.tool.input.*, neither of which exists on VS Code tool spans.toolsService.tsstores arguments asgen_ai.tool.call.arguments(GenAiAttr.TOOL_CALL_ARGUMENTS), a JSON string. This made everyextractFilePath/extractRefsFromMcpToolcall 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 shapes —
apply_patchembeds file paths inside the patch text (*** Add/Update/Delete File: <path>), not in afilePathfield;multi_replace_string_in_filenestsfilePathinside areplacementsarray. Neither was handled byextractFilePath.Changes
sessionStoreTracker.ts— rewrite_extractToolArgsto parsespan.attributes[GenAiAttr.TOOL_CALL_ARGUMENTS]sessionStoreTracking.ts:FILE_TRACKING_TOOLSwith the three missing VS Code tool names (CLI names retained for compat)extractFilePathbranches forapply_patch(regex over patch text) andmulti_replace_string_in_file(first entry ofreplacementsarray); uses existinggetStringFieldhelperstandupPrompt.spec.ts— replace the previously incorrectapply_patchtest (which passed a synthetic{ filePath }that never occurs at runtime) with tests covering all actual argument shapes