fix: expand Chronicle session_files/refs tracking to match VS Code tool names#312285
Merged
digitarald merged 3 commits intomainfrom Apr 24, 2026
Merged
fix: expand Chronicle session_files/refs tracking to match VS Code tool names#312285digitarald merged 3 commits intomainfrom
digitarald merged 3 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Expands Chronicle’s session history extraction so session_files/session_refs are populated for VS Code-hosted Copilot sessions by recognizing VS Code tool names and GitHub MCP tool prefixes.
Changes:
- Expand file-tracking tool-name coverage to include VS Code’s model-facing tool names and add
apply_patchinput parsing. - Update GitHub MCP tool detection to accept both
mcp_github_(VS Code) andgithub-mcp-server-(CLI) prefixes. - Add new focused unit tests for file/ref/repo extraction behavior.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/chronicle/common/sessionStoreTracking.ts | Adds broader tool-name recognition and patch parsing for file/ref tracking. |
| extensions/copilot/src/extension/chronicle/common/test/sessionStoreTracking.spec.ts | New unit tests for file path extraction, GitHub MCP tool detection, repo/ref extraction, and terminal ref extraction. |
| extensions/copilot/src/extension/chronicle/common/test/standupPrompt.spec.ts | Updates existing expectations to reflect read_file now being tracked for file paths. |
Copilot's findings
Comments suppressed due to low confidence (2)
extensions/copilot/src/extension/chronicle/common/sessionStoreTracking.ts:52
multi_replace_string_in_filecan apply replacements across multiple files (per tool schema). Returning only the first replacement’sfilePathwill under-report affected files insession_files. Consider extracting all uniquefilePaths fromargs.replacementsand recording onesession_filesrow per path (likely by adjusting the tracker to accept multiple paths).
// multi_replace_string_in_file stores filePath in each replacement item
if (toolName === 'multi_replace_string_in_file' && Array.isArray(args.replacements)) {
const first = args.replacements[0];
if (typeof first === 'object' && first !== null) {
const fp = (first as Record<string, unknown>).filePath;
if (typeof fp === 'string') { return fp; }
}
}
extensions/copilot/src/extension/chronicle/common/sessionStoreTracking.ts:68
apply_patchsupports patching multiple files in a single input (multiple*** Update/Add/Delete File:sections). Extracting only the first match meanssession_fileswill miss additional touched files. Consider extracting all file paths from the patch input and recording each one (deduping if needed).
// apply_patch encodes file paths in the patch input text
if (toolName === 'apply_patch' && typeof args.input === 'string') {
return extractFirstFileFromPatch(args.input);
}
return undefined;
}
/**
* Extract the first file path from an apply_patch input string.
* Matches lines like `*** Update File: /path/to/file` or `*** Add File: /path`.
*/
function extractFirstFileFromPatch(input: string): string | undefined {
const match = input.match(/^\*\*\*\s+(?:Update|Add|Delete)\s+File:\s*(.+)$/m);
return match?.[1]?.trim();
- Files reviewed: 3/3 changed files
- Comments generated: 1
vijayupadya
approved these changes
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.
Problem
The
session_filesandsession_refstables in the Chronicle local session history store are always empty (0 rows across 460+ sessions).Root cause:
FILE_TRACKING_TOOLSonly recognized CLI-agent tool names (str_replace_editor,create) but VS Code emits model-facing names (replace_string_in_file,insert_edit_into_file, etc). Similarly,isGitHubMcpTool()only matched thegithub-mcp-server-prefix, not VS Code'smcp_github_prefix.Fix
FILE_TRACKING_TOOLSfrom 4 to 11 entries matching VS Code'sToolNameenummulti_replace_string_in_file(nestedreplacementsarray)apply_patchinput text parsing (*** Update/Add/Delete File:lines)isGitHubMcpTool()to match bothmcp_github_andgithub-mcp-server-prefixesFixes #312281