Commit graph

821 commits

Author SHA1 Message Date
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
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
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
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
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
32c81c6f79 test(cli): stop asserting empty stderr, Node 24+ prints a deprecation warning 2026-09-12 03:30:29 -07:00
ozymandiashh
effa656ef2
Merge pull request #1285 from mathieustan/feat/cli-project-filter
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-platforms (macos-latest) (push) Waiting to run
Tests / test-platforms (windows-latest) (push) Waiting to run
Tests / desktop (push) Waiting to run
fix(cli): honor --project/--exclude on every reporting command, and anchor absolute-path patterns
2026-09-11 20:15:20 +03:00
Mathieu Stanowski
d8dfd72832 fix(cli): judge a pattern against the day cache, and never on screen
Three defects in the unmatched-pattern warning, all reported against a
path that is in fact correct.

`report`, `overview` and `status` judged a pattern against the live parse
plus the day cache, while `sessions`, `models`, `audit`, `compare`,
`optimize`, `yield` and `spend` judged it against the live parse alone.
On a project whose transcripts have expired, `overview --project <path>`
bills it while `sessions --project <path>` called the path wrong. The
check now falls back to the day cache, and only for what the live parse
missed, so the normal path reads no cache at all.

The warning also reached two places that must never see it. An Ink screen
owns the terminal, so it now honours the same `setInteractiveScanUI`
latch the parser checks before printing scan progress: `report --project
/typo` no longer writes over the dashboard. And `serve` routes every
stderr write into the progress-frame emitter, so `runStdioServe` calls
`suppressProjectFilterWarnings()` at startup rather than the module
reading argv, which a leading `--verbose` would have shifted.

SERVE_OPTIONS gains --project/--exclude for the seven commands that just
declared them, as the comment above it requires. Without that a filtered
request falls back to a cold spawn instead of the resident.
2026-09-11 17:29:55 +02:00
Mathieu Stanowski
740ec551e3 fix(cli): expand a leading ~ in a project pattern
A quoted '~/work/app' reaches the CLI unexpanded, and a pattern typed
into a field has no shell behind it at all. It was neither rooted nor a
substring of any stored path, so it selected nothing and said nothing.
The README made it worse by telling people to quote it.

A leading ~ is now expanded against the home directory and anchored like
any absolute path, so the quoted form selects the same project as the one
the shell would have expanded, and a wrong one is reported.

Two more from reading the hot path: the compiled filter only pays for the
project path key when some pattern is rooted and can read it, which the
day cache runs per project, per day, per provider slice; and
unmatchedRootedPatterns now calls matchesProjectPattern instead of
open-coding it.
2026-09-11 17:29:55 +02:00
Mathieu Stanowski
648fa40ebd feat(cli): warn when a rooted --project/--exclude names no project
A rooted pattern selects one project or nothing, so a typo does not
fail: it reports a total over a set nobody asked for, which reads
exactly like a correct answer. The run now says so on stderr, and the
exit status is untouched.

unmatchedRootedPatterns() tries each pattern on its own against the
UNFILTERED project list, which is what keeps it honest. Judged inside
filterProjectsByName instead, an earlier --project would mask a later
one selecting the same project, and an --exclude would be tested against
what --project had already removed. The message is period-scoped, since
a range-scoped parse is what was checked, and the durable path passes
the carried days' project identities alongside the live parse, so a
pattern naming only an expired-source project stays silent.

Nothing is reported under `serve`. That path routes process.stderr.write
into the progress-frame emitter (runCaptured), so a warning would reach
the desktop app as a scan-progress line.

The tests spawn the real CLI over a seeded corpus of two path siblings:
sessions for the commands that filter at the call site, spend and yield
for the two that take the patterns as arguments and filter inside, so
dropping the argument anywhere fails the suite. They also pin the shapes
that must stay silent: a pattern that selects something, a loose word, a
second --project overlapping the first, and an --exclude naming a
project --project had already removed.
2026-09-11 16:12:31 +02:00
Mathieu Stanowski
172b8f4df6 fix(cli): anchor an absolute-path project pattern to a segment boundary
filterProjectsByName matched every pattern as a raw substring, so
--exclude /a/my-company also removed the sibling /a/my-company-kit, and
no pattern the caller could type expressed "this project and not its
neighbours".

A rooted pattern (POSIX, Windows drive, UNC) now keys through
normalizeAbsProjectPathKey, the helper #1271 added for project identity,
and matches the way isProxiedPath matches proxyPaths: equal to the
project path, or a prefix of it on a path-segment boundary. Going
through that helper keeps one identity rule in the parser: identified
Windows paths casefold, POSIX case stays identity, and a Codex-style
stripped absolute path ("root/vault") keys the same as the pattern
"/root/vault" the user types. A pattern that is not rooted stays the
loose substring people type on the command line, so --project
my-company keeps covering my-company-kit and worktrees.

The rule lives in one closure (makeProjectFilter) applied to the live
parse and to the carry-forward day cache alike. The cache path had its
own copy, lowercasing and substring-matching, so a filtered headline
anchored today's live days while matching every cached day loosely: on a
carried day split across /Users/gone/app ($30) and /Users/gone/app-kit
($70), --exclude /Users/gone/app returned 0 instead of 70, and --exclude
/users/gone/app excluded both instead of neither. Both shapes are in
tests/project-filter-durable-totals.test.ts, the suite that exists to
pin that a filter selects the same projects whether it is resolved
against a fresh parse or against the cache.

The README gains the rules that were not written down: an absolute POSIX
path is case-sensitive while a Windows drive or UNC path folds case, and
a leading ~ is the shell's to expand.
2026-09-11 16:12:21 +02:00
xz
cd2e0dd43a Fix interleaved DSH accounting and preserve inclusive output 2026-09-11 21:12:15 +08:00
Mathieu Stanowski
29fcb38976 feat(cli): honor --project/--exclude on the remaining reporting commands
The README says these flags work on every command. They did not: only
report, overview, web, status, today, month and export declared them, so
sessions, models, compare, audit, optimize, yield and spend either
rejected the flag outright or silently reported the whole corpus.

Each command already funnels through parseAllSessions, so the filter is
applied at that single point with the shared filterProjectsByName. yield
and spend parse inside computeYield / computeSpendFlow, which now take
the patterns as optional arguments and default to filtering nothing.

README now states the matching rule instead of claiming "all commands".
2026-09-11 07:32:34 +02:00
xz
a2f1fe2007 Fix DSH v0-v3 session discovery and usage accounting 2026-09-11 12:40:36 +08:00
ozymandiashh
6a0f830b9b
Merge pull request #1229 from earbona23/test/scoped-run-stamps-whole-cache-complete
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
fix(parser): avoid marking partially scanned caches complete (#912)
2026-09-10 23:19:15 +03:00
Andrew Lee
7d2722fb70 fix(kiro): emit workingDirectory so sync attribution can resolve the repo
Every kiro session was attribution-blind: `codeburn sync push --attribution`
reported "0 facts total" regardless of window, so no session→commit correlation
ever reached the endpoint.

project-path-v1 set out to fix exactly this and wired the session's directory to
`projectPath`. But sync attribution does not read that field. computeAttributionRecords
calls buildRepoGroups in "trusted-session-cwd" mode:

    const sourcePath = identityMode === 'trusted-session-cwd'
      ? session.workingDirectory
      : project.projectPath

so it resolves the repo from `workingDirectory`, then filters to sessions whose
own directory resolved (`group.ownIdentity`). With that field unset,
`isTrustedAbsoluteWorkingDirectory(undefined)` returns false on its first clause,
every session is dropped, and attributeCommits joins the repo's commits against
an empty session list. The path was being carried the whole time, just on the
field nothing consumed.

All three kiro parsers now emit workingDirectory from the same provider-recorded
value they already use for projectPath:

- CLI (~/.kiro/sessions/cli/<id>.jsonl): companion .json `cwd`
- v2 IDE (~/.kiro/sessions/<hash>/sess_<id>/): session.json `workspacePaths[0]`
- workspace sessions: record `workspaceDirectory`

Nothing downstream needed changing. parser.ts already stamps
`workingDirectoryProvenance: 'provider-field'` on any provider-set value that
passes the trust check, which is what the consumer requires — an unmarked value
is treated as synthesized from projectPath and fails closed.

Bumps PROVIDER_PARSE_VERSIONS.kiro to working-directory-v1. Entries cached under
project-path-v1 hold projectPath but no workingDirectory, so without the bump the
fix would miss every user who already has a warm cache — that is, everyone
upgrading.

Verified against a real corpus (2457 CLI sessions, 8 v2 IDE sessions):

    before:  Attribution: 0 facts total, would push 0 (0 sessions, 0 commits)
    after:   Attribution: 190 facts total, would push 190 (21 sessions, 169 commits)

Tests cover workingDirectory for all three session shapes, the home-root
rejection (observed in 5 of 8 real IDE sessions, whose workspacePaths is the
user's home directory), and re-parse of a project-path-v1 cache.

AI-Origin: human
2026-09-10 17:39:37 +00:00
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
iamtoruk
df38e63849 fix(usage): fold Windows case in spend identity, qualify --json counts, drop scratch tests 2026-09-07 14:56:32 -07:00
iamtoruk
b2f6df19a4 test(doctor): pin the OpenClaw empty-root probe, drop the review-note comment 2026-09-07 11:38:24 -07:00
Aditya Vikram Singh
a1546f588b fix(cli): invalidate status snapshots after sessionCountBasis landed
Same-package render-5 records omit the field, so empty identity-0 is
served as unavailable. Bump STATUS_SNAPSHOT_RENDER_VERSION to 6. Daily
and session caches stay put so unknown retained accounting remains a
partial bound.
2026-09-07 22:59:35 +05:30
Aditya Vikram Singh
309fcef51b test(cli): spawn source CLI for a session spanning two days
The regression spawned dist/cli.js, which is absent in a clean npm-test
checkout. Drive the same end-to-end check through src/cli.ts and keep the
fixture on owned temporary paths isolated from inherited provider dirs.
2026-09-07 22:28:37 +05:30
Aditya Vikram Singh
c28cf06867 test(cli): pin color off for unpriced hostile-ID source-safety spawn
FORCE_COLOR=1 on agent/CI runners makes chalk paint table chrome with ESC.
The C0/C1 assertion is a model-ID sanitization check, not a color check.
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
Aditya Vikram Singh
a7eea1855e fix(doctor): add probeRoots for seven filesystem-silent providers (#899)
Close forge/mux/open-design/openclaw/zcode/zed/zerostack filesystem gaps.
Vercel remains the network-only exception. OpenClaw SQLite/JSONL
accounting stays in the following #1259 commit; this commit only adds
OpenClaw probeRoots so empty-root diagnostics can see an agents path.

Source-DIFF: 00ebf26c (1259-899-sqlite-discovery) / carried in d91b6a71
Lane: local core-wave 2026-09-07
2026-09-07 22:02:07 +05:30
Giovannini Barbosa
720824e619 fix(cli): default NODE_ENV to production so Ink's React build stops leaking user-timing entries.
React, loaded by Ink, picks its development build unless NODE_ENV is
exactly "production". Since React 19.2 that build records a
performance.measure() entry on every render (its DevTools "Scheduler"
and "Components" tracks), and Node keeps user-timing marks and measures
in a process-wide buffer that nothing ever trims. The interactive
dashboard re-renders on every progress tick and refresh, so the buffer
grows by roughly 700 entries a minute; after a few days the heap hits
V8's 4 GB default and the process aborts with "Ineffective mark-compacts
near heap limit ... JavaScript heap out of memory".

The launcher (dist/cli.js, the entry every client spawns) now defaults
NODE_ENV to "production" before importing main.js, which selects the
build that records nothing; an explicit NODE_ENV still wins. For that
explicit case, a small guard drops the user-timing buffer every 30 s for
the lifetime of each Ink UI (dashboard, sessions, context, compare).
codeburn records no marks or measures of its own, so nothing is lost.

Tests spawn the real launcher against a stub main.js to pin the default,
and drive a ticking Ink app in a child Node process to show the
development build's backlog, the production build's absence of one, and
the guard keeping it bounded.
2026-09-07 10:27:46 -03: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
Resham Joshi
e90036b106
Merge pull request #1248 from getagentseal/fix/windows-concurrency-review
fix(windows): a Codex login race and cross-process settings writes
2026-09-03 12:30:25 -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
8cfaa358ac fix(dock): scope the glance Today row to the hovered provider
The Capacity Dock's glance popover rendered the machine-wide Today block in
every provider's card, so hovering Claude showed the total across every
provider as if it were Claude's.

CLI (add-only): ProviderCost and providerDetails now carry optional
inputTokens, outputTokens and sessions, summed per provider in all three
branches that build the provider list. They stay ABSENT when no day in the
period reported a breakdown, so a consumer can tell "no data" from zero.
STATUS_SNAPSHOT_RENDER_VERSION 4 -> 5, since a v4 snapshot's payload predates
the new fields; the daily cache already holds the tokens, so its version is
untouched.

App: the Today row reads the hovered provider's row out of providerDetails
(matched on the CLI provider id, which the dock's kimi entry bridges to
kimicode). Against a CLI that omits per-provider tokens the arrows drop out
rather than falling back to the global pair; a provider absent from a
breakdown that IS present reads as a real $0.00. The row keeps its fixed
frame, so the panel's computed height is unchanged either way.
2026-09-03 08:32:20 -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
7b2a6df333 fix(quota): guard both exits, and outlast the request being guarded
Two doors still skipped the credential drain. A closed pipe, which is
how `codeburn quota | head` ends, exited straight from the stdout error
handler; it drains first now, and resolves immediately for every command
with nothing outstanding. A throw from any provider left through the
same door as success without draining at all; the drain moved into a
finally, so one provider failing cannot strand another's rotation.

The drain also waited fifteen seconds for a request allowed thirty, so a
grant answering at twenty was abandoned by the very guard built for it.
The wait is now derived from the request timeout plus a margin, so the
two cannot drift, and giving up says so on stderr instead of leaving the
user to discover it the next time that provider asks them to sign in.
2026-09-03 04:52:31 -07:00
iamtoruk
d84769edfe fix(cli): drain credential writes before exit, a staged-msi flag, a zero bucket
- codeburn quota could still exit with a rotated Codex token in flight:
  the command ended with process.exit and the per-provider abort could
  cut the grant after the server had rotated. The refresh stays, since
  the usage endpoint rejects an expired access token, and every rotation
  registers itself; the command awaits outstanding credential writes,
  bounded to fifteen seconds, before it exits. Tests abort mid-grant and
  time the provider out and still find the new token on disk.
- CODEBURN_MENUBAR_MSI let one environment variable send msiexec at any
  file whose checksum the same party wrote. It is replaced by
  `codeburn menubar --staged-msi <path>`, which must be absolute,
  resolved, named as the release asset, inside a resources\menubar
  directory whose grandparent holds CodeBurn.exe, a regular file with a
  regular .sha256 beside it; the variable is refused with the reason.
- countBucket(0) reported one to ten turns for a model with none. Zero
  is its own bucket.
2026-09-03 03:06:13 -07:00
iamtoruk
e3dd333949 feat(cli): an anonymised daily telemetry snapshot inside the menubar payload
The desktop app and the Windows tray both send a once-a-day usage
aggregate when the person has opted in. Each built its own, which meant
two schemas to keep honest. The CLI now computes one snapshot at the end
of the menubar payload and both apps send it verbatim.

Everything is bucketed and name-only: cost and count buckets, up to
eight models each with its top six task categories and their share of
turns, twelve categories with their top models, providers, MCP servers,
skills and tools by identifier with call buckets, a session count and
median length bucket, and cache hit and retry tax shares to two
decimals. Nothing derived from paths, project or branch names, or
message text can enter it; the builder only emits primitives and capped
containers. The raw model by task cross rides in through the options
bag and never lands in the payload itself.
2026-09-03 01:18:22 -07:00
iamtoruk
25a778cef2 test(menubar): ignore idleSeconds in the payload parity check
The parity test builds the payload twice over the same warm cache and
expects the two to match. Since liveSessions landed, each session
carries idleSeconds, whole seconds since its last activity, so two
builds that straddle a second boundary differ by one and the test
fails at random. Seen on the macOS runner. stableShape now zeroes it
the way it already blanks the generated stamp.
2026-09-02 23:18:34 -07:00
iamtoruk
8c8783c442 test(menubar): ignore idleSeconds in the payload parity check
The parity test builds the payload twice over the same warm cache and
expects the two to match. Since liveSessions landed, each session
carries idleSeconds, whole seconds since its last activity, so two
builds that straddle a second boundary differ by one and the test
fails at random. Seen on the macOS runner. stableShape now zeroes it
the way it already blanks the generated stamp.
2026-09-02 23:18:21 -07:00
iamtoruk
6998c5ac07 fix: keep macOS and Linux path behaviour exact in guard flags and Hermes
Two of today's Windows fixes changed POSIX results. Guard flags counted
a backslash as a directory boundary on every platform, where it is an
ordinary filename character off Windows; it now counts only on win32,
while a forward slash counts everywhere so POSIX-shaped provider paths
still match on a Windows host. Hermes accepted drive-letter paths as
real workspaces on every host on the theory that a state.db can be read
on another machine; discovery is strictly local and the ledger contract
rules out restored databases, so that acceptance is Windows-only again.
2026-09-02 15:11:01 -07:00
iamtoruk
a6005df140 fix(quota): persist a rotated Codex refresh token before anything can exit
The quota command races every provider read against a five second
timeout and exits as soon as output is written. The Codex read refreshes
the OAuth grant, and between parsing the grant and writing auth.json
there were two await points, so a timeout or the exit could land with
the old refresh token already retired server-side and the new one only
in memory, signing the user out of Codex. A rotated token was also
dropped when the re-read of auth.json failed or when the grant carried
no access token, and a failed write looked like a network error.

The persist path is now synchronous from the parsed grant to the atomic
rename, keeps the credential file's own private mode, falls back to the
in-memory document when auth.json cannot be re-read, persists a rotated
refresh token even without an access token, reports a failed write on
stderr, and the grant request no longer honours the caller's abort so a
rotation the server has committed cannot be cancelled mid-response.
2026-09-02 15:11:01 -07:00
iamtoruk
dc802f545d fix(windows): make codeburn menubar safe beside the desktop app
Three gaps in the Windows route of `codeburn menubar`:

- A Microsoft Store install of the desktop app carries the tray inside
  its package and never appears in the uninstall registry, so the CLI
  downloaded and installed a second copy into Program Files. The Store
  package is now detected first (Get-AppxPackage, bounded to five
  seconds, any failure reads as "not a Store install") and its packaged
  exe is launched instead; --force still installs the MSI and says the
  Store copy is left in place.
- msiexec ran over a running tray. Windows Installer defers the file
  swap to the next reboot in that case, so the post-install launch woke
  the old process. The running tray is now asked to quit through its
  own single-instance protocol, waited for, and killed only as a last
  resort, before msiexec runs.
- The ownership marker was written only on the desktop route, so a
  hand-installed tray could later be credited to the desktop app and
  removed by its uninstaller. The CLI route now records "manual", and
  an existing verdict is never rewritten.
2026-09-02 15:08:52 -07:00
iamtoruk
d1d922e741 test(quota): write credential fixtures with private permissions
readSecureFile rejects a login file with group or world bits on POSIX,
which is right for a real login. The Grok and Z.ai fixtures were written
with default permissions, so on Linux the product refused them and six
assertions saw transientFailure or disconnected. Windows has no mode bits
to check, which is why the branch only ever passed there.
2026-09-02 14:28:08 -07:00
iamtoruk
62cb4f8630 test: isolate the real home on Windows and make the CLI suite pass there
os.homedir() reads USERPROFILE on Windows and never HOME, so the
isolation setup and every test that moved home were still resolving the
developer's real home directory. Fixtures came back empty, real sessions
leaked into counts, and the code under test wrote plans, receipts and a
sync ledger into the real ~/.config/codeburn during a run.

USERPROFILE now joins the redirected variables and a shared setHome()
helper moves HOME and USERPROFILE together; every spawn env carries both.
The remaining Windows-only failures were POSIX-shaped fixtures: chmod
tricks that only toggle a read-only attribute on NTFS, pid 1 as an
always-alive lock holder, splitting paths on '/', bare tar, mode-bit
expectations, and per-file timeouts too short for the cost of a tsx spawn.
Each gets a platform-aware equivalent so nothing is skipped on Windows and
the POSIX branches stay byte-for-byte what they were.

Full run on Windows: 267 files passed, 2 skipped, 3592 tests passed.
2026-09-02 13:43:57 -07:00
Resham Joshi
500412aa88
Merge pull request #1235 from avs-io/codex/provider-reconciliation-races
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 / desktop (push) Waiting to run
Join provider refreshes and prevent scoped false zeros
2026-09-02 11:51:30 -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
d27b489328 Merge remote-tracking branch 'origin/main' into feat/windows-capacity-dock 2026-09-02 08:01:44 -07:00
iamtoruk
034ae444d0 test(menubar): pin every ProviderFilter case to a real CLI provider id
ProviderFilter.cliArg is both the --provider argument and the id the
payload-consistency guard matches against providerDetails. A case whose cliArg
is not a registry name silently disables that guard for its tab: the lookup
finds no detail row, so no contradiction is ever detected. Nothing in either
language can see both sides, so the contract is checked from the TypeScript
side, where the registry is importable and the Swift source is readable.

Table-driven over all 30 enum cases. No mapping needed fixing: .kimiCode
already yields `kimicode`, which is the registry name (`kimi-code` is not a
provider the CLI knows), and every other case resolves too. Setting .kimiCode
to `kimi-code` makes this suite fail, which is the check working.
2026-09-02 07:55:54 -07:00
iamtoruk
a8bddef84e fix(hermes): superseded v1 ledger file was left on disk forever
The loader reads only the v3 path, so a hermes-session-ledger.v1.json from an
earlier install sat in the cache dir unread and undeleted. It is dead weight
that can only mislead: the parse-version bump forces a cold re-parse that
rebuilds every cursor from source, so nothing in it is recoverable. Unlink it
when the v3 file is absent.

The v2 test this replaces was vacuous. It wrote a v2 file and asserted the
ledger was empty, but the loader never looks at a v2 path, so it passed
whatever the code did. The replacement uses a real v1 fixture and asserts both
halves: the ledger loads empty AND the v1 file is gone afterwards.
2026-09-02 07:32:02 -07:00