fix: prevent Antigravity sessions from breaking session list#66
Merged
nigel-dev merged 3 commits intomaintokentopapp/tokentop:mainfrom Mar 8, 2026
fix/issue-65-antigravity-listtokentopapp/tokentop:fix/issue-65-antigravity-listCopy head branch name to clipboard
Merged
fix: prevent Antigravity sessions from breaking session list#66nigel-dev merged 3 commits intomaintokentopapp/tokentop:mainfrom fix/issue-65-antigravity-listtokentopapp/tokentop:fix/issue-65-antigravity-listCopy head branch name to clipboard
nigel-dev merged 3 commits intomaintokentopapp/tokentop:mainfrom
fix/issue-65-antigravity-listtokentopapp/tokentop:fix/issue-65-antigravity-listCopy head branch name to clipboard
Conversation
Raise useExitAnimation bulkThreshold from 10 to 50 so loading ~18 Antigravity sessions no longer triggers a scrollbox remount that destroys selection state. Add Gemini 3.x fallback pricing so those sessions no longer cluster at $0 and break cost-based sorting.
Both agent-antigravity and agent-gemini-cli scan ~/.gemini/tmp/, producing duplicate AgentSessionAggregate entries for the same sessionId. This caused every Antigravity session to appear twice in the session list, leading to React key collisions, broken row selection, and erratic scrolling behavior. - Deduplicate allAggregates by sessionId after combining all agent plugins, keeping the richer aggregate (more streams/requests) - Remove scrollbox key remount hack (bulkCountRef) that was destroying scroll position on bulk changes - Raise bulkThreshold from 50 to 100 to reduce false bulk triggers
Extract dedup logic from AgentSessionContext into a pure deduplicateAggregates() function in aggregator.ts for testability. Tests cover: empty input, unique sessions passthrough, exact duplicates from overlapping agents, stream-count tiebreaker, request-count tiebreaker, insertion-order stability, and mixed unique/duplicate input. Also adds basic aggregateSessionUsage tests for grouping, multi-stream splitting, and active/idle status.
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.
Summary
Fix Antigravity agent sessions causing duplicate rows, broken row selection, and erratic scrolling (down 2, back up 1) in the sessions table.
Root cause: Both
agent-antigravityandagent-gemini-cliscan the same~/.gemini/tmp/directory, producing duplicateAgentSessionAggregateentries for every session. This caused React key collisions (key={sessionId}onSessionRow), making the selector disappear and scrolling jump erratically.Closes #65. Companion changes in
agent-antigravityrepo address cache key deduplication and session metadata.Changes
AgentSessionContext.tsxafter combining results from all agent plugins — when two agents claim the same session, keep the richer aggregate (more streams, then more requests)bulkCountRef+ keyed<scrollbox>) inSessionsTable.tsxthat was destroying scroll position and selection state on bulk changesbulkThresholdfrom 10 to 100 so loading Antigravity sessions no longer triggers false bulk-change detectiongemini-3-flash-preview,gemini-3-pro-preview,gemini-3.1-pro-preview,gemini-3.1-flash-lite-preview) tofallback.tsso those sessions display real costs instead of $0Type
fix— Bug fixRelated issues
Closes #65
Testing
bun testpasses (86 tests)bun run typecheckpasses (zero errors)Verified via TUI driver captures at 120-col and 160-col widths that Antigravity sessions were appearing as exact duplicate pairs (confirmed in
repro-agent-asc.txt). Bothagent-antigravityandagent-gemini-cliparse~/.gemini/tmp/<hash>/chats/session-*.json, producing two aggregates per session. The dedup Map eliminates these duplicates before pricing and rendering.Lint: 0 errors (pre-existing warnings only).