fix(ops): the usage panel tells the truth, the sentinel names its real cause, and dev kills stop hitting peers - #566
Merged
Conversation
…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
enabled auto-merge (squash)
August 31, 2026 04:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
UsageStatsSectionrenderedsettings.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_summaryexisted with zero frontend callers). The panel now shows:get_llm_usage(global ledger: all features, restart-seeded, millicent-backed), with an 80%/limit color rampget_ai_usage_summary— "what is burning tokens" becomes answerable from Settings instead of SQLNew
usagei18n namespace translated for all 13 locale dirs; unknowntask_typetags render raw rather than hiding spend. 4 component tests pin the rerank-ledger regression (absurd sentinel values insettings.usagemust never render).2. Sentinel classifies by meaning, not text
Live false positive: a cold
tscexceeded the scan's 60s timeout → zeroerror TSlines → "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 arequire.mainguard so tests import it without executing a scan.3. Path-scoped dev kills
taskkill /F /IM fourda.exekills 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.ps1stops only instances launched from the caller's tree'ssrc-tauri/target/, supports-Root/-DryRun, and lists what it deliberately left running. CLAUDE.md now prescribes it and bans the image-name kill.Verification
tsc --noEmitcleannode --test scripts/sentinel-scan.test.cjs: 5/5; live--quickscan runs green through the modified scripti18n-guard.cjsclean across all 13 locales; dry-run ofstop-fourda.ps1verified against live processes🤖 Generated with Claude Code
https://claude.ai/code/session_019RTCgzAcaopjz3KZnaqNrj