feat: add Goose (aaif-goose/goose) session scanner#457
Open
fruwe wants to merge 2 commits intojunhoyeo:mainfrom
Open
feat: add Goose (aaif-goose/goose) session scanner#457fruwe wants to merge 2 commits intojunhoyeo:mainfrom
fruwe wants to merge 2 commits intojunhoyeo:mainfrom
Conversation
Parses token usage from Goose's SQLite sessions database at ~/.local/share/goose/sessions/sessions.db, with fallback support for the legacy Block/goose path and override.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
5 issues found across 11 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/tokscale-core/src/sessions/goose.rs">
<violation number="1" location="crates/tokscale-core/src/sessions/goose.rs:98">
P1: Token counters are read as `i32` from SQLite, which can overflow and cause row decode failures that silently drop sessions.</violation>
<violation number="2" location="crates/tokscale-core/src/sessions/goose.rs:147">
P2: `created_at` parsing is too narrow (RFC3339-only) and silently falls back to `0`, which can mis-bucket valid sessions into epoch/1970 when Goose stores SQLite TIMESTAMP values.</violation>
</file>
<file name="crates/tokscale-cli/src/commands/wrapped.rs">
<violation number="1" location="crates/tokscale-cli/src/commands/wrapped.rs:1372">
P2: Goose was added to client display-name mapping but not to `client_logo_url`, so Goose entries won’t get a logo in wrapped top-client rendering.</violation>
</file>
<file name="crates/tokscale-core/src/scanner.rs">
<violation number="1" location="crates/tokscale-core/src/scanner.rs:805">
P2: GOOSE_PATH_ROOT is not validated for empty/whitespace values, allowing accidental relative-path DB discovery from the current working directory.</violation>
<violation number="2" location="crates/tokscale-core/src/scanner.rs:815">
P2: Goose DB discovery uses `exists()` instead of `is_file()`, so non-regular paths can be accepted as SQLite DBs and cause avoidable downstream open/parse failures.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…rsing, is_file validation, logo URL
Author
|
Pushed a follow-up commit addressing all 5 review items (d1ab5e5):
All 977 tests pass (347 + 83 + 544 + 3). |
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
sessions.db, extracting model name frommodel_config_json, provider fromprovider_name, and accumulated token counts per session.Data Location
The scanner checks multiple paths in order:
$GOOSE_PATH_ROOT/data/sessions/sessions.db(env var override)~/.local/share/goose/sessions/sessions.db(aaif-goose fork, primary)~/Library/Application Support/goose/sessions/sessions.db(macOS)~/Library/Application Support/Block/goose/sessions/sessions.db(legacy Block/goose macOS)~/.local/share/Block/goose/sessions/sessions.db(legacy Block/goose Linux)Files Changed
crates/tokscale-core/src/clients.rs—Goose = 18entry indefine_clients!macrocrates/tokscale-core/src/sessions/goose.rs— New SQLite parsercrates/tokscale-core/src/sessions/mod.rs—pub mod goosecrates/tokscale-core/src/scanner.rs— DB discovery with multi-path fallbackcrates/tokscale-core/src/lib.rs— Parser wiring in both parse pathscrates/tokscale-cli/src/main.rs—--gooseCLI flagcrates/tokscale-cli/src/tui/client_ui.rs— TUI entry with hotkeyocrates/tokscale-cli/src/tui/ui/widgets.rs— Goose colorcrates/tokscale-cli/src/tui/data/mod.rs— Client count updatecrates/tokscale-cli/src/commands/wrapped.rs— Display name mappingCloses #456
Summary by cubic
Adds a Goose session scanner to track token usage from Goose’s SQLite
sessions.db, with multi-path discovery and pricing. Adds CLI and TUI support for filtering and viewing Goose sessions; closes #456.New Features
model_config_json, provider fromprovider_name, and accumulated input/output/total tokens per session; infers reasoning tokens when present.$GOOSE_PATH_ROOT/data/sessions/sessions.db,~/.local/share/goose/sessions/sessions.db,~/Library/Application Support/goose/sessions/sessions.db, plus legacy Block paths.tokscale-coreparsing and pricing; updates client registry and counts.--goosefilter intokscale-cli, TUI entry with hotkeyo, display name mapping, color, and logo URL.Bug Fixes
is_fileto avoid false positives.Written for commit d1ab5e5. Summary will update on new commits.