mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 20:29:02 +01:00
Token accounting (#133) shipped, ran a full day, and wrote ZERO rows — no usage_detail, no tokens, no cost, across 15 runs. A dispatch carries the founder's LAPTOP path (`/home/g/dev/solon`). On the box that path does not exist, so `launchAgentPty` resolves a box-local clone via ensureBoxWorkspace — but it resolved it PRIVATELY: the effective directory never escaped the function. Everything else in the runner kept using the unresolved path, including the two places that look up `~/.claude/projects/<slug-of-dir>`: - the usage reporter tracked `-home-g-dev-solon`, a transcript directory that cannot exist on the box, so `collectClaudeUsage` returned null and every tick skipped it — silently, forever; - `detectAuthFailure` read the same missing directory, so dead box credentials were undetectable on the very runner whose two silent outages (2026-07-02/03) motivated writing that canary. The fix is to stop having two answers to "where does this project live": box-workspace-path.ts derives it once, box-workspace.ts uses it for cloning, and the poller uses it for both transcript lookups. Pure (fs/os/path only) so the poller can import it statically without pulling @/db into the desktop bundle — the reason box-workspace.ts is dynamically imported in the first place. On the laptop it is the identity function. Also: the no-transcript branch now warns ONCE per run. Its silence is the whole reason this went a day unnoticed — a metering path that fails quietly is indistinguishable from a fleet that spent nothing. 7 tests, incl. the real production dispatch shape. Unblocks #136, whose start gate waits on metered runs that could never arrive. Closes #145 Co-authored-by: test <test@test> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>