Repository navigation
fix: keep VS Code todo lists through the memory strip so Context Management names each item - #399
Open
Abhiram Shaji (abhiramshaji-cyber) wants to merge 3 commits into
Conversation
…agement names each item stripSingleSession set todoSnapshot to null on every request, so Context Management's session timeline never saw the parsed to-do lists and fell back to the tool name for every to-do event. The strip now keeps each item's id, title and status, which is all the timeline reads. CACHE_VERSION goes to 32 so sessions cached without their snapshots are parsed again. Fixes microsoft#330
github-actions
Bot
requested review from
TamasBoncz,
Aymen (aymenfurter) and
Sanjay Singh (san360)
November 26, 2026 01:49
# Conflicts: # src/core/cache.test.ts # src/core/cache.ts # src/core/parser-shared.ts
Contributor
Author
|
Hi, hope you're doing well! I merged the latest main in. The cache version is now 35, since main already uses 32 to 34, and I added a |
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.
Description
Hi, hope you're doing well! In Context Management, every VS Code todo event was named after the todo tool instead of the item, and this PR keeps the parsed todo lists so each event shows its item and progress.
Thanks Sanjay Singh (@san360) for such a clear report. Tracing the snapshot from
extractTodoSnapshotto the strip that nulls it, and pointing out that the strip's doc comment was wrong, made this one quick to follow.What this code is for
stripSingleSessionruns on every parsed session to keep memory down: it cutsmessageTextto 500 characters and emptiesresponseText. The VS Code parser calls it right after each workspace, and the parse worker calls it again throughstripSessionsForMemorybefore analysis. Context Management's session timeline (buildSessionTimelineEvents) then reads each request'stodoSnapshotto place todo markers and bands.Before this PR
A developer uses VS Code agent mode, and the agent keeps a todo list with
manage_todo_list.extractTodoSnapshotreads the lastmanage_todo_listcall and setstodoSnapshotto a list of{ id, title, status }.stripSessionsFromcallsstripSingleSession, which runsif (r.todoSnapshot) r.todoSnapshot = null.buildSessionTimelineEventsfinds notodoSnapshot, so it callsaddToolFallbackTodoEvents.manage_todo_list, counted as an addition, and never shows progress.After this PR
Same developer, same session.
stripSingleSessionkeeps the list, rebuilt with onlyid,titleandstatus.CACHE_VERSIONis now 35, so sessions cached without snapshots are parsed again.buildSessionTimelineEventsfinds the snapshot and callsaddTodoSnapshotEvents.todo-add,todo-progressandtodo-completeevents, named after the item.flowchart LR classDef box fill:#eef1ff,stroke:#4c5bd4,color:#111827 classDef bad fill:#ffd6d6,stroke:#cc0000,color:#111827,stroke-width:3px classDef good fill:#c8f0c8,stroke:#008800,color:#111827,stroke-width:3px subgraph BEFORE["BEFORE: every todo event named manage_todo_list"] direction TB B1["agent updates its todo list"] --> B2["extractTodoSnapshot keeps the list"] B2 --> B3["stripSingleSession"] B3 --> B4{"todoSnapshot set to null"} B4 -->|"no snapshot left"| B5["addToolFallbackTodoEvents uses the tool name"] B4 -->|"request had no todo list"| B6["no todo events"] end subgraph AFTER["AFTER: each event named after its item"] direction TB A1["agent updates its todo list"] --> A2["extractTodoSnapshot keeps the list"] A2 --> A3["stripSingleSession"] A3 --> A4{"THE CHANGE: keep id, title, status"} A4 -->|"snapshot kept"| A5["addTodoSnapshotEvents names each item"] A4 -->|"request had no todo list"| A6["no todo events, same as before"] end B1 ~~~ A1 class B1,B2,B3,B6 box class A1,A2,A3,A6 box class B4,B5 bad class A4,A5 good linkStyle 3 stroke:#cc0000,stroke-width:5px linkStyle 8 stroke:#008800,stroke-width:5px style BEFORE fill:#fff5f5,stroke:#cc0000,color:#111827 style AFTER fill:#f3fff3,stroke:#008800,color:#111827The four functions that call
stripSingleSession, Functions view in ArchitectThe change
stripSingleSession,r.todoSnapshot = nullbecomes a map to{ id, title, status }. Those are the only fields the timeline reads from it inbuildSessionTimelineEvents, and running the strip twice gives the same result. This is the fix.CACHE_VERSIONgoes from 34 to 35, so caches saved without snapshots are parsed again once.cache.test.tsnow expects the snapshot kept, a new case checks that extra fields on an item are dropped, and another checks that a version 34 cache is parsed again.context-mgmt-guides.test.tsstrips a session and checks that the analyzer still namesPlanandBuild, with their progress and completion. The new checks fail onmain.changelog.d/399.mdadds a Fixed entry for the new changelog flow.What changes for a user
One question: is that small memory cost OK with you, or would you rather keep a different shape, like the timeline events built at parse time? I went with the slim snapshot for now since it's the smallest change, but I'm happy to switch.
Related Issues
Fixes #330
Fixes #360 (same bug, filed later)
Akhil Gupta (@akhil9tiet), I saw you offered to take #360. Sorry if I'm stepping on that! If you already have something going, I'm very happy to close this or work on it together.
Checklist
npm run checkpasses (typecheck + lint + spellcheck + knip + tests): typecheck, lint, spellcheck, knip and lockfile-lint pass; the tests pass exceptimage-data.test.ts(2) andcanvas-entry.test.ts(1), which fail the same way onmainon my macOS machine with Node 26changelog.d/<PR number>.mdfragment