Conversation
The construction-time gate that withholds the fallback-account background refresh when vault residency is structurally unsafe emitted no signal, so a process that had silently stopped refreshing looked identical from outside to a healthy one. Emit one claustrum warn at the decision carrying the three dimensions that produced it (custody mode, provisional flag, fallbacks dimension), and add a process-wide fallbackRefreshStructuralDark flag to sidebar state so the condition is visible on the wire. The gate's boolean is unchanged.
Add a non-dark control test: an unconditional gate (if (true) / ...(true &&)) previously passed the whole suite, so nothing proved the signal is absent when the gate does not withhold. The new test asserts no withheld warn and that the sidebar key is omitted entirely. Publish the boot decision to the sidebar at construction. The loader's own sidebar write is unreachable while structurally dark (the custody reconcile refuses first), so a warm-vault dark boot left the sidebar silent until a command ran. A poll-based test covers the fire-and-forget boot publish. Document at the projection site that the flag is a boot fact, never cleared.
|
Pushed SHOULD 1 — the tests only proved absence-detectionThe original three mutations all deleted something, so they demonstrated the tests notice a missing signal and said nothing about a false one. With the gate forced unconditional at both sites: A regression firing the warn in local mode, or making the sidebar always claim dark, was invisible to the whole 1896-test suite. Added Mutation polarity is the point: for a positive assertion you delete to redden; for an absence assertion you must add the forbidden behavior. Reverting the warn cannot redden a test that requires no warn. SHOULD 2 — the boot case had no sidebar writeReview traced that the loader's own sidebar write is unreachable while structurally dark: So an operator who booted dark and ran no command saw nothing in the sidebar. Fixed with a 3-line publish at the end of the boot sequence via the existing VerificationThree mutations re-run independently of the implementer's report, tree restored to clean between each:
The third was not requested. It isolates the two halves of the negative test: without it, a single warn assertion could have been carrying the whole thing while the sidebar-absence assertion rode along untested. Each half fails on its own. Gates on the restored tree: core 199/0 · opencode 1898/0 (1896 + 2) · typecheck clean · Nits
|
Closes #239.
The problem
packages/opencode/src/index.tsdecides at plugin construction whether to start the fallback-account background refresh. When it withholds, nothing observable says so — the process is indistinguishable from a healthy one.Measured on
mainbefore this change:The withheld state reached neither the log file nor sidebar state. Its only consumer was a test seam.
Why it matters
A boot-time flag gating a resource fails loud — the acquire blocks or errors. A boot-time flag gating a capability fails silent: nothing errors, a manager simply never exists, and everything downstream is merely quiet.
There is a live precedent for this exact gate. An earlier revision computed boot evidence as "every bound fallback has a usable resident credential right now", so a single cold account at boot returned provisional
FAIL_CLOSEDand suppressedstartBackgroundRefresh()across all accounts — re-introducing a fleet-wide idle-expiry exposure. The logic was corrected to a structural-only gate; the silence was not.The change
logger.warn('claustrum', 'fallback refresh withheld at construction', …)at the decision, carrying the three dimensions that produced it (custodyMode,provisional,fallbacks) — so a reader can tell why it withheld, not just that it did. Follows the existing convention used at 16 other sites in the file.fallbackRefreshStructuralDarkflag onSidebarState, using the house...(cond && { field })additive idiom.The gate's boolean is unchanged. This attaches a signal to an existing decision; it does not re-decide it.
Verification
Three mutations, all re-run independently of the implementer's report, each restored to a clean tree before the next:
withholding the fallback refresh logs the three dimensions that produced it—Received: undefinedthe sidebar carries the structural-dark flag—Expected: true, Received: undefined'local',false,'X')- Expected - 3 / + Received + 3The third was not in the brief. It distinguishes a test that asserts a line fired from one that asserts the line carries the right dimensions — without it, the log could regress to useless content while staying green. It reddens, so the test checks values rather than presence.
Gates on the restored tree: core 199/0 · opencode 1896/0 · typecheck clean ·
aft_inspect0/0.Note on the test harness
The sidebar test triggers its write via
claude-account add-apikeyrather than the loader's own sidebar write: in the dark state the loader refuses withRESUME_TAKEOVERbefore reaching that write. Harness choice only — no production write path was altered.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Closes #239. Makes the withheld fallback refresh observable so a process that silently stopped refreshing no longer looks identical to a healthy one. The gate's boolean is unchanged; only its visibility changes.
custodyMode,provisional, andfallbacks.fallbackRefreshStructuralDarkfield to sidebar state and publishes it at construction, so a warm-vault dark boot exposes the decision without waiting for a command.Tests cover both dark and non-dark boots, including the construction-time publish.
Written for commit 2225d81. Summary will update on new commits.