feat(context-usage): persist usage across restarts - #616
Merged
Conversation
Codex ReviewVerdict: mergeable No actionable findings. Summary: Static inspection found no concrete merge-blocking defects in the pull request changes. |
This was referenced Aug 2, 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
Context-window usage currently lives only in the ACP runtime snapshot, so restarting Open Science removes the indicator even though the conversation Session is restored.
Proposed change
contextUsageas an optional, sanitized Session field.Scope and non-goals
No database, migration script, dependency, layout, or new user action is added. Older Session files remain valid because the field is optional.
Acceptance criteria and validation
All checks below ran after the final material edit.
npm test -- src/shared/session-persistence.test.ts src/renderer/src/lib/acp/useWorkspaceAgentRuntime.test.ts-> passed (119 tests).ComposerContextUsagecoverage within the full suite -> passed.npm run typecheckequivalent (tscagainst both project configs) -> passed.npm run lintequivalent -> passed with 0 errors and 19 pre-existing warnings.npm test -- --maxWorkers=4-> passed (670 files, 9,756 tests; 184 skipped).Review focus
Uncovered risks
The exact quit-and-relaunch Electron UI journey is not automated; persistence boundaries, hydration fallback, hidden-empty behavior, and the full unit/integration suite are covered.