selection never spends money — the machine waits (MX-262) - #24
Merged
Conversation
mgrin's call, 2026-08-22, given directly and reversing his own first answer inside the same message: "The account with billing is an exception — I just needed it one time... in normal operation the system must not prioritize the account with money; it should operate as usual, and if all accounts exhausted all their limits it should wait for limits to be waived. So sorry, my correction, the answer is no — it should not rank this account above." The record does not carry the "yes". `pickBest` now returns only slots with a FREE WINDOW. A tier-1 slot — credits ON behind a spent window — is filtered out rather than ranked last. Ranking it last was MX-210's answer and it was right for the question MX-210 asked; it still got selected whenever nothing better existed, which is exactly the state where the money gets spent. ONE GATE, DELIBERATELY, because every automatic path runs through it: decideSwitch, the reactive rate-limit handler, `bb accounts auto`, and the simulator that models what the switcher would do. Guarding each caller would leave the next caller unguarded. `bb accounts switch <slot>` does NOT go through pickBest — it takes an explicit slot, and that is the exception mgrin invokes, so it keeps working untouched. decideSwitch's `!best` branch now says WHICH of three states it is in, because "no eligible alternative slot" was also what it returned for a machine with paid capacity sitting right there, declined on purpose — and that reads as a broken poll to whoever finds it in the log: - nothing tripped, and the only alternative is paid - a move was wanted and paid capacity was declined -> WAITING: ... - there is genuinely nothing anywhere -> unchanged wording The dedicated `spread declined:` guard is GONE rather than duplicated: pickBest can no longer hand a paid slot to anything. Its test keeps the claim it existed for and now asserts no switch plus a reason naming the credit account. REPORTING IS UNTOUCHED AND DISAGREES ON PURPOSE. capacityVerdict still answers "paid-only" and `bb accounts outage` still exits 1 saying the machine can serve — that is MX-218 and it is true. Reporting answers what is POSSIBLE; selection answers what is POLICY. The recovery sweeper deliberately follows REPORTING (anyAccountHasCapacity holds only on "none"), because a machine mgrin has deliberately put ON the credit account must keep working. Tests 291 -> 294, 0 fail, 0 skip; tsc --noEmit clean. The Python deadman switcher carries the same change in MGrin/dotfiles; the two brains share one Keychain and were paired for exactly this reason. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
mgrin's call, 2026-08-22, given directly and reversing his own first answer inside the same message. The record does not carry the "yes":
This plugin is the primary switcher, so the paired change in
MGrin/dotfiles(the deadman Python switcher) would not have implemented the decision on its own.One gate, in
pickBestpickBestnow returns only slots with a free window. A tier-1 slot — credits ON behind a spent window — is filtered out rather than ranked last. Ranking it last was MX-210's answer and it was right for the question MX-210 asked; it still got selected whenever nothing better existed, which is exactly the state where the money gets spent.The gate is in
pickBestdeliberately, because every automatic path runs through it:decideSwitch, the reactive rate-limit handler,bb accounts auto, andanalytics/simulate.ts(which exists to model what the switcher would do). Guarding each caller would leave the next caller unguarded.bb accounts switch <slot>does not go throughpickBest— it takes an explicit slot, and that is the exception mgrin invokes, so it keeps working untouched.bb accounts placewas already compliant:usableHeadroomismin(switchAt − 5h, weeklyAt − 7d)and filters on> 0, so a spent burst never had headroom there.The reason now says which state it is in
{action: "none", reason: "no eligible alternative slot"}was also what a machine returned when it had paid capacity sitting right there and declined it on purpose — which reads as a broken poll to whoever finds it in the log. Three states now:WAITING: ... would serve, and BILL, ... to spend deliberately: bb accounts switch <slot>The dedicated
spread declined:guard is gone rather than duplicated —pickBestcannot hand a paid slot to anything now. Its test keeps the claim it existed for (an optimization is not a reason to bill) and asserts no switch plus a reason naming the credit account.Reporting is untouched and disagrees on purpose
capacityVerdictstill answerspaid-onlyandbb accounts outagestill exits1saying the machine can serve. That is MX-218 and it is true.capacityVerdict,bb accounts outagepaid-only— can serve, exit1pickBest,decideSwitchThe recovery sweeper deliberately follows REPORTING (
anyAccountHasCapacityholds only onnone), because a machine mgrin has deliberately put on the credit account must keep working. That asymmetry is now written into the README rather than left to be discovered and "fixed".Tests
291 → 294 pass, 0 fail, 0 skip;tsc --noEmitclean. Two inverted tests keep their original provenance in their comments — a spent credit account is a candidate at all and a walled machine moves onto credits both asserted the opposite until this commit, and both were right for MX-210's question.Paired with MGrin/dotfiles#240.
🤖 Generated with Claude Code