Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix(usage): read the interactive scan watermark strictly so a damaged file can't trigger a re-bill

[._.]/ Adam Eivyc8e2a5b9305f
diff --git a/server/services/usageInteractiveScan.js b/server/services/usageInteractiveScan.js
index 663d4f5ed4..698eb0294d 100644
--- a/server/services/usageInteractiveScan.js
+++ b/server/services/usageInteractiveScan.js
@@ -187,7 +187,8 @@ async function parseSession(family, session, from, to, byCwd) {
// caller, and tests drive it directly with a fixture home/runs dir.
export const refreshInteractiveUsage = ({ home = homedir(), runsDir = PATHS.runs, providers = null, now = Date.now() } = {}) => (
withLock(async () => {
- const state = await readJSONFile(INTERACTIVE_SCAN_FILE, { watermarks: {} });
+ // Strict: a damaged watermark must fail the scan, not read as empty and re-bill 35 days.
+ const state = await readJSONFile(INTERACTIVE_SCAN_FILE, { watermarks: {} }, { strict: true });
const watermarks = { ...(state?.watermarks || {}) };
const to = now - SETTLE_MS;
// Not caught: a provider-list failure must surface, not read as "none configured".