Skip to content

fix(ops): the usage panel tells the truth, the sentinel names its real cause, and dev kills stop hitting peers - #566

Merged
runyourempire merged 4 commits into
mainfrom
worktree-apply-recs-wave1
Aug 31, 2026
Merged

fix(ops): the usage panel tells the truth, the sentinel names its real cause, and dev kills stop hitting peers#566
runyourempire merged 4 commits into
mainfrom
worktree-apply-recs-wave1

Conversation

@runyourempire

Copy link
Copy Markdown
Collaborator

Three items from the approved 2026-08-31 recommendation set (recs #4 and #6; #1/#2/#5 are sequenced behind in-flight lanes, #3 behind #554).

1. Truthful AI usage panel

UsageStatsSection rendered settings.usage — the rerank-only ledger — as "cost today". After #553 split usage recording per feature, that under-reported real spend ~10-30x while the true totals sat dark (get_ai_usage_summary existed with zero frontend callers). The panel now shows:

  • Cost today vs the configured daily cap from get_llm_usage (global ledger: all features, restart-seeded, millicent-backed), with an 80%/limit color ramp
  • Tokens today from the same ledger
  • This month total + per-feature breakdown from get_ai_usage_summary — "what is burning tokens" becomes answerable from Settings instead of SQL

New usage i18n namespace translated for all 13 locale dirs; unknown task_type tags render raw rather than hiding spend. 4 component tests pin the rerank-ledger regression (absurd sentinel values in settings.usage must never render).

2. Sentinel classifies by meaning, not text

Live false positive: a cold tsc exceeded the scan's 60s timeout → zero error TS lines → "TypeScript compilation failed (0 errors)" reported as CRITICAL, deploying an expert against a compiler that never finished. classifyTscResult (pure, exported) now goes critical only on actual error lines; timeouts and spawn failures become "check inconclusive — " warnings. Same treatment for the Rust branch's non-zero-exit-no-errors path. 5 negative tests per the gate-precision doctrine (recipe-gate-precision-negative-test); the script gains a require.main guard so tests import it without executing a scan.

3. Path-scoped dev kills

taskkill /F /IM fourda.exe kills every fourda on the machine — two scheduled background-refresh engine runs were killed mid-cycle today as collateral from a peer lane's dev restart (task result 0xFFFFFFFF). scripts/stop-fourda.ps1 stops only instances launched from the caller's tree's src-tauri/target/, supports -Root/-DryRun, and lists what it deliberately left running. CLAUDE.md now prescribes it and bans the image-name kill.

Verification

  • vitest: 1,248/1,248; tsc --noEmit clean
  • node --test scripts/sentinel-scan.test.cjs: 5/5; live --quick scan runs green through the modified script
  • i18n-guard.cjs clean across all 13 locales; dry-run of stop-fourda.ps1 verified against live processes

🤖 Generated with Claude Code

https://claude.ai/code/session_019RTCgzAcaopjz3KZnaqNrj

…l cause, and dev kills stop hitting peers

Three fixes from the approved 2026-08-31 recommendation set (operator
green-lit; evidence in .claude/plans/PENDING-DECISION.md):

1. Truthful AI usage panel (UsageStatsSection). The section rendered
   settings.usage — the RERANK-ONLY ledger — as "cost today". After #553
   split usage recording per feature, that under-reported real spend by an
   order of magnitude while the true totals sat dark in ai_usage (the
   get_ai_usage_summary command existed with ZERO frontend callers). The
   panel now reads the global daily ledger (get_llm_usage: all features,
   restart-seeded, with the configured cap and an 80%/limit color ramp) and
   the month's per-feature breakdown, so "what is burning tokens" is
   answerable from Settings instead of SQL. New `usage` i18n namespace,
   translated for all 13 locale dirs; unknown task_type tags render raw —
   spend is never hidden. 4 component tests pin the regression.

2. Sentinel compile checks classify by meaning, not text. A cold tsc
   exceeded the scan's 60s timeout, produced zero "error TS" lines, and the
   sentinel reported "TypeScript compilation failed (0 errors)" as CRITICAL
   — deploying an expert against a compiler that never finished. safeExec
   now surfaces timedOut/errCode; classifyTscResult (exported, pure) only
   goes critical on actual error lines, and timeouts/spawn failures become
   "check inconclusive — <real cause>" warnings. Same fix for the Rust
   branch. tsc timeout raised to 120s. 5 negative tests per the
   gate-precision doctrine; the scan gains a require.main guard so tests
   can import it without executing it.

3. Path-scoped dev kills (scripts/stop-fourda.ps1). `taskkill /F /IM
   fourda.exe` kills EVERY fourda on the machine — two scheduled
   background-refresh engine runs were killed mid-cycle today as collateral
   from a peer lane's dev restart (task result 0xFFFFFFFF). The script
   stops only instances launched from the caller's tree's src-tauri/target/
   and lists what it deliberately left running; CLAUDE.md now prescribes it
   and bans the image-name kill.

Verification: vitest 1248/1248; tsc clean; node --test sentinel tests 5/5;
i18n-guard clean; live quick-scan runs green through the modified script.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019RTCgzAcaopjz3KZnaqNrj
@runyourempire
runyourempire enabled auto-merge (squash) August 31, 2026 04:16
@runyourempire
runyourempire merged commit 9c968e4 into main Aug 31, 2026
11 checks passed
@runyourempire
runyourempire deleted the worktree-apply-recs-wave1 branch August 31, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant