Commit graph

275 commits

Author SHA1 Message Date
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
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
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
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
Aditya Vikram Singh
18b3f6f948 fix(desktop): keep settings navigation from shrinking 2026-09-09 21:37:25 +05:30
Resham Joshi
159198be6c
Merge pull request #1271 from avs-io/codex/project-identity-session-counts
Some checks failed
CI / semgrep (push) Waiting to run
Tests / test (22) (push) Waiting to run
Tests / test (22.13.0) (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
macOS Menubar CI / test (push) Has been cancelled
Windows Menubar CI / check (ubuntu-latest) (push) Has been cancelled
Windows Menubar CI / check (windows-latest) (push) Has been cancelled
fix(usage): preserve project identity and qualify session counts
2026-09-08 09:27:57 +03:00
Aditya Vikram Singh
a8cfce0c9f
Merge pull request #1169 from ksp2000/feature/standardize-model-capability-tiers
feat: standardize model capability tiers
2026-09-08 10:07:27 +05:30
iamtoruk
df38e63849 fix(usage): fold Windows case in spend identity, qualify --json counts, drop scratch tests 2026-09-07 14:56:32 -07:00
Aditya Vikram Singh
0a7a281482 test(electron): stop chatty watchdog smoke racing Node boot
Independent default app npmtest killed the chatty optimize child at 614ms
because the 600ms idle timer started at spawn and the first progress byte
waited on Node boot plus setInterval. Emit the first stderr byte immediately
after boot, then ten 400ms ticks (result ticks 11) under a 2s silence budget.
Node boot still counts; the larger smoke window absorbs it. Work still
outlives a fixed total-runtime cap. Production already resets on every byte;
timeout constants unchanged.
2026-09-07 22:06:09 +05:30
Aditya Vikram Singh
f5fd47e83d fix(usage): preserve project identity and qualify incomplete session counts 2026-09-07 22:02:54 +05:30
iamtoruk
a0e0b9f866 chore: release 0.9.24 2026-09-04 02:05:03 -07:00
iamtoruk
02c3ab21dd chore: keep real people and machines out of a public repository
An audit of everything on main since v0.9.23 turned up five places where
real detail had been used where an invented value would have done. None of
them is a credential and none identifies a customer, but a public
repository is the wrong home for any of it.

perf/README.md cited an absolute path into a private audit workspace on a
contributor's own machine, naming their home directory, the workspace's
naming scheme and a run timestamp accurate to the second, as "evidence" no
reader can open. The number stays; the path goes, and the text now says
plainly that the artifact is not published. The same file described the
measurement corpus as the founder's 35 GB of session history, which is a
personal fact about one identifiable person, so it is now described by what
it is rather than by whose it is.

The remaining three are fixtures: a private product name as a working
directory, the maintainer's real operating-system username inside the very
tests that assert such a path is redacted, and their two machine names in
the sharing tests. Using the real values proved nothing the invented ones do
not, and the redaction tests read better when the string being scrubbed is
obviously synthetic.
2026-09-03 12:38:11 -07:00
iamtoruk
5f09d9735f fix(windows): make the cross-process lock test poll, not spin, so it passes on Windows
The rename retry landed, but its test kept the watcher reading in a
tight loop, and on real Windows that lost 8 runs in 12: a reader holding
the file open every instant is a race no bounded retry can win, because
an open handle blocks a rename until it closes. That is not a reader
either app has. The watcher now polls at 1ms, which still samples the
file thousands of times and still catches a lost update, while leaving
the writers room to rename. The locked path passes 15 of 15 on Windows,
and the unlocked path still reports a rolled-back write.

Also restores the lineage case the review asked for: a refresh where the
account id and refresh token are unchanged and only the id_token subject
moves, so the subject comparison is what discards the write. Both copies.
2026-09-03 11:28:01 -07:00
iamtoruk
96bf1984ff fix(windows): wait out a reader when replacing a preference file
The Windows CI leg failed on the cross-process test with EPERM from
renameSync. It is not a test artifact. Windows refuses a rename over a
file another process holds open rather than waiting, with
ERROR_ACCESS_DENIED or ERROR_SHARING_VIOLATION, and reads of these two
files are deliberately lock-free on both sides. So any tray or app read
that overlaps a writer's replace fails that write, and since this branch
made writers report a failure instead of swallowing it, the outcome is
exactly the lost update the lock exists to prevent, reached by another
route. The test's reader thread only made it visible by reading the way
both apps really do, continuously and without the lock.

The replace is now retried on that error class, ten attempts about 20ms
apart, on both sides: replace_file in settings.rs, used by settings patch
and by the dock's write_state_at, and renameOnto behind writeFileAtomic
in tray-settings.ts. The lock is already held at that point, so the wait
can only ever be on a reader, never on another writer, and a read of one
of these files is microseconds of open file. Once the budget is out the
original error is returned unchanged and the caller cleans up as before.
On POSIX, where a rename over an open file cannot fail this way, it
compiles out in Rust and short-circuits on process.platform in Node.

Reads stay lock-free, which is the right trade and the reason the files
can be read at all without coordination; both read paths now say what it
costs and where that cost is absorbed. The reader thread stays as it is,
and is now the regression test for the retry as well: it is what puts a
replace under a continuous reader.

The retry itself is covered on the Node side by faking the platform and
the rename, since a rename that fails this way cannot be produced on a
Mac: a reader waited out and the write landing, the budget running out
with the old file still whole, and an error a reader cannot cause not
being waited out at all. The Rust half is compiled out off Windows, so
CI is its only proof.
2026-09-03 11:10:33 -07:00
iamtoruk
a1b4b22f51 fix(windows): close three holes in the cross-process preference lock
writeDockEnabled still did its own read, mutate and atomic write of
windows-dock.json, outside the lock the rest of the module takes. It is
the Node side of the dock's enabled switch, reached from the desktop
app's Sidebar toggle, so a toggle there could still land between the
tray app's read and its rename and erase whatever it had just stored,
which in practice is the rail's placement. It now merges through
patchTrayFile, which takes the lock for the whole cycle; enabled is
already an accepted dock key, so nothing is dropped on the way.

Stale-lock recovery could hand out two owners at once. Both sides did
"if abandoned, unlink and retry", and nothing stood between the check
and the unlink: contender A could already have removed the stale lock
and created a fresh one of its own, and B's unlink then deleted A's
fresh lock, leaving both of them holding the file. Windows' share mode
hides this most of the time, because a lock a live holder still has open
will not unlink at all, but the same protocol runs on Linux and macOS,
where the unlink always succeeds. Removing an abandoned lock is now
itself arbitrated, by the same exclusive create the lock uses, on a
sibling <lock>.takeover file. Only its winner may unlink, and only after
re-checking staleness under that right, so a rival that reclaimed first
keeps the lock it now holds. A takeover file is dropped on every path
out, never held across the wait, and one left behind by a reclaimer that
died is freed by the same staleness rule as the lock itself.

The cross-process test asserted only each side's final value, so it
noticed a lost update only when the last writes happened to collide: on
a deliberately broken lock it passed about one run in three, which is
weak evidence for the property it exists to prove. Each side now writes
a counter that only rises, and a reader thread watches the file for the
whole run. A separate reader is the point: neither writer can see its
own counter rolled back, because in the unlocked cycle each carries the
other side's value forward itself, so what it reads back is never older
than what it last read. With the lock both counters only ever rise in
the file; without it one falls. It now fails on every unlocked run.

Also: a placement that cannot be saved is logged instead of discarded
silently, since losing the lock under contention is a new way for the
rail to revert at the next launch; and the Codex sameLogin comment now
states outright that a replacement document carrying none of the three
identifying fields reads as the same login and is written over, which is
the deliberate side to err on.
2026-09-03 10:28:05 -07:00
iamtoruk
615c94241b fix(windows): serialize tray and dock preference writes across processes
The desktop app and the tray app both read, merge and rename the same
preference files. The atomic rename stopped a torn file but not a lost
update: both read state A, each changed a different field, and the last
rename erased the other's change, so dock placement, enabled state,
provider choice or scale silently reverted.

One cross-process lock now covers the whole read-modify-write cycle,
designed once and implemented in both Rust and Node against the same
protocol: a sibling .lock file taken by exclusive create, carrying the
holder's pid and timestamp, taken over only when abandoned by a dead pid
or a stale mtime, and failing loudly rather than writing behind a live
holder. It follows the CLI's existing cache-refresh lock. All three
sites use it, including the dock's enabled, provider and placement
writes. A test drives real Node and Rust processes at the same file and
fails without the lock.
2026-09-03 07:59:42 -07:00
iamtoruk
7533e96fe3 fix(quota): discard a Codex refresh whose login changed under it
The refresh reread auth.json before writing the rotated tokens but only
checked it was still ChatGPT mode, not that it was still the same login.
A `codex login` account switch, or a second CodeBurn process refreshing
the same credential, landing while our refresh was in flight let the late
response splice one account's tokens into another's document: a new
account id over an old refresh token, or an older refresh token over a
newer one. Either signs the user out or binds them to the wrong account.

The login the grant belongs to is now captured before the grant and
compared against the reread document on account id, refresh token and
id-token subject. A demonstrated mismatch discards the write and says so.
An unreadable or key-sparse file is not a mismatch and still writes, so a
rotated token is never dropped. Both the CLI and the Electron copy.
2026-09-03 07:59:42 -07:00
iamtoruk
378062ebc2 Merge remote-tracking branch 'origin/main' into feat/windows-capacity-dock 2026-09-03 05:16:32 -07:00
iamtoruk
972e3b8a3d docs: stop three telemetry disclosures contradicting themselves
The onboarding screen, the privacy settings and the README each said the
daily report includes the names of the models, tools, skills and MCP
servers in use, and then in the next breath that it never includes
anything identifying. A server named after an employer is identifying,
so the second half was not true. All three now use the wording the tray
notice already had, which names what is withheld rather than claiming
more than the product does: never your prompts, your code, or your
project and file names.
2026-09-03 04:52:31 -07:00
iamtoruk
9640cdd9c7 fix(app): remember a pending restart across a desktop app restart
The reboot-pending flag lived in memory with a comment claiming the
restart it waits for also clears it. Quitting the desktop app and
opening it again cleared it too, and that is not the restart being
waited for, so the next launch started the old tray binary under the new
version's name, which is the confusion the flag exists to prevent.

It is saved as a timestamp now and read back by comparing it against
when Windows last booted, so only a real restart clears it. The test
that asserted the old behaviour crossed the boundary by restarting the
app; it now moves the boot time, and a second test covers restarting the
app without restarting Windows.
2026-09-03 04:52:31 -07:00
iamtoruk
ff2ba5c94a fix(app): typed IPC patches, the staged-msi flag, and honest consent copy
- Tray preference patches from the window were used with `in` before
  any type check; every patch handler now refuses anything that is not
  a plain object.
- The tray install passes `--staged-msi <path>` to the CLI instead of
  an environment variable.
- A timeout or a missing CLI no longer counts as a declined install,
  so it is retried at the next launch; only a cancelled prompt is
  remembered. After msiexec reports a pending restart the old binary is
  not launched, and the sidebar says a restart finishes the install.
- The telemetry opt-in event fired before the toggle was applied and
  could never be sent; it fires after a successful write.
- The ARM64 installer carries the x64-named tray, since the CLI accepts
  only that asset name; the distribution notes say so plainly.
- The README, the onboarding screen and the privacy settings say that
  the daily report includes the names of the models, tools, skills and
  MCP servers in use, and the renderer's fallback builder reports zero
  turns as zero.
2026-09-03 03:06:13 -07:00
iamtoruk
2b06a3a5e4 feat(app): send the CLI's telemetry snapshot and a few interaction events
The daily usage_snapshot event now carries the payload's
telemetrySnapshot verbatim, with the old renderer builder kept as the
fallback for an older CLI. Five name-only events join it: optimize_apply
with the fix kind, plan_set with the provider, export with the format,
compare_view with the two models, and settings_change with the setting
and its enum or boolean value.

The props sanitizer had allowed one level of arrays of flat objects and
would have stripped the snapshot's nested model and task rows; it walks
plain objects recursively now, five levels deep at most and a thousand
leaves per event, leaves still short strings, finite numbers and
booleans only. The README gains a Telemetry section listing every event
and field and how to turn it off.
2026-09-03 01:18:23 -07:00
iamtoruk
058bd57808 build(app): an ARM64 Windows installer that actually contains the program
7-Zip compresses ARM64 executables with its ARM64 branch filter by
default. The decoder inside the NSIS installer predates that filter, so
extraction dropped every .exe and .dll while the data files landed, and
the installer exited zero with no program in the directory. A new
package:win:arm64 script pins the BCJ filter through the electron-builder
override, and the distribution notes say why.
2026-09-03 00:01:35 -07:00
iamtoruk
7d4c86bc82 fix(app): seed launch at login again after reinstalling the tray
The Run value was seeded once per machine. Uninstalling the desktop app
removes the tray and, with it, the Run value; reinstalling put the tray
back but the seeded flag survived in the companion settings, so launch
at login was silently off afterwards. A tray app the current launch has
just installed now seeds the value as a first run does.
2026-09-03 00:01:34 -07:00
iamtoruk
f03a3133e2 build(app): allow a slow Electron start in the CLI staging smoke test 2026-09-03 00:01:34 -07:00
iamtoruk
9eafaefbfa fix(app): the desktop uninstaller really removes the tray it installed
Two faults in the uninstall hook, found by running it for the first time:

- NSIS has no doubled-quote escape, so the '' written for PowerShell's
  single quotes ended the NSIS string at the first one. The plugin got a
  truncated command PowerShell could not parse, and the hook silently
  did nothing: uninstalling the desktop app left the tray, its Run value
  and its marker behind. Each inner quote is now the NSIS escape.
- An upgrade runs the previous version's uninstaller first, with the
  updated flag, and the hook removed the tray there too, so every desktop
  upgrade uninstalled the tray and reinstalled it with an elevation
  prompt. The hook now leaves the tray alone during an upgrade.
2026-09-03 00:01:34 -07:00
iamtoruk
7e0d1eca6e docs: the Microsoft Store is the Windows install, GitHub builds are a preview
The Store package is signed at submission and updates itself. The tray
.msi under windows-v* and the desktop setup exe are a developer preview:
unsigned, SmartScreen warns on first run, and they do not update
themselves; the tray app reports a newer version and links to it. Said
in the README, the distribution notes, the tray development notes and
the release body.
2026-09-02 23:09:36 -07:00
iamtoruk
d9020a66e8 test(app): let the CLI launcher suite pass off Windows
companionDataDir only honoured LOCALAPPDATA when it began with a drive
letter, so the POSIX sandbox path the test hands it fell through to the
home fallback on Linux and macOS. It now takes any absolute path in the
Windows sense, which a drive path and a rooted path both are. The
launcher expectations join with the host separator instead of spelling
out backslashes, so the same assertions hold on every runner.
2026-09-02 22:20:51 -07:00
iamtoruk
902253e18b chore(app): tidy a comment in the Codex quota reader 2026-09-02 22:11:49 -07:00
iamtoruk
5b15718058 fix(app): the tray companion works with only the desktop app installed
- The tray resolves codeburn from PATH and the npm locations and never
  saw the CLI the desktop app bundles, so a machine with only the
  desktop app had a tray with nothing to run. The desktop app now writes
  a launcher that runs its bundled CLI through its own executable,
  records the path in the tray settings, and the tray's resolver takes
  it after PATH and before giving up; a global codeburn still wins. The
  first launch also gets CODEBURN_BIN in its environment.
- Four IPC handlers for tray preferences and launch at login had no
  platform check and would have touched Windows files or reg.exe on a
  Mac; they return neutral values off Windows.
- The install probe ran on every launch and a declined UAC prompt came
  back at the next one. A declined or failed staged version is recorded
  and not retried until the version changes or the user flips the
  switch, and a matching installed version skips the probe.
- Launch at login in the Store build is managed by Windows through the
  package's startup task; the switch said otherwise and did nothing.
  That build now says so and opens the Startup Apps page.
- Settings files the tray reads were truncated and rewritten in place;
  they are written to a temp file and renamed over.
- DISTRIBUTION.md records that the installer's staged tray and the
  windows-v* release asset at the same version are separate builds.
2026-09-02 22:10:37 -07:00
iamtoruk
22218b12ea fix(app): keep the sidebar links on macOS and Linux
The tray switches took the sidebar corner on Windows and the social
links moved to About, but the switches render nothing off Windows, so
Mac and Linux users lost the row and gained nothing. The links are back
there on every platform but Windows.
2026-09-02 22:10:37 -07:00
iamtoruk
e01a15a515 fix(app): actually kill the CLI process tree on Windows
taskkill only ran for children spawned through the .cmd shim, and the
shipped desktop build runs the bundled CLI through Electron's node, so
it never ran at all and provider subprocesses were orphaned on every
stop. On the shim route it was also fire-and-forget followed by killing
the top of the tree, which reparents the children before taskkill can
find them. Every Windows child now goes through taskkill /T /F from
System32 and the handle is only ended if taskkill fails.
2026-09-02 22:10:37 -07:00
iamtoruk
ae1b2d797c fix(app): persist a rotated Codex refresh token in the desktop quota reader
The desktop app's Codex quota reader is a copy of the CLI's and carried
the same fault: two await points between parsing the token grant and
writing auth.json, a rotated refresh token dropped when the grant had no
access token or the file could not be re-read, a silent failed write,
and the caller's abort passed into the grant request. Ported the CLI
fix so the two files match apart from import specifiers.
2026-09-02 22:10:37 -07:00
iamtoruk
1fdd8eb43c fix(app): stage the MSI a local Tauri build actually writes
Tauri names the bundle after productName, so `tauri build` leaves
`CodeBurn Menubar_<version>_x64_en-US.msi` with a space. GitHub rewrites
that space to a dot on release upload, which is the form the CLI
installer, the Electron side and the tray updater all match. The staging
script only knew the dot form, so the installer workflow built the tray
and then failed with "no CodeBurn.Menubar_<version>_x64_en-US.msi".

It now accepts both and stages the dot form, so a local build and a
downloaded release produce the same shape.
2026-09-02 14:40:41 -07:00
Resham Joshi
3376d764e6
Merge pull request #1234 from avs-io/codex/provider-core-contract-repair
Repair provider usage and Hermes cost contracts
2026-09-02 11:50:56 -07:00
iamtoruk
3b60b724fe fix(models): group Trend rows and the models command by the same display name (#1239) 2026-09-02 10:40:39 -07:00
iamtoruk
9e2f140c91 fix(windows): a second launch no longer hangs the tray app or its callers
The single-instance plugin hands a second launch over with a synchronous
SendMessage, so that launch sits inside it until the running app's callback
returns. When the message landed while the first launch was still in setup,
the callback showed the dock from inside a nested message pump, waited on an
event loop that was not running yet, and never returned; every launch after
it, the desktop app's --quit included, blocked behind the same message and
piled up as processes with no windows.

The callback now only records the request and carries it out from the event
loop. The desktop companion also waits, briefly, for a quit it has just sent
to finish before starting the tray app again, because a launch that arrives
while the old process is still going hands its request to that process and
exits with it.
2026-09-02 10:01:57 -07:00
iamtoruk
9c432bb105 fix(menubar,app): absent hasUsage hid every provider with no period spend
hasUsage is a new payload field, so every RELEASED CLI omits it. Both decoders
treated the absent case as "derive from cost", which is the strict reading of
a field that is not there: a provider with $0 spend in the period vanished
from the picker even though the user has it and is actively using it on an
included subscription.

Absent now means visible on both surfaces. The strict signal still applies
wherever the CLI actually emits the field, so an explicit false still hides an
idle discovery row. Settings.tsx carried the same fallback and is fixed with
it.
2026-09-02 07:32:02 -07:00
iamtoruk
35f3c14977 feat(app): Plugins says what it is doing on Windows
The plugin runtime has not shipped for Windows, so `codeburn plugin list` never
answers there and the section sat on "Loading plugins..." for as long as the app
was open. A spinner that will never stop is worse than a sentence.

Windows now gets a panel instead: the section's own glyph, one line saying
plugins are coming, and one saying they arrive in a later Windows release and
work today elsewhere. It loads nothing, and the check happens in a dispatcher
above the loader rather than inside it, so the loader's hooks never mount and
there is no CLI call, no spinner and no timer to unwind. Every other platform
renders exactly what it did.
2026-09-02 07:03:23 -07:00
iamtoruk
4113ae30e0 fix(quota): Antigravity looks for its language server the Windows way
The desktop app's stderr on the VM carried "Antigravity quota unavailable:
Command failed: ps -ax -o pid=,command=" with "ps: unknown option -- x" on every
quota poll. Windows has no ps, and asking for one is a spawn failure rather than
an answer, so the provider reported a transient failure with a warning behind it
instead of simply not being there.

Win32_Process is the same listing by another name, and it is already how
src/providers/antigravity.ts finds these servers, so the quota adapter asks the
same way: PowerShell by absolute System32 path, argv only, no shell string, and
the Where-Object is a prefilter rather than the decision, which classifyProcessLine
still makes. There is no lsof either, so a pid's listening ports come from
netstat -ano; its state column is localized, so it is not matched on, and a row
that turns out not to be listening only costs one refused probe.

The guard this replaces was `win32 && !deps.execFile`, which the desktop app
defeated by injecting execFile, and which its own copy of the adapter never had
at all. Both copies now carry the same code, and the platform is injected so
either branch can be tested from either OS.
2026-09-02 07:00:22 -07:00
iamtoruk
94a5fcd0ab feat(app): Menu bar and Capacity Dock panes in Settings
The tray app has a settings window of its own, and nobody should have to find it
to change how the thing in their notification area behaves. Two panes join the
Settings rail: Menu bar and Capacity Dock.

Only the settings the desktop app does not already have are there. Currency, the
period, the scope and the daily budget are shared through the CLI config and
already live in General, and repeating them would be two controls for one value.
So Menu bar carries the tray figure's metric and period, the accent, whether
today's figure gets its own tray icon, the two refresh cadences, the terminal and
launch at login; Capacity Dock carries show, resting provider, size, appearance,
gauge shape and the per-provider switches.

Each pane appears only while its switch in the sidebar corner is on: there is
nothing to configure about a tray app that is not running, and the rail is one of
its windows. A pane whose switch has just gone off cannot stay on screen either,
so the rail falls back to General.

Two things the rail's own rules are worth restating here. The last connected
provider cannot be switched off, because the rail must never have nothing to
show. And a provider stays in the list after its connection drops, so one that
has stopped working can still be taken off.

Every control renders what came back rather than what it sent: the main process
is what decides the value that lands, and it repairs one it would not be able to
read later.
2026-09-02 06:28:24 -07:00