Repository navigation
[task-history] Stop rewriting the full task history into VS Code global state - #29
Merged
Merged
Conversation
* perf(webview): stop task history globalState writes Amp-Thread-ID: https://ampcode.com/threads/T-01a0aa02-b6de-7763-97b8-1650ea4b46da * fix(history): prevent deleted task fallback Amp-Thread-ID: https://ampcode.com/threads/T-01a0aac1-c3f8-7220-a896-ac2dafbf72e1 * test(history): seed authoritative store in sticky mode tests Amp-Thread-ID: https://ampcode.com/threads/T-01a0aafa-4924-751a-9a0b-dce899b72a16 * test(history): complete deleted-task regression fixture Amp-Thread-ID: https://ampcode.com/threads/T-01a0aafa-4924-751a-9a0b-dce899b72a16 * test(webview): cover file-backed history cutover * fix: remove legacy task history after successful migration Amp-Thread-ID: https://ampcode.com/threads/T-01a0be65-3651-76cf-999d-1c931f5de52a * revert: keep legacy task history blob cleanup out of this PR Reverts b92f0a365 at the maintainer's request. Clearing the pre-migration globalState "taskHistory" blob needs its own design for handling old blobs, so it will be tracked in a separate issue. This PR stays scoped to stopping new task history writes to globalState. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Port of Zoo-Code-Org/Zoo-Code#1664. Conflicts were resolved by keeping this fork's surrounding code; the src/eslint-suppressions.json hunk was dropped because that file does not exist in this fork. (cherry picked from commit 219db1da59d76c0e4bb4c59b7042f7bd415e2469) Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: edelauna <54631123+edelauna@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
What is the problem?
After every task-history change,
ClineProviderscheduled a 5-second debounced "write-through" that copied the entire history (taskHistoryStore.getAll()) intoglobalState["taskHistory"], even though per-task files have been the source of truth since the file-backed store landed. VS Code keeps all of an extension's global state in one value, so each write re-serializes the whole value, routes it through the VS Code main process, and pushes it to every open window's extension host.With 4,411 tasks that value is about 21 MB. While a task runs, each window logged
large extension state detected (extensionId: RooVeterinaryInc.roo-cline, global: true): 21241.95kbevery 2-15 seconds. In a 7-minute, per-second CPU capture, all 46 seconds in which the VS Code main-process thread was at least 50% busy fell within 2 seconds of one of these broadcasts; away from broadcasts that thread averaged 2%. Typing lagged in every VS Code window during those stalls.How does this PR solve the problem?
Ports Zoo-Code-Org/Zoo-Code#1664 (
219db1da5, cherry-picked with-x, original author preserved):getTaskHistoryItem(), which falls back to the legacyglobalStatecopy only until the file-backed store finishes initializing, so a task deleted from the store cannot be restored from the stale legacy copy.globalStateunchanged.Conflicts were context-only. This fork's surrounding fields and test mocks were kept, and the
src/eslint-suppressions.jsonhunk was dropped because that file does not exist in this fork.Out of scope, as upstream: the existing legacy
taskHistoryvalue is left in place and is now frozen. VS Code still re-sends it whenever Roo writes another global-state key (mode/profile switches, settings), so clearing it after confirming every entry has a per-task file is a possible follow-up.How did you test the PR?
cd src npx vitest run core/webview/__tests__/ClineProvider.taskHistory.spec.ts core/webview/__tests__/ClineProvider.spec.ts core/webview/__tests__/ClineProvider.sticky-mode.spec.ts core/webview/__tests__/ClineProvider.sticky-profile.spec.ts core/task-persistence npx tsc --noEmit npx eslint core/webview/ClineProvider.ts core/webview/__tests__/ClineProvider.spec.ts core/webview/__tests__/ClineProvider.sticky-mode.spec.ts core/webview/__tests__/ClineProvider.taskHistory.spec.ts --max-warnings=0.skiptests onmain.tsc --noEmitand ESLint on the changed files: clean.pnpm vsixbuilt successfully; the packageddist/extension.jsno longer contains the write-through. The VSIX was installed locally, but its effect after a window reload has not been measured yet.Agent notes
Base: 1a6a30a (simurg79/Roo-Code main). RooCodeInc/Roo-Code main has no newer commits and still contains the write-through. Zoo has not yet followed up on clearing the legacy blob.
Separate, unrelated finding:
ps-treespawnswmic.exe, which is absent on current Windows 11 builds, soExecaTerminalProcesscannot find child PIDs (spawn wmic.exe ENOENT). This PR does not change that.