Commit graph

2166 commits

Author SHA1 Message Date
torukmakto
989d953a78 Scope the drill-through fetch by the Projects filter and fix dead drill entries
Rebasing onto main put the new getSessionsContributions handler beside the
Projects-pane filter from #1307 without picking it up, so the drill-through
would have listed unfiltered sessions under a filtered headline.

- main.ts: add projectArgs() to the new handler, matching getSessions; the
  existing filter test now asserts the new channel too.
- usage-aggregator/day-aggregator: actually set categories[].rawCategory.
  menubar-json already declared and forwarded it, but no producer wrote it,
  so topActivities[].rawCategory was always undefined and the category
  drill entry was permanently disabled in both aggregation paths.
- Models.tsx: key the model drill off modelDisplayName. Contribution
  segments are keyed by canonical short name ("Fable 5"); the row's raw
  provider ids ("claude-fable-5") matched 0 of 19 segment keys on real data.
2026-09-12 12:39:37 -07:00
ozymandiashh
756af7fcdf Fix drill-through provider, day and model attribution 2026-09-12 12:22:19 -07:00
ozymandiashh
d1dcc82ee5 Wire drill-through into the desktop app: entries, chips, contributions, drawer, history
Every report grows real entries: Overview day bars, expensive sessions
(provider+id matched), model names, task categories, Spend projects,
and PR cards. The Sessions destination renders the selection chips with
per-chip removal and Clear, fetches the contributions report once per
population (widened to cover the selected days so a day outside the top-bar
period still reconciles), computes every chip combination client-side over
the full population, and shows each row's contribution beside its full
cost. Row clicks open the side drawer (Escape closes, focus returns); the
top bar gains Back/Forward (Cmd+[ / Cmd+] on macOS, Alt+arrows elsewhere)
over the in-app history; the position survives a renderer restart. IPC
gains getSessionsContributions with the same argv validation as the plain
report.
2026-09-12 12:22:19 -07:00
ozymandiashh
f2491d17b2 Add the drill-through investigation state, selection math, and session drawer
InvestigationFilters is a normalized, serializable selection (days,
providers, projects, models, categories, PRs, project-scoped branches,
provider-scoped sessions) with OR within a dimension and AND across them.
Contribution math walks each row's segments and multiplies per-dimension
shares, so sums reconcile every dimension's aggregate exactly; rows without
segments are excluded and disclosed. NavState + the history stack back the
in-app Back/Forward (filters, sort, page depth, open drawer) and the
restart snapshot. The drawer shows metadata, full totals beside the
in-selection figures, and the per-model/category/branch/day/PR breakdowns
with an Escape-and-focus-return contract.
2026-09-12 12:22:19 -07:00
ozymandiashh
e7ce0ce5ac Add per-session contribution segments and drill-through identities to the CLI reports
sessions --format json --contributions attaches turn-granular segments
(day, task category, carried git branch, short-model costs, active PR set)
that partition each session, so a selection can sum its exact share (20 of
a session's 100) while aggregate totals reconcile. Legacy prLinks-only
transcripts carry the whole set with the approx even-split marker, matching
the by-PR report. The menubar payload's topSessions and project
sessionDetails now carry provider + sessionId (+ raw projectKey for
topSessions) so the desktop can open the exact session behind a row, and
topActivities carries the raw TaskCategory for chips. serve learns the
--contributions flag so the desktop's resident child can answer it.
2026-09-12 12:22:19 -07:00
Resham Joshi
4a316dacac
Merge pull request #1313 from getagentseal/fix/copilot-host-rungs
fix(menubar): follow the credential's GitHub host on every quota rung
2026-09-12 22:16:22 +03:00
iamtoruk
20bde26507 fix(copilot): keep the new host rungs to the menubar
Issue #1306 is about the macOS menubar's rungs. The CLI adapter gaining the
environment and gh rungs is a behaviour change it did not ask for: a shell with
GITHUB_TOKEN exported, or a gh login without Copilot, would start reporting a
fetch failure where `codeburn quota` reported "disconnected".

src/quota/copilot.ts and its suites go back to main untouched, including the
hostname character check the endpoint helpers already had. CHANGELOG and docs
drop the CLI claims.
2026-09-12 12:05:04 -07:00
ozymandiashh
fc36450d7f fix(quota): mirror the host-carrying Copilot rungs in the CLI
The CLI adapter read only the editor-plugin files, so `codeburn quota` and the
Windows Capacity Dock — which has no Settings screen to fall back on — could
not see an enterprise credential that lives anywhere else. It now walks the
same rung order as the menubar for the sources a CLI can reach: the plugin
files, then COPILOT_GITHUB_TOKEN / GH_TOKEN / GITHUB_TOKEN paired with
GH_HOST, then gh's own hosts.yml.

The gh rung reads the oauth_token out of that file rather than spawning gh, so
the token and the host come from one entry and a keyring-backed login simply
has no token there and falls through. The pasted-token rung stays macOS-only:
it lives in that app's Keychain item, which has no CLI equivalent.

Note the behaviour change this implies: a shell that exports GITHUB_TOKEN, or
a gh login with no Copilot entitlement, now reports a Copilot fetch failure
where it previously reported "disconnected". That is the same answer the
menubar has always given for those credentials.

The existing suites pin env and ghConfigPaths explicitly so a developer's own
GH_TOKEN or gh login can never change what they read.

Closes #1306
2026-09-12 12:02:26 -07:00
ozymandiashh
53cd44daf2 fix(menubar): give the pasted Copilot token a GitHub host of its own
The last rung of the chain is a token the user pastes into Settings, and an
enterprise personal access token pasted there was still sent to
api.github.com. Settings now takes the host beside the token, defaulting to
github.com, and saves both in the same provider Keychain record so the host a
request is addressed to always comes from the entry that carried the token.

A host no endpoint can be derived from is refused at the field instead of
being stored and reported later as a terminal fetch failure, and the crafted
values #1286 guarded against are refused there too. Clearing the token clears
the host with it, so a stale tenant can never be paired with the next token.

The record's decoding moves into an extension and reads every key with
decodeIfPresent: Swift's synthesized init(from:) ignores a property's default
and throws on a missing key, so adding a field would otherwise make every
credential saved before it unreadable — for every provider, not just Copilot.

The dormant connection row no longer promises api.github.com before anything
has been fetched; it names a host only once one has answered.

Tests cover the three new host sources with a hostile value each, the rung
wiring for all five rungs, the gh hosts.yml key scan, and that a record
written before the host field still decodes.
2026-09-12 12:02:13 -07:00
ozymandiashh
1b4c00f8d5 fix(menubar): follow GH_HOST and gh's own host for the Copilot env and gh rungs
#1286 taught the credential files to carry the GitHub host their token came
from, but the environment and `gh auth token` rungs carried none, so they were
always addressed to api.github.com. A user whose only Copilot credential is a
GitHub Enterprise Cloud login — GH_TOKEN exported alongside GH_HOST, or
`gh auth login --hostname <tenant>.ghe.com` — got a 401 and a terminal failure
with nothing to act on.

The environment rung now reads GH_HOST out of the same environment as the
token. The gh rung resolves the host from gh's own hosts.yml, found via
GH_CONFIG_DIR, then XDG_CONFIG_HOME/gh, then ~/.config/gh, and picked the way
gh picks the host for `gh auth token`: GH_HOST, else the single configured
host, else dotcom. That is a file read rather than a second `gh auth status`
spawn, because gh writes hosts.yml for every login, keyring-backed ones
included.

Both are new untrusted inputs, so they stay raw all the way to
`apiHost(for:)`, where #1286's character validation refuses a crafted value
such as `evil.com?.ghe.com` before any URL exists — that host passes the
`.ghe.com` suffix check but builds a URL whose host is api.evil.com, which
would then receive the Authorization header.
2026-09-12 12:02:13 -07:00
Resham Joshi
f1d6ee012d
Merge pull request #1311 from ozymandiashh/fix/1310-second-row
Some checks are pending
CI / semgrep (push) Waiting to run
macOS Menubar CI / test (push) Waiting to run
Tests / test (22) (push) Waiting to run
Tests / test (22.13.0) (push) Waiting to run
Tests / test (24) (push) Waiting to run
Tests / test (26) (push) Waiting to run
Tests / test-platforms (macos-latest) (push) Waiting to run
Tests / test-platforms (windows-latest) (push) Waiting to run
Tests / desktop (push) Waiting to run
fix(menubar): pick the second row's provider by its worst quota window
2026-09-12 22:00:39 +03:00
ozymandiashh
a0d08c81f0 fix(menubar): pick the second row's provider by its worst quota window
The "quota remaining" row selected each provider's headline window, which
is a billing horizon: weekly, else monthly, and only then the busiest
window. That is the right number for the Capacity Dock rail and the wrong
one for a row whose whole job is to name the provider nearest its limit.
On a real machine it discarded Cursor's API window at 100% and Claude's
5-hour window at 18% in favour of Monthly 9.5% and Weekly 5%, so the row
read as if nothing were near a limit — while the flame beside it was
tinting off the worst window across every provider. The comment claiming
the row followed the flame was wrong on both counts.

Each provider now contributes its worst window, per-model rows included,
which is exactly the rule aggregateQuotaStatus tints by, so the row and
the flame agree and README, CHANGELOG and the Settings help become true
as written. A provider in transientFailure keeps its last-known window
instead of dropping out, matching the dock, which shows the same data
dimmed during a backoff: the row no longer vanishes and resizes the
status item for the length of a retry.

Three smaller fixes from the same review: the row is capped at 24
characters — about the widest the single row gets at 13pt, since the
second line renders at 9pt — shortening a long provider name rather than
letting "GitHub Copilot 12% left · 6d 3h" more than double the item's
width; the two-line title gets a VoiceOver label that reads as one phrase
instead of a string with a newline in it; and the snapshot feeding the
row is no longer built on refreshes where the feature is off. With the
setting off the title is byte-for-byte the single-row composition it has
always been.

Closes #1310
2026-09-12 20:29:35 +03:00
Resham Joshi
b0e53cfc0e
Merge pull request #1309 from getagentseal/feat/dock-window-switch
feat(menubar): switch the Capacity Dock gauge between usage windows
2026-09-12 16:45:59 +03:00
Resham Joshi
aad1ca3b01
Merge pull request #1308 from getagentseal/feat/menubar-second-row
feat(menubar): optional second row in the macOS menu bar item
2026-09-12 16:45:52 +03:00
ozymandiashh
5b5dc5aceb feat(menubar): switch the Capacity Dock gauge between usage windows
The resting rail shows one number per provider, and that number was always
the weekly (else monthly) billing window. A user watching Claude's 5-hour
limit had to expand the dock and read the glance card every time, which
defeats the point of an always-visible usage monitor.

Clicking the provider that already rests in the rail now switches its gauge
to the provider's short rolling window and back. The preference is stored per
provider rather than as a Claude-only switch: the dock's collapsed row is
provider-agnostic, and Codex publishes a 5-hour and a weekly window too, so
the question is "which horizon for this provider", stored under
CodeBurnCapacityDockGlanceWindows alongside the other dock preferences.

The two horizons are named rather than labelled, so the policy works for any
adapter: billing reuses QuotaSummary.headlineWindow, the app's single
definition of the weekly/monthly glance, and burst matches the short rolling
rows the adapters emit (5-hour, Hourly, Daily, session) while excluding
anything weekly or monthly, so Claude's per-model "Weekly · Opus" row can
never be read as a short window. CapacityDockGlanceWindow keeps that policy
pure and testable, including the fallbacks: a provider with one window shows
it whichever horizon is stored, and a stored horizon the provider stops
reporting resolves to the one it does report instead of blanking the gauge.

The click cannot fight the hover expansion: this branch only ever pins, never
collapses, and it is reached only when the provider actually has two windows,
so a single-window provider keeps the existing click-to-pin toggle. Escape
and an outside click still unpin. Keyboard and VoiceOver users get the same
switch as a named accessibility action on the provider cell, and the cell's
accessibility value now names the window feeding the ring. The rail's
geometry is untouched.

Closes #1243
2026-09-12 06:38:34 -07:00
ozymandiashh
a08dfec842 fix(menubar): make the two-row height a fit contract, not an exact figure
CI's swift test on macos-latest measured the two-row title at 21pt where this
machine measures 20pt, so the exact-equality assertion failed 16 times. The
figure is release-dependent: SF Symbol metrics and line rounding move between
macOS versions. Nothing positions the rows off it — AppKit's button cell
centres whatever it measures inside the status item — so 21pt is centred just
as correctly as 20pt, and the requirement was always "fits a 22pt menu bar",
not "measures exactly 20pt". The test now asserts that band, and
twoRowMeasuredHeight is replaced by twoRowMaximumHeight (the bar) and
twoRowMinimumHeight (a floor, so a lost paragraph clamp or a dropped second
line is still caught rather than passing as "fits").

The 1pt delta does expose a real risk the constant was hiding: the first line's
height follows the flame image, and the image size for a point size is the
system's business. A release that renders it taller could push the title past
the bar. The two-row attachment box is now computed by
twoRowAttachmentBounds(imageSize:), which scales the image down to the clamped
line height — never up — so the first line cannot outgrow its clamp. Verified
by composing the real title with the flame forced to 11, 13, 16 and 24pt tall:
every combination still lays out at 20pt here. The single-row path keeps the
raw image size and its -3pt offset, so it stays byte-identical.
2026-09-12 06:37:46 -07:00
ozymandiashh
016b8edaef feat(menubar): optional second row in the macOS menu bar item
The menu bar item could show one figure, so seeing subscription quota and
today's local usage at the same time meant opening the popover. This adds an
optional second line, off by default, configured from the existing
Settings > General > Display section: a "Second row" toggle plus a picker for
what it shows. All four metrics are figures the app already computes for the
popover, so nothing here adds a fetch or a refresh cadence: quota remaining
with its reset countdown for whichever connected provider is nearest its limit
(the same provider the flame already tints for), today's all-provider cost,
today's total tokens, or running sessions.

The rows are one attributed title. A paragraph style clamps text line height
but not an attachment, so the inline flame at the text's own point size dragged
the title to 24pt and AppKit clipped the second line away; the flame is
requested at 8pt and seated back inside the line, which puts every row
combination at exactly 20pt inside the standard 22pt menu bar, centred with 1pt
of slack above and below. Measured with NSAttributedString.boundingRect and
asserted in the tests, since those four numbers only work together.

With the setting off, or whenever the chosen metric has no data yet (no
connected provider with a quota window, no today payload, a CLI that predates
the liveSessions block), the title falls back to the previous single-row
composition unchanged: same font, same attributes, no paragraph style. The row
formatting is a pure type over the row settings and a plain-value payload
snapshot, so it is covered without an AppStore or a status item.

This is a deliberately reduced slice of the request. Not included: the layout
editor, presets, live preview, a third row, multiple items or aligned columns
per row, per-item provider/period/scope, optional labels, decimal precision,
reordering and text size. Keeping the formatter pure leaves room for those
later without touching the rendering path.

Closes #1252
2026-09-12 06:37:46 -07:00
Resham Joshi
ef86348673
Merge pull request #1305 from getagentseal/fix/copilot-host-followups
fix(menubar): follow the credential's GitHub host for Copilot quota
2026-09-12 16:26:13 +03:00
Resham Joshi
ce59a3af32
Merge pull request #1307 from getagentseal/fix/projects-pane-followups
feat(app): Projects pane that scopes the desktop app to chosen projects
2026-09-12 16:21:34 +03:00
iamtoruk
0225088984 fix(quota): reject a Copilot host carrying a URL delimiter
The `.ghe.com` suffix check ran on a normalized string that still allowed
`?`, `#`, `\` and spaces, and that string was interpolated straight into
the request URL. `evil.com?.ghe.com` in a hosts.json key passes the
suffix check but builds a URL whose host is `api.evil.com`, so the
Authorization header lands on a host that was never approved. Verified
on macOS: URL(string:) parses it as host `api.evil.com`, path `/`.

Both readers now require the normalized host to look like a DNS name
before an endpoint is derived; anything else fails as an unsupported
host, with no request sent.
2026-09-12 06:14:26 -07:00
iamtoruk
4b9659bd78 fix(app): drop the instant-switch memo when the filter changes outside the app
reportMemoKey is section|period|provider|range|variant|boundary, with no
filter component, so an entry memoised before the filter changed is a valid
key for the other scope. A filter that appeared while the window was away
therefore repainted the unfiltered snapshot until the next fetch landed.

Clear the memo on the change only, where the re-read already compares the
observed flag against the persisted codeburn.projectFiltered: clearing on
every poll would throw the memo away wholesale for nothing.
2026-09-12 06:01:23 -07:00
iamtoruk
a3f2b0b112 feat(app): search and cost order for the Projects pane
The pane rendered one switch per detected project in whatever order the
report returned them: 2,762 rows on this machine, with nothing to type into
and the costliest buried at an arbitrary depth. Sort by lifetime cost
descending and narrow on a case-insensitive substring of the name or path,
with a "12 of 2,762" count beside the box once it narrows.

A substring pass over a few thousand rows is nothing, so no virtualisation.
The switches and the hide-a-pattern field are untouched, and the hidden
count still reads off the whole list, not the visible slice.
2026-09-12 06:01:23 -07:00
ozymandiashh
c872818eed test(quota): resolve the Copilot GHE fixture name with path.basename
The fake credential reader keyed its files by splitting the path on "/",
but the adapter builds the path with path.join, which uses a backslash on
Windows: every lookup missed there, so the credential read as absent and
the six adapter-level cases saw no request and a "disconnected" quota.
path.basename is separator-correct on both platforms. Test-only; the
reader itself is unchanged and the existing Windows path test still
covers the real directories.
2026-09-12 05:56:05 -07:00
ozymandiashh
8b5bd3ed4c fix(menubar): follow the credential's GitHub host for Copilot quota
Both Copilot quota readers hardcoded
https://api.github.com/copilot_internal/user and dropped the host their
credential was read from, so an enterprise on a GitHub Enterprise Cloud
data-residency host (<tenant>.ghe.com) could only ever report
"Temporarily unavailable": its token is not a dotcom token, and dotcom is
not an endpoint it may be sent to.

A discovered credential now carries its host. hosts.json is keyed by
GitHub host and newer apps.json files key by "<host>:<app id>", so the
token and the host always come from the same entry; the rungs that carry
no host of their own (an app-name apps.json key, COPILOT_GITHUB_TOKEN /
GH_TOKEN / GITHUB_TOKEN, gh auth token, a pasted token) mean dotcom. The
endpoint follows the host: api.github.com for github.com, and
api.<tenant>.ghe.com for an Enterprise Cloud host. With several hosts
signed in github.com wins, otherwise the first .ghe.com tenant in sorted
order, which keeps the pick stable across reads; with exactly one, that
host is used.

A host neither rule can address, such as a self-hosted GitHub Enterprise
Server install, fails with a message naming that host instead of falling
back to dotcom, and network and HTTP failures name the host that was
tried. macOS Settings now says which host answered in the Copilot
connection row. Tokens are still never logged and sanitizeForUI is
unchanged.

Closes #1286
2026-09-12 05:56:05 -07:00
iamtoruk
6d45db1e08 fix(app): re-read the project filter when it changes outside the window
The main process re-reads app-filter.json whenever the file changes, which
is what makes a hand edit land. The renderer only re-read it on its own
config mutations, so a filter that appeared any other way left
`projectFiltered` false: Settings kept offering Combined, the hero kept
saying "Combined · …", and buildOverviewArgs had already dropped
`--scope combined` because the filter was non-empty. The reading on screen
was a local, project-filtered total labelled as the combined one.

Re-read on a manual refresh and on every overview poll as well. It costs
one statSync the main process already memoizes by stat stamp.
2026-09-12 05:50:41 -07:00
iamtoruk
caae3df5cf fix(usage-aggregator): slice the 365-day history by the project filter
The headline is sliced to the requested projects (buildDurablePeriod runs
every historical cache day through sliceDayToProject) and today's days come
from the name-filtered parse, but `history.daily` was read straight out of
the day cache. Every surface built on it showed every project: the heatmap,
the streak, "N active days", month-to-date, the projected month, the daily
spend chart, the Spend punchcard and the daily-budget check.

On this machine, `status --format menubar-json --project=<one project>`
returned a $7.43 headline over a $2,993.61 month-to-date, and 137 of the
138 days in history.daily were byte-identical to the unfiltered run.

Same slice the headline already uses, so a cache day with no project split
contributes nothing here rather than everything, exactly as it does there.
2026-09-12 05:50:40 -07:00
Mathieu Stanowski
435a5c8d95 test(app): move the project-match parity test to the CLI suite
The desktop CI job runs `npm ci` inside app/ only, so an app-side test
that imports src/parser.ts cannot resolve the CLI's own dependencies: the
typecheck failed on chalk and strip-ansi before the suite even ran. A
local run hides it, because the repo root's node_modules sits one
directory up and resolves fine from there.

The test needs both halves by definition, so it moves to the suite that
has both, and projectMatch.ts names its new home. Nothing under app/
reaches into src/ any more: `tsc --listFiles` on the desktop project now
resolves no file outside app/.
2026-09-12 05:38:52 -07:00
Mathieu Stanowski
af10747e5d perf(app): serve the JSON report from the resident child
The Projects pane's list is `report --format json`, the heaviest read in
the app, and report was in neither routing table: not in SERVE_ROUTED on
the client, not in SERVE_OPTIONS on the server. Every open of the pane
paid a fresh node boot plus the full session-cache parse the resident
child exists to avoid, at interactive priority, holding one of the two
run slots for its whole duration and stalling the panels polling behind
it.

report is servable in its JSON form only: on every other format it is the
interactive dashboard, which cannot run in a child whose stdout is the
wire. allowed() refuses those and the client falls back to a one-shot
spawn, which is where a dashboard belongs. --refresh only paces that
dashboard, so it stays off the served surface.
2026-09-12 05:38:52 -07:00
Mathieu Stanowski
946fb75696 fix(app): stop reporting an export that wrote nothing as a success
codeburn export prints "No usage data found." and exits 0 when every
period came back empty, writing no file and no folder. That path was
unreachable from the app until the export started carrying the project
filter; an exclude list covering every detected project now empties all
three periods of the export window. runAction read the exit code, so the
Export pane toasted "Exported to <folder>" for a folder the CLI never
created.

Success reads the saved-path line the CLI prints only after a write, and
a run that wrote nothing comes back as a failed action whose message
names both causes. A CLI test pins both halves of that contract, since
the app cannot import from src/.
2026-09-12 05:38:52 -07:00
Mathieu Stanowski
f76ee91526 fix(app): list projects for the whole history, not the visible period
getUnfilteredProjects passed the period on screen, and the CLI builds
that list from the days the period covers. A project filter has no
period: it scopes every screen and every horizon at once. So an exclude
pattern for a project with no activity in the current period rendered as
"matches nothing detected" next to a Remove button, while the footer read
"Nothing is hidden." Clicking Remove there unhid the project on every
screen, from a control that had just called the pattern dead.

The list is lifetime now, and the period argument is gone from the
channel rather than left for a caller to get wrong. `all` is capped at
six months, so lifetime is the only horizon that can answer for the whole
filter.

The pane's memo key goes through reportMemoKey like every other pane, and
the fetch is off the poll interval: it is the heaviest read in the app, a
toggle cannot change an unfiltered list, and the only thing that can is a
project appearing, which the next open picks up.
2026-09-12 05:38:52 -07:00
Mathieu Stanowski
1e34d36144 fix(app): fail closed when the project filter cannot be read
The Projects pane commit claimed that a failed read keeps the last known
filter instead of unhiding. That only held once a filter had already been
read in this process: appFilterCache is module level, so it is null on
the FIRST read of every launch, and both failure paths fell back to the
empty filter there. statSync also rejects EACCES and EIO exactly the way
it rejects ENOENT, so an unreadable file and a missing one produced the
same answer.

A malformed or unreadable app-filter.json therefore made projectArgs()
return [], and every CLI fetch ran unfiltered: the hidden projects
painted, getProjectFilter reported an empty filter so the renderer
cleared its filtered state and re-offered Combined scope, and nothing
surfaced an error.

Only ENOENT means "no filter" now. Every other errno, and a parse failure
with nothing cached, throws. The handlers already wrap argv construction,
so a fetch fails closed into the panel's error state rather than
rendering a wider set of projects than the user asked for.

Writes are staged through a randomized temp file and renamed, the rule
saveConfig already follows in src/config.ts for the same directory: a
writeFileSync straight over the live path can be interrupted, and a
truncated filter is an unreadable filter.
2026-09-12 05:38:52 -07:00
Mathieu Stanowski
1b006ed2f7 fix(app): expand a leading ~ in a project pattern typed into the pane
A pattern typed into the Projects pane never passes through a shell, so
"~/work/app" reached the CLI as a literal tilde and matched nothing. It
is expanded in the main process now, on the way into app-filter.json and
on the way back out: the renderer has no home directory of its own, and a
tilde it cannot resolve would make its switches disagree with the argv
this process writes.

The file can also be hand-edited, so the expansion runs on read as well
as on write. projectMatch.test.ts covers the expanded shapes against the
CLI's matchesProjectPattern, which is what keeps the switch and the argv
on the same answer.
2026-09-12 05:38:52 -07:00
Mathieu Stanowski
6cac9d929c feat(app): add a Projects pane that scopes the desktop app to chosen projects
Screen-sharing or demoing the app exposed every project on the machine,
with no way to narrow it. Settings now has a Projects pane: one switch
per detected project, plus a field for hiding a pattern that matches
nothing detected yet.

The filter lives in ~/.config/codeburn/app-filter.json rather than
renderer storage, because the main process is where the CLI argv is
assembled. No file, or empty lists, means no filter, so the default is
unchanged for everyone who never opens the pane. CODEBURN_APP_FILTER
overrides the path and an empty value disables it, which is what the app
test suite sets so a real filter file cannot reach the assertions.

Details worth knowing:

- The pane's own project list is fetched WITHOUT the filter. Scoping it
  would hide the projects the checklist exists to switch back on.
- Patterns are passed as --project=<value>, never as two argv entries. A
  Claude project directory is encoded as "-Users-me-Web-thing", and a
  leading dash in its own argv slot parses as a flag.
- Combined scope and a project filter cannot both hold. The CLI rejects
  --scope combined next to --project/--exclude because paired devices
  report their usage unfiltered, and dropping the filter instead would
  put the hidden projects back inside the combined total, which is the
  one thing the pane exists to prevent. So the filter wins: Settings
  offers Local only while something is hidden (and says why), the
  renderer derives its effective scope from the filter so even the first
  poll of a filtered session is local, and buildOverviewArgs keeps the
  same rule as a guard for a stale caller.
- A read that fails on an existing file keeps the last known filter
  instead of falling back to the empty one. Unhiding every project on a
  torn write or a typo mid-edit is the one failure mode this pane cannot
  have. Only a missing file means "show everything" again.
- The pane's matcher lives in renderer/lib/projectMatch.ts, and
  projectMatch.test.ts pins it against the CLI's matchesProjectPattern
  over every pattern shape. A switch that disagrees with the argv it
  writes would lie about what is on screen.
- Writes are serialized: every write is computed from the filter on
  screen, so a second click before the first landed would be built from
  the pre-click value and drop it.
- export carries the filter too, since it writes project names into a
  file that gets shared. getPlans stays unfiltered, like combined scope:
  a plan is billed on every project, so scoping it would misreport the
  cycle.
2026-09-12 05:38:52 -07:00
Resham Joshi
cfa0f9fa07
Merge pull request #1304 from getagentseal/fix/daily-cache-underread-reconcile
fix(daily-cache): stop a frozen under-read from outranking the sources on disk
2026-09-12 15:10:06 +03:00
iamtoruk
f284fda1f0 perf(usage-aggregator): only reconcile days a live slice can win
Every historical day was cloned into the merge on every read, whether or
not anything needed healing. Pass only the dates where some provider's
live slice explains more calls than the cached one: on a healthy cache
that is none, and a date the cache already explains is served as it was
written rather than rebuilt from a live day back to the same numbers.
2026-09-12 04:58:13 -07:00
iamtoruk
aa775656f7 fix(daily-cache): keep the reconcile from rewriting a day's carried mark
The merge seeds each result day from `primary`, the live parse, which
carries no provenance. Marking every secondary day carried flagged every
date the cache and the parse agree on as preserved from expired logs;
not marking them at all silently dropped the mark from every date both
sides hold, including days only one of whose providers still has sources.

Re-assert it only where a secondary slice brought calls the primary could
not produce. An equal-call slice claims nothing, so a day the sources
fully explain drops the mark and a day with one expired provider keeps it.
2026-09-12 04:58:13 -07:00
Rick Culpepper (claude)
8b9140aed0 fix(daily-cache): stop a frozen under-read from outranking the sources on disk (#1217)
A day is derived into the durable cache once and then frozen behind the
watermark, while isPartialSurvival lets a fresh derivation SHRINK a day
inside the settle window. One parse that missed sources therefore became
permanent: the Overview headline sat 27% below the Daily Activity rows
printed underneath it, on days whose transcripts were intact the whole
time.

The read path already parses the dates it is reporting on, so let it
reconcile: per (date, provider) keep whichever derivation explains more
calls. A cached day whose transcripts have expired still wins, since
nothing live can outbid it, and an under-read cached row stops hiding
evidence that is sitting on disk. Ties go to the cache, so a re-pricing
still lands through the write path only.

The write path is untouched: what to freeze stays its decision, and a
still-settling day is still defined by its fresh parse.

Fixes #1217
2026-09-12 04:41:23 -07:00
Resham Joshi
5783c6d0af
Merge pull request #1303 from getagentseal/fix/per-provider-cache-completeness
fix(cache): record session-cache completeness per provider
2026-09-12 14:13:00 +03:00
Resham Joshi
c036e4d082
Merge pull request #1300 from getagentseal/fix/dock-quota-refresh-guard
fix(mac): keep dock quota fresh when the payload tick is skipped
2026-09-12 14:02:27 +03:00
Resham Joshi
fe63fd0dfb
Merge pull request #1302 from getagentseal/fix/project-filter-followups
fix(cli): scope compare self-corrections to filtered projects, warn on web
2026-09-12 14:02:24 +03:00
Resham Joshi
5ecc50a5f7
Merge pull request #1301 from getagentseal/fix/dsh-doctor-skips
fix(dsh): count every dropped session toward doctor
2026-09-12 14:02:03 +03:00
iamtoruk
830f3ff6d6 fix(cache): record session-cache completeness per provider
A scan is scoped on two axes, provider and date range, but completeness
was one whole-cache boolean. #1229 stopped a scoped run from stamping it
by adding a second, unfiltered discoverAllSessions to the stamp path,
which left scoped users on a multi-provider machine permanently cold and
paid an extra full discovery on every run.

Completeness now lives on the provider section, with an optional
completeFrom floor for the sources a date range filtered out. The
whole-cache flag keeps its meaning (an unscoped scan finished) and is
what a section with no flag of its own falls back to, so existing caches
read exactly as before and no version bump is needed. Discovery reports
which providers threw, and a provider that reported nothing because it
failed is never marked complete.
2026-09-12 04:00:40 -07:00
Resham Joshi
9fe765e26c
Merge pull request #1299 from getagentseal/ci/node-matrix
Some checks are pending
CI / semgrep (push) Waiting to run
Tests / test (22) (push) Waiting to run
Tests / test (22.13.0) (push) Waiting to run
Tests / test (24) (push) Waiting to run
Tests / test (26) (push) Waiting to run
Tests / test-platforms (macos-latest) (push) Waiting to run
Tests / test-platforms (windows-latest) (push) Waiting to run
Tests / desktop (push) Waiting to run
ci: test on Node 24 and 26 as well as the 22 line
2026-09-12 13:50:34 +03:00
iamtoruk
6ee71e91c6 fix(cli): scope compare self-corrections to filtered projects, warn on web
compare --project filtered the model rows but scanned every session on the
machine for self-corrections. Scope the scan to the filtered projects'
sessions, and call reportUnmatchedProjectPatterns from web.
2026-09-12 03:49:43 -07:00
iamtoruk
556d402d18 fix(dsh): count every dropped session toward doctor
Sessions skipped for an unreadable header, a filename/header generation
mismatch, an ambiguous generation filename, or missing zstd support now
call onSkippedVersion, so doctor reports ERRORS instead of OK while
dropping sessions.

Missing zstd support is explained once from discovery rather than
producing one unreadable-header line per compressed log. Path-naming
notices dedup on the message kind and print at most three example paths,
instead of one unbounded line per file. The filename generation now
matches v(\d+): session.v0 is the unversioned generation, session.v03 is
generation 3, and a duplicate-encoded or non-safe generation is skipped
and counted rather than silently invisible.
2026-09-12 03:48:52 -07:00
iamtoruk
8b3cb68255 fix(mac): keep dock quota fresh when the payload tick is skipped
The background tick skips the whole refresh when local session files are
unchanged, but quota is server-side state, so the dock rings went stale
until the popover was opened. Run the quota half on skipped ticks, still
throttled by the subscription cadence.

Also refresh the dock providers before the Claude/Codex awaits so a slow
provider cannot delay them, anchor lastCodexRefreshAt on attempt like its
siblings, and query display sleep live instead of latching a flag that a
missed wake notification leaves stuck.
2026-09-12 03:47:46 -07:00
iamtoruk
615b6c75a0 ci: test on Node 24 and 26 as well as the 22 line 2026-09-12 03:43:24 -07:00
Resham Joshi
7d0083961d
Merge pull request #1298 from getagentseal/fix/project-filter-test-stderr
test(cli): stop asserting empty stderr in the project-filter command tests
2026-09-12 13:37:45 +03:00
iamtoruk
32c81c6f79 test(cli): stop asserting empty stderr, Node 24+ prints a deprecation warning 2026-09-12 03:30:29 -07:00
iamtoruk
a1805393de chore: require owner review via CODEOWNERS 2026-09-11 21:45:55 -07:00