Commit graph

1166 commits

Author SHA1 Message Date
ozymandiashh
6b903a7777 fix(parser): stop --provider filters from re-surfacing cached claude sessions
Claude is scanned via scanProjectDirs instead of parseProviderSources, and
that call had no provider-filter guard. On a --provider <other> run
discoverAllSessions correctly returns no claude sources, so claudeDirs is
empty, but scanProjectDirs still ran: its orphan pass reads the whole cached
claude section and treats every file as no-longer-discovered, re-injecting
PR-bearing entries (and in read-only mode every cached entry) into the result.

The headline stayed correct because it comes from the provider-sliced daily
cache, so only the live-parse panels were wrong. By Model then listed
Anthropic models under --provider cursor while the total showed cursor alone.

Guard the scan with claudeInScope, mirroring the guard the durable-orphan
loop already applies. Deliberately not a claudeDirs.length check: when claude
is in scope but every transcript has been pruned, the orphan pass is what
keeps PR-attributed spend from vanishing.
2026-08-02 19:45:16 +03:00
Resham Joshi
2de4d100bf
Merge pull request #864 from GodCC6/fix/project-filter-durable-headline
Some checks failed
CI / semgrep (push) Has been cancelled
fix: --project/--exclude are ignored by the durable headline totals
2026-08-01 16:19:03 -07:00
AgentSeal
3432a07bec Merge branch 'main' into fix/project-filter-durable-headline 2026-08-02 01:18:13 +02:00
AgentSeal
a769b5008a fix(daily-cache): keep prototype-named project keys; make filter tests date-deterministic
Two issues on top of the --project/--exclude durable-headline fix:

- sanitizeProjects dropped any project whose key is an Object.prototype member
  name (constructor, valueOf, __proto__, ...). A project key is a directory
  basename, so such a name is legitimate, and dropping it left the day's
  per-project split summing to less than the day cost — so the sliced,
  project-filtered headline silently lost that project's spend with no footnote.
  The keys are written via setOwn (defineProperty), so keeping them is
  pollution-safe; only the redundant `name in Object.prototype` guard is removed.
  Regression test added (mutation-checked: fails without the guard removed).

- The new project-filter tests seeded a carried day 10 days ago but ranged over
  the calendar month, so within the first 10 days of a month that day fell out
  of range and the tests went red. Replaced with a fixed 20-day window that
  always spans the seeded day.
2026-08-02 01:16:35 +02:00
Resham Joshi
b94d0ac67c
Merge pull request #853 from KENSHI601/fix/turn-range-per-call-filter
fix(parser): range-filter calls inside turns instead of dropping day-spanning turns
2026-08-01 15:37:24 -07:00
AgentSeal
6c411ad96d Merge branch 'main' into fix/turn-range-per-call-filter 2026-08-02 00:36:34 +02:00
AgentSeal
5a12dccc70 fix(parser): classify range-sliced turns from the whole turn on the provider path
The Codex/OTel/network provider path classified a date-sliced turn from only
its in-range calls (cachedTurnToClassified(slicedTurn)), while the Claude path
kept the full-turn classification. So a midnight-straddling turn was
categorized and edit-counted differently by provider — a Read at 23:59 plus an
Edit at 00:05, sliced to the 23:59 side, read as coding/hasEdits on Claude but
exploration/no-edit on Codex. This contradicted the documented intent that
category/hasEdits/retries are whole-exchange judgments, not per-call sums.

Classify the full turn, then trim its calls to the range (mirroring the Claude
path's classifiedTurnSlicedToRange). Cost/calls still come from the retained
calls, so conservation is unchanged; only the turn-level judgments are now
provider-independent.
2026-08-02 00:35:30 +02:00
Resham Joshi
39441de8b2
Merge pull request #856 from avs-io/fix/daily-cache-degraded-completeness
daily-cache: never finalize history against a degraded session parse
2026-08-01 14:10:17 -07:00
AgentSeal
1579eb0899 Merge branch 'main' into fix/daily-cache-degraded-completeness 2026-08-01 23:09:27 +02:00
AgentSeal
90dffcddc2 fix(daily-cache): trust a stamped watermark so an idle tail is not re-derived every launch
The watermark pull-back could not tell a legitimately-finalized idle tail
(recent days had no activity, so they are absent from the cache) from the
corrupt cache it heals (a degraded parse finalized past days it never read).
Both look like lastComputedDate > newest populated day, so an idle user
re-parsed the tail on every launch, escalating to a full re-derive under
sustained lock contention where before it did nothing.

A degraded parse can no longer set complete, so the corrupt state can only
come from pre-fix code. Stamp watermarkTrusted whenever a COMPLETE parse
finalizes, and pull the watermark back only for unstamped caches. Pre-fix
caches heal once, then are trusted; caches the fixed code writes are trusted
from the first finalize. The heal still recovers genuinely missing days.
2026-08-01 23:07:22 +02:00
Resham Joshi
fee91be92b
Merge pull request #833 from rbstp/chatgpt-enterprise-support
feat(codex): show the credit limit on credit-metered ChatGPT workspaces
2026-08-01 13:38:00 -07:00
AgentSeal
53ecb3635c Merge branch 'main' into chatgpt-enterprise-support 2026-08-01 22:35:02 +02:00
AgentSeal
75a02854fd fix(codex): align credit/dollar footer formatting across desktop and menubar
The desktop dollar-balance footer used toFixed, which drops thousands
separators, while the new menubar footer groups via a currency
NumberFormatter, so the two clients showed $12500.00 vs $12,500.00 for
the same balance. The menubar credit footer also rounded half-even while
the desktop uses Math.round (half-up), disagreeing on exact-half values.

Render the desktop dollar path through the en_US currency locale, and pin
the menubar footer formatter to half-up. Adds a grouping assertion (TS)
and an exact-half rounding test (Swift).
2026-08-01 22:32:53 +02:00
Resham Joshi
807b1f422f
Merge pull request #855 from avs-io/fix/refresh-lock-malformed-recovery
Some checks are pending
CI / semgrep (push) Waiting to run
cache: recover a corrupt session-refresh lock instead of freezing ingestion
2026-08-01 13:05:39 -07:00
iamtoruk
e7576e7fa5 Trim recipient banner to badge bounds
Some checks are pending
CI / semgrep (push) Waiting to run
2026-07-31 17:23:32 -07:00
iamtoruk
fd1e02319c Replace recipient badge with Codex + Claude banner 2026-07-31 17:20:08 -07:00
chengchuan.zhou
4bfcc020f6 fix(aggregator): apply --project/--exclude to the durable headline
The durable headline unions the carry-forward daily cache with today's
live parse. Cached days were sliced to the requested provider
(sliceDayToProvider) but never to the requested project, so a
--project/--exclude query counted every historical day WHOLE while the
detail panels — By Project / By Activity / By Model, all built from the
name-filtered live parse — left the filtered projects out. The Overview
total and the panels below it could not be reconciled; on a real
one-week corpus the headline ran $2,428.85 over the By Project sum,
which is exactly the excluded projects' spend.

Add sliceDayToProject, the project-level counterpart of
sliceDayToProvider, and apply it to the cache-sourced days. Cost, calls,
sessions and savings come out of the per-project day stats the cache has
carried since v15, so they stay exact and still include days whose
session files have expired. Provider slices carry their own project
split, so --provider on top of a project filter stays consistent.

Fields the cache has no per-project split for are handled explicitly
rather than reported as the filtered projects' own:

- tokens/models/categories come from the (project-filtered) live parse
  when a project filter is active, which is exact for every surviving
  session and matches the panels that read the same parse;
- days, or provider slices, carried from before v15 have no project
  split at all and cannot be attributed, so they contribute nothing and
  their cost is returned as unattributedCostUSD and footnoted by the
  terminal overview instead of being folded into a filtered total.
2026-07-31 19:32:02 +08:00
KENSHI601
7591e68851 fix(parser): make day-spanning turn slices conservation-correct
Extends the per-call range filter so multi-day periods stop losing
usage (review on #857):

- Re-anchor a sliced turn's timestamp to its first surviving call in
  parseProviderSources, so every turn slicer shares one split rule.
- scanProjectDirs (Claude Code path): slice per call instead of
  dropping the whole turn on its first assistant timestamp; category/
  subCategory/retries/hasEdits stay classified from the full turn.
- aggregateProjectsIntoDays: bucket cost/calls/tokens (and the model,
  project, provider-slice rollups built from them) under each call's
  own day; turn-level stats (categories, editTurns, oneShotTurns) stay
  turn-anchored. This is the conservation fix: cache (<= yesterday) +
  live (today) unions now sum to the whole range for straddling turns.
- buildJsonReport's dailyMap fallback follows the same per-call rule
  so the no-durable path can't diverge from durable.days.
- filterProjectsByDateRange (dashboard) and filterProjectsByDays
  (menubar/history) slice per call instead of dropping whole turns.

Adds the straddling-turn buildDurablePeriod case to the durable-totals
parity suite (day-N + day-N+1 == whole-range calls/cost/tokens,
verified to fail without the fix), covers the today view and the
surface filters, and makes the suite hermetic on machines with real
provider data.
2026-07-31 00:37:20 +08:00
Aditya Vikram Singh
d5144593f3 fix(cache): recover a corrupt session-refresh lock instead of freezing ingestion
observe() classified a stable unparseable session-refresh.lock body as the
terminal 'unavailable'. parseAllSessions routes that to a read-only parse, so a
zero-byte or truncated lock froze warm-cache ingestion permanently across every
later run while each command still exited successfully.

A corrupt body is now a recoverable observation carrying a real mtime, and is
recovered only through the UNMODIFIED staleness gate — tryTakeover and the age
check are byte-identical to main. sameObservation gains an explicit null/non-null
boundary and a sha1 of the raw bytes, because two corrupt bodies have no tokens
to compare and mtime granularity is coarse on some filesystems.

The heartbeat deliberately does NOT rewrite a body it cannot prove is its own.
An owner that cannot prove ownership ends its ownership: mtime stops advancing,
the publication fence refuses, and a successor recovers the lock one staleMs
later. Losing that parse is the price of never having two owners.
2026-07-30 13:06:25 +05:30
Aditya Vikram Singh
213f4cbe0e fix(daily-cache): never finalize daily history off a degraded parse
A read-only session parse (served when the cache refresh lock times out or
is unavailable) reported itself as a complete hydration, so the daily
backfill published `complete: true` and advanced `lastComputedDate` to
yesterday over days the parse never covered. Because gapStart is
lastComputedDate + 1, those days were never looked at again — observed as a
cache marked complete at 2026-07-28 whose newest entry was 2026-07-25.

- parser: a read-only run reports a complete hydration only when nothing
  changed under the snapshot it served (a skipped or staled file makes it
  partial).
- daily-cache: only a complete parse may advance `lastComputedDate`, on both
  the gap and the full re-derive paths.
- daily-cache: a cache whose watermark outruns its newest populated day has
  its watermark pulled back to that day, so the ordinary gap parse re-derives
  the tail instead of trusting the marker.

Days are only ever added or re-derived, never dropped; the preservation bias
is unchanged and covered by test.
2026-07-29 17:37:44 -07:00
Resham Joshi
146037bfd5
Merge pull request #805 from ihearttokyo/agent/fix-daily-history-scan
Some checks failed
CI / semgrep (push) Has been cancelled
feat(codex): add tool-excluded active Tok/s metrics
2026-07-29 17:30:04 -07:00
KENSHI601
8b83ded657 fix(parser): range-filter calls inside turns instead of dropping day-spanning turns
parseProviderSources keyed the dateRange check on a turn's first call
timestamp, so a long autonomous turn starting before midnight was
excluded from the next day's view entirely and every post-midnight
call in it was lost. Filter calls inside the turn instead and keep
the turn when any call falls in range.

Fixes #852
2026-07-29 02:08:10 +08:00
ihearttokyo
a056d22e78
Merge branch 'main' into agent/fix-daily-history-scan 2026-07-27 19:59:08 -04:00
iamtoruk
7fe432094d refactor(codex): buffer a task's calls until its timing is known
Active/tool-wait timing used to be back-patched onto calls that had
already been appended to the result list. Buffer the calls decoded since
the last task_started instead, stamp them in place on task_complete, and
append them at the next task_started or at end of stream, so a task is
only emitted once its timing is final. Single-pass and split decodes then
agree instead of depending on where a decode boundary falls.

Output is unchanged: parsing 827 real rollouts (4.2 GB, 51224 calls) with
and without this change produces byte-identical results. The buffer holds
one task's calls; the deepest observed over that corpus was 924 against a
result list of 8196.

Attribution still spans everything since the last task_started, which
matters when a mid-file session_meta re-arms the fork-replay cutoff and
swallows a task_started while its task_complete lands past the cutoff.
The added test pins that case.
2026-07-27 11:36:21 -07:00
iamtoruk
fad846622f fix(codex): restore discovery fast path, duration precedence, and dashboard width
Review fixes on top of #805.

Discovery: getCachedCodexProject short-circuits again without opening the
file. The PR read the first line of every rollout to collect session_id,
which cost +129ms on an 827-file session directory with a warm cache.
Archived duplicates are now filtered by basename, which needs no file I/O.

Timing: on oversized mcp_tool_call_end lines a `duration_ms` key inside
invocation.arguments outranked the payload-level duration, inflating tool
wait. The depth-aware payload value wins; the naive scan stays as the
fallback for task_complete.

Layout: MIN_WIDE goes back to 90 so 90-129 column terminals keep the
two-column dashboard. The By Model panel drops the Tok/s column (and its
footnote) when the panel has fewer than 61 inner columns or when no model
recorded active timing, so narrow terminals do not truncate and non-Codex
users get no dead column.
2026-07-27 11:36:07 -07:00
Richard Boisvert
3e400bffa7
feat(codex): show the credit limit on credit-metered ChatGPT workspaces
Signed-off-by: Richard Boisvert <rboisvert@devolutions.net>
2026-07-27 08:19:59 -04:00
Resham Joshi
85781999a5
Merge pull request #807 from ZacharyHu0/fix/update-failure-feedback
Some checks failed
CI / semgrep (push) Has been cancelled
fix(menubar): clarify update failure status
2026-07-26 07:12:57 -07:00
Resham Joshi
8b2c88e3cd
Merge pull request #808 from getagentseal/chore/escape-callback-page
chore(sync): HTML-escape callback page inputs
2026-07-26 07:08:43 -07:00
iamtoruk
d4f85ced71 chore(sync): HTML-escape callback page inputs 2026-07-26 07:05:44 -07:00
Resham Joshi
2c29352d80
Merge pull request #804 from Enclavet/fix-sync-setup-ux
fix(sync): setup error handling, Windows browser open, themed callback pages
2026-07-26 07:03:54 -07:00
Resham Joshi
2e2082061e
Merge pull request #803 from hyknerf/fix/802-menubar-right-click-menu
fix(mac): keep right-click status-item menu open and stable
2026-07-26 06:58:51 -07:00
Resham Joshi
264e8e1b50
Merge pull request #800 from getagentseal/fix/611-desktop-msix-sessions
fix(claude): discover Claude Desktop/Cowork sessions in Windows MSIX installs
2026-07-26 06:47:18 -07:00
Resham Joshi
32f34613ab
Merge pull request #794 from getagentseal/codex/microsoft-store-package
Desktop: add Microsoft Store package workflow
2026-07-26 06:40:54 -07:00
Resham Joshi
d2aa1e8984
Merge pull request #799 from getagentseal/fix/kimicode-visibility
kimicode: session discovery fixes + subscription quota in menubar
2026-07-26 06:37:20 -07:00
iamtoruk
494136a3e8 fix(menubar): keep showing Kimi quota when the login is idle, stamp stale data
Kimi Code tokens live ~15 min and only the CLI renews them, so the load
state sits in .terminalFailure as its dominant steady state between CLI
uses. The Plan tab and tab-strip chip flapped to a reconnect screen every
cycle even with a good last snapshot on hand.

Extract the display decision into a pure KimiQuotaPresentation helper:
terminal-with-data shows the usage bars (flagged idle) and only the
no-data case falls through to reconnect. loadedBody stamps an 'as of
<time>' caption once a snapshot is older than 10 min, in every state that
renders it. The chip's kimiQuotaSummary downgrades terminal-with-data to
.stale so the bar and popover keep the last-known rows instead of the
reconnect card. Settings' connect/disconnect pane still explains the
terminal reason.

Adds KimiQuotaPresentationTests.
2026-07-26 06:35:13 -07:00
hao
4e9c3a1dfe fix(menubar): clarify update failure status 2026-07-26 15:20:13 +08:00
ihearttokyo
a6bf81f756 feat(codex): add tool-excluded active throughput metrics 2026-07-24 22:53:43 -04:00
Andrew Lee
f54c48f350 fix(sync): setup error handling, Windows browser open, themed callback pages
- Catch errors in 'sync setup' action: AuthError/DiscoveryError (login
  timeout, port exhaustion, discovery failures) now print a clean one-line
  message and exit 1 instead of crashing Node with an unhandled rejection
  stack trace. Also guard the double rejection when all callback ports are
  in use (both 'ready' and the callback promise reject).
- Windows: open the auth URL via 'rundll32 url.dll,FileProtocolHandler'
  instead of 'cmd /c start'. cmd.exe splits its command line on '&', which
  truncated the OAuth query string at the first parameter, so the IdP
  received a bare /authorize request ('no parameters'). rundll32 receives
  the URL as a plain process argument with no shell parsing.
- Theme the OAuth callback landing pages to match the dashboard (warm
  paper background, ink text, forest-green success / terracotta failure),
  fully inline with no network or asset dependencies.

AI-Origin: human
2026-07-24 17:56:50 +00:00
Frenky Harry S. Sinaga
8e8b58626a
test(mac): lock status-item context menu policy (#802)
Extract StatusItemContextMenuPolicy (event mask, debounce, presentation
mode) and unit-test it so rightMouseUp + statusItemMenu cannot regress
to the flash/scroll-jump paths without a failing test.
2026-07-24 19:27:25 +07:00
Frenky Harry S. Sinaga
f7eafecb7f
fix(mac): keep right-click status-item menu open and stable
Present the context menu on rightMouseUp (not down) so the matching
mouse-up no longer dismisses it, and open via statusItem.menu +
performClick so AppKit tracks the menu under the status item instead of
manual popUp (which scrolled the Today row away on mouse move).

Clears statusItem.menu in menuDidClose so left-click still opens the
popover. Debounce + legacy rightMouseUp path retained for macOS <= 26.

Closes #802
2026-07-24 19:22:24 +07:00
ozymandiashh
d92b9fea43 fix(claude): discover Claude Desktop/Cowork sessions in Windows MSIX installs
The desktop sessions resolver returned a single per-platform path, so
Microsoft Store (MSIX) installs of Claude Desktop were invisible: their
data lives under %LOCALAPPDATA%\Packages\<Claude package>\LocalCache\Roaming\Claude\local-agent-mode-sessions
and a filesystem junction workaround breaks Cowork's own file access
(reported and verified in #611).

getDesktopSessionsDir() becomes getDesktopSessionsDirs(): an ordered,
deduped candidate list (override, then classic APPDATA, then MSIX packages
matching Claude_* or *.Claude_*, existence-checked, lexicographically
sorted; .config on Linux). Results are memoized per env-input tuple so the
parser's per-file classification never rescans Packages. All call sites
scan every candidate; macOS, Linux and classic Windows behavior unchanged.

Fixes #611
2026-07-24 00:30:30 +03:00
reviewer
576f47d854 menubar: add Kimi Code subscription quota tracking
Read ~/.kimi-code credentials directly and poll api.kimi.com
/coding/v1/usages for the weekly quota and rate-limit windows,
mirroring the existing Codex/Claude quota services.

- New KimiSubscriptionService with lenient decoding (string/number
  values, enum-style time units, derived used from remaining) and
  429 backoff
- Quota chip on the Kimi Code tab, Plan insight, and a Kimi tab in
  Settings with connect/disconnect
- Independent refresh cadence anchor so Kimi-only setups don't poll
  on every payload tick
- Expired tokens surface as terminal with automatic recovery once
  the CLI refreshes the credential file
- Keep insights visible for quota-capable providers on empty days
- Widen Settings so six tabs don't collapse into the overflow menu
2026-07-23 21:31:55 +02:00
reviewer
be5c0c00aa kimicode: discover desktop-runtime sessions and fix menubar visibility
- Resolve k3/k3-agent/k2d6-agent model aliases to canonical Kimi names
- Discover sessions across all Kimi Code homes (CLI + desktop runtime)
- Accept conv-*/ctitle-* session directory naming, not just session_*
- Add Kimi Code provider tab with brand color to the menubar
- Show short model names (Kimi K3, Kimi K2.6) in the menubar payload
2026-07-23 21:31:25 +02:00
Resham Joshi
2f8e5bddcd
chore(desktop): direct Windows installs to Microsoft Store (#798)
Some checks failed
CI / semgrep (push) Has been cancelled
2026-07-23 14:52:52 +02:00
reviewer
5ef385761f desktop: run npm portably during staging 2026-07-22 00:23:24 +02:00
reviewer
212f3d9991 desktop: invoke npm shim on Windows 2026-07-22 00:21:06 +02:00
reviewer
2ebfb9ec56 desktop: make CLI staging portable on Windows 2026-07-22 00:18:25 +02:00
reviewer
4c1aba1ae2 desktop: add Microsoft Store package workflow 2026-07-22 00:15:14 +02:00
Resham Joshi
6e3c57a9ff
feat(cli): add interactive sessions browser (#793)
Some checks failed
CI / semgrep (push) Has been cancelled
2026-07-21 13:03:47 +02:00
Resham Joshi
2eb4718122
sessions: correlate cross-provider work with pull requests (#792) 2026-07-21 11:50:11 +02:00