Skip to content

Add durable All Time spend history - #2881

Open
akshayprabhu200 wants to merge 16 commits into
steipete:mainfrom
akshayprabhu200:codex/lifetime-spend-dashboard
Open

Add durable All Time spend history#2881
akshayprabhu200 wants to merge 16 commits into
steipete:mainfrom
akshayprabhu200:codex/lifetime-spend-dashboard

Conversation

@akshayprabhu200

@akshayprabhu200 akshayprabhu200 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a durable, provider/account/currency-scoped daily spend ledger
  • add an All Time range beside the existing 7d and 30d controls
  • retain tracked model breakdowns and show exact available-history coverage
  • give Share Stats honest all-time wording, filenames, and coverage metadata

Why

The dashboard currently offers only rolling 7-day and 30-day views. Extending that window to 365 days is not true lifetime tracking because provider snapshots are bounded and older local source history can disappear. This change records proven daily buckets as CodexBar observes them, then builds All Time from that durable history.

This is intentionally separate from #2759: it does not add a 365-day approximation or change provider/RPC behavior.

Data truth and safety

  • All Time means all history CodexBar has durably tracked, not provider-account history from before tracking began.
  • The UI and shared card disclose the first available date and exact covered-day count.
  • Only complete, arithmetically consistent provider windows are recorded; gaps stay explicit.
  • History is isolated by source ownership fingerprint and currency, including Codex account identity changes.
  • The JSON ledger is atomically replaced, owner-readable only (0600 on macOS), and fails empty on corrupt or unknown schemas.
  • Existing 7-day and 30-day behavior continues to use fresh provider inputs.

Packaged runtime proof

The checked-in evidence was produced by the packaged debug CodexBar app at signed harness commit 392eb52c6, using two separate processes and the production Codex scanner, ledger, dashboard controller, SwiftUI views, and Share Stats renderer.

  1. The first process scanned a fixed synthetic 30-day Codex window and persisted it.
  2. The process exited.
  3. A second packaged-app process opened the exact prior ledger hash, scanned a later 30-day window, selected All Time, and rendered 60 covered days.

Both manifests report executable SHA-256 838af0bb9a7a999dcccb2481f46e2425b8f16e0262b451bf74d49871d28fe039. The record manifest's ledger SHA-256 53691e15efae58b5cb2022b857249d1a281e853654c4669359db08fa6d4df0ae exactly matches the reload manifest's ledgerBeforeSHA256.

The DEBUG-only proof mode resolves before normal app initialization, requires a current-user-owned 0700 sentinel directory under /private/tmp, rejects root and sentinel symlinks with lstat, uses an empty isolated environment, and constructs no SettingsStore, UsageStore, browser importer, Keychain service, or network client. It is compiled out of release builds.

All screenshot inputs are fixed synthetic fixtures. The final images were inspected at original resolution and contain no names, emails, usernames, paths, UUIDs, account labels, prompts, keys, desktop/menu-bar context, permission dialogs, or live usage data.

All Time dashboard after restart

Packaged All Time dashboard after restart

All Time Share Stats card after restart

Packaged All Time Share Stats card after restart

Evidence and reproduction details:

Verification

  • packaged two-process record → exit → reload proof passed
  • affected dashboard suites: 6/6 passed locally
  • provider architecture gate: 38/38 passed locally
  • production target builds with the proof harness
  • SwiftFormat and git diff --check pass
  • GitHub CI previously passed both macOS shards after the date-truth and test-isolation fixes; the current draft intentionally defers required macOS jobs until marked ready

Addresses #1708

@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 1:28 AM ET / 05:28 UTC.

ClawSweeper review

What this changes

The PR persists validated provider cost buckets in a local ledger and adds an All Time Usage & Spend range plus coverage-aware Share Stats output.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open for a maintainer decision on the retention lifecycle. The implementation and packaged restart proof are strong, but turning existing cost tracking into a durable local usage archive needs an explicit product/privacy policy before merge.

Priority: P2
Reviewed head: 6255eb0af7e5a3e2a717c05b75d098b5b16f5ad7
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong packaged behavior proof and extensive focused coverage support the implementation; retention policy remains a maintainer decision rather than a patch-quality defect.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Two inspected screenshots and the checked-in record/reload manifests show a packaged app preserving the ledger across processes and rendering 60 covered All Time days after reload.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Two inspected screenshots and the checked-in record/reload manifests show a packaged app preserving the ledger across processes and rendering 60 covered All Time days after reload.
Evidence reviewed 5 items Durable storage boundary: The new ledger defaults to the user Application Support directory and persists daily provider records, while disabling cost tracking clears in-memory rows without a ledger-deletion path.
Real behavior proof: The supplied packaged-app proof shows All Time after restart, and the checked-in manifests link the record ledger hash to the reload input hash with verified 0600 permissions.
Review continuity: The latest head only moves controller tests relative to the prior reviewed head, so the prior resolved persistence findings are not re-raised.
Findings None None.
Security None None.

How this fits together

CodexBar converts provider usage snapshots into the Usage & Spend dashboard. This PR adds a local ledger between validated snapshots and the dashboard so an All Time view can survive provider-window expiry and app restarts.

flowchart LR
  A[Provider usage snapshots] --> B[Validated daily buckets]
  B --> C[Local spend ledger]
  C --> D[All Time aggregation]
  D --> E[Usage and Spend dashboard]
  D --> F[Share Stats output]
Loading

Decision needed

Question Recommendation
Should enabling existing cost tracking retain durable spend history across disable/re-enable, and what user-visible deletion/disclosure behavior should accompany that policy? Retain with explicit lifecycle controls: Keep durable history, add clear retention disclosure and a visible Remove history action, and document that turning tracking off only stops display and collection.

Why: The code can safely implement either retention policy, but choosing whether historical local usage data survives preference changes is a product and privacy commitment.

Before merge

  • Resolve merge risk (P1) - Existing users who have enabled cost tracking will begin retaining an uncapped local usage-and-spend history; turning tracking off hides it but does not establish a user-visible deletion policy.
  • Resolve merge risk (P1) - The new owner-only ledger is a durable privacy boundary, so maintainers should explicitly decide its retention, disclosure, and removal behavior rather than infer it from the existing rolling dashboard.
  • Complete next step (P2) - A maintainer must choose the local-history retention and deletion policy before a safe merge path can be specified.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Implementation and test growth production +1,297/-85, tests +1,179/-48 The durable data model is substantially covered, but its size makes the retention-policy decision material before merge.
Changed surface 26 files affected The feature spans persistence, dashboard aggregation, sharing, runtime proof, and tests.

Merge-risk options

Maintainer options:

  1. Decide and implement retention lifecycle (recommended)
    Choose the ledger's disable/re-enable and deletion semantics, then add the corresponding disclosure and regression coverage before merge.
  2. Accept durable retention as-is
    Merge with an explicit maintainer decision that cost tracking retains local history and with clear user-facing documentation of how to remove it.

Technical review

Best possible solution:

Adopt All Time only with a maintainer-approved local-history lifecycle: clearly disclose retention, provide a user-visible way to remove the archive, and test the selected disable/re-enable behavior.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a bug report: this is a new feature, and its proposed restart behavior is demonstrated by the supplied two-process packaged-app proof.

Is this the best way to solve the issue?

Unclear: the ledger and restart proof are credible, but the retention and deletion policy is not a purely technical choice.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 208016687098.

Labels

Label justifications:

  • P2: This is a substantial dashboard capability with bounded user impact, not an urgent reliability failure.
  • merge-risk: 🚨 compatibility: Existing cost-tracking users gain durable history whose lifecycle differs from the current rolling-window behavior.
  • merge-risk: 🚨 security-boundary: The PR introduces persistent local usage-and-spend records protected by a new owner-only file boundary.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Two inspected screenshots and the checked-in record/reload manifests show a packaged app preserving the ledger across processes and rendering 60 covered All Time days after reload.
  • proof: sufficient: Contributor real behavior proof is sufficient. Two inspected screenshots and the checked-in record/reload manifests show a packaged app preserving the ledger across processes and rendering 60 covered All Time days after reload.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Two inspected screenshots and the checked-in record/reload manifests show a packaged app preserving the ledger across processes and rendering 60 covered All Time days after reload.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main history attributes the controller baseline to Peter Steinberger and shows substantial recent work on the shared-cache spend and token-activity path. (role: recent area contributor; confidence: high; commits: 521af81e1e10, 698c332a250f; files: Sources/CodexBar/SpendDashboardController.swift, Sources/CodexBar/SpendDashboardModel.swift)
  • Chipagosfinest: The unified Usage & Spend dashboard history originates with the dashboard introduction commit. (role: original unified-dashboard contributor; confidence: high; commits: 0397529ae6e5; files: Sources/CodexBar/SpendDashboardController.swift, Sources/CodexBar/PreferencesSpendDashboardPane.swift)
  • Yuxin Qiao: Recent current-main history includes targeted dashboard token-activity coverage, which this PR extends for capture gaps. (role: adjacent token-activity contributor; confidence: medium; commits: 68f26b5d65c9; files: Sources/CodexBar/SpendDashboardModel.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record the approved local-history retention and deletion policy before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (14 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-12T10:58:56.656Z sha 0b4e5d0 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-12T11:21:54.066Z sha 027bbb1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-12T11:44:34.547Z sha 0111aec :: needs real behavior proof before merge. :: [P1] Fail closed when ledger permissions cannot be applied
  • reviewed 2026-08-13T03:09:40.942Z sha 0111aec :: needs real behavior proof before merge. :: [P1] Fail closed when ledger permissions cannot be applied
  • reviewed 2026-08-13T03:57:02.030Z sha 6e6d5b6 :: needs real behavior proof before merge. :: [P1] Fail closed when owner-only permissions cannot be applied
  • reviewed 2026-08-13T04:50:26.411Z sha 66fc06a :: found issues before merge. :: [P1] Fail closed when owner-only permissions cannot be applied | [P2] Preserve unavailable token counters in ledger records | [P2] Keep capture gaps unknown in token activity
  • reviewed 2026-08-13T04:54:08.720Z sha 66fc06a :: found issues before merge. :: [P1] Fail closed when 0600 cannot be applied | [P2] Preserve unavailable daily token counters | [P2] Keep ledger capture gaps unknown in token activity
  • reviewed 2026-08-13T05:21:40.052Z sha 9a84aa7 :: needs maintainer review before merge. :: none

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 399aa5e8a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +327 to +328
let coveredInterval = if range == .allTime, let trackedCoverage = input.trackedCoverage {
max(bounds.lowerBound, trackedCoverage.start)...min(bounds.upperBound, trackedCoverage.end)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize tracked coverage to display-day boundaries

When All Time includes Mistral history and the user's time zone is not UTC, trackedCoverage.start is a UTC bucket boundary while each daily entry is converted to the containing local day's start. The first entry therefore falls before coveredInterval and is discarded, silently undercounting spend and tokens while the displayed covered-day count remains unchanged; normalize the tracked bounds through the display calendar as the regular coverage path does.

Useful? React with 👍 / 👎.

}

private func rebuildModel() {
let inputs = self.selectedRange == .allTime ? self.ledgerInputs : self.loadedInputs

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear ledger inputs when configured ownership disappears

When the user is viewing All Time and disables/removes every cost-capable source, the empty-configuration branch clears only loadedInputs; this line continues rebuilding from the old ledgerInputs. Because no subsequent load runs to filter the ledger by the new ownership map, the dashboard and share action can indefinitely expose spend rows from the now-disabled account/provider. The same stale data is shown transiently during ownership changes, so ledger inputs should be cleared or filtered synchronously with configuration invalidation.

Useful? React with 👍 / 👎.

@akshayprabhu200

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed the multi-provider All Time coverage finding in signed commit c81df54e.

The currency-group disclosure now counts the intersection of the actual persisted daily buckets across every provider, instead of taking the minimum of each provider's count. A focused regression fixture gives Codex and Claude different gaps and proves that only their shared day is reported as covered.

Local verification:

  • swift test --filter SpendDashboardModelTests — 36 tests passed
  • DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer make check — 0 violations across 1,850 Swift files

— Akshay / Codex

@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@akshayprabhu200

Copy link
Copy Markdown
Contributor Author

Fixed the failing macOS shard in signed commit 2b7a138b.

The only failure was an exact architecture-gate source-line anchor shifted by the new all-time coverage helper; production behavior was unaffected.

Verification: ProviderArchitectureGatekeeperTests — 38/38 passed locally.

@clawsweeper re-review

— Akshay / Codex

@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Aug 12, 2026
@akshayprabhu200

Copy link
Copy Markdown
Contributor Author

Addressed both ClawSweeper correctness findings in signed commit a5d6b90c:

  • disabling cost tracking or all providers now clears ledger-backed All Time rows immediately, including ownership invalidations;
  • persisted UTC coverage bounds are normalized through the display calendar before aggregation, preserving Mistral's first day in positive-offset time zones.

Focused proof:

  • disablement regression: 2/2 parameterized cases passed;
  • Asia/Kolkata Mistral regression passed;
  • make check: 0 violations across 1,852 Swift files.

I am preparing the requested isolated, redacted packaged-app record → restart → reload proof separately.

@clawsweeper re-review

— Akshay / Codex

@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 12, 2026
@akshayprabhu200

Copy link
Copy Markdown
Contributor Author

Fixed the final macOS shard gate in signed commit 988019b1.

Both exact allowlist anchors had shifted when the reviewed controller/model fixes added lines. No production behavior changed in this commit.

Verification: ProviderArchitectureGatekeeperTests — 38/38 passed locally.

— Akshay / Codex

@akshayprabhu200

Copy link
Copy Markdown
Contributor Author

Addressed the remaining failed-write finding in signed commit 0b4e5d0f.

The ledger now distinguishes the last durable document from an in-memory candidate. A failed atomic write returns and retains only the prior persisted history, so the UI cannot claim history that will vanish after restart.

Verification:

  • focused sources compile cleanly
  • regression covers returned, in-memory, on-disk, and process-style reloaded state after an injected write failure
  • SwiftFormat: 0 changes
  • SwiftLint: 0 violations across 1,852 files
  • git diff --check: clean

The local make check wrapper completed all formatting/lint gates, then macOS denied a cache .plist write; no source-quality check failed. The focused SwiftPM run compiled the scoped sources but the local Xcode toolchain stalled in final multi-target linking before test launch. GitHub CI is now running the authoritative clean build.

@clawsweeper re-review

— Akshay / Codex

@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@akshayprabhu200

Copy link
Copy Markdown
Contributor Author

Fixed the macOS shard failure in signed commit 027bbb1b.

Root cause: the parameterized All Time disablement test used UserDefaults.standard, persisted the All Time selection, and contaminated the following cached-presentation suite. Its actor wait also used scheduler yields rather than a bounded wall-clock interval. Both suites now use isolated preference domains, and the file-backed actor assertion has a 2-second bounded poll. Production code is unchanged.

Verification:

  • SpendDashboardAllTimeDisablementTests|SpendDashboardCachedPresentationTests — 6/6 passed locally
  • SwiftFormat — 0/2 files require formatting
  • git diff --check — clean

GitHub CI has restarted on the signed head.

— Akshay / Codex

@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 12, 2026
@akshayprabhu200

Copy link
Copy Markdown
Contributor Author

Fixed the remaining CI-only date fixture mismatch in signed commit 0111aec1.

The fixture instant was July 15 in Pacific time but July 16 on GitHub’s UTC runner. Because the test deliberately models a one-day complete window, CI correctly rejected its July 15 bucket. The fixture now uses noon UTC on July 15, which remains July 15 in both zones.

Verification:

  • affected suites — 6/6 passed locally
  • SwiftFormat — 0/2 files require formatting
  • git diff --check — clean

— Akshay / Codex

@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. and removed P2 Normal priority bug or improvement with limited blast radius. labels Aug 12, 2026
@akshayprabhu200

Copy link
Copy Markdown
Contributor Author

Exact-head packaged persistence proof is now attached in signed commits 392eb52c6 and af02d8fd8, and the PR body has been updated with the reproducible lifecycle and privacy controls.

The first packaged process records 30 covered days and exits. The second process uses the same executable SHA, opens the exact first-process ledger SHA, and renders 60 covered All Time days. The final dashboard and Share Stats images were inspected at original resolution: no PII, local paths, UUIDs, account labels, prompts, desktop context, or permission dialogs.

@clawsweeper re-review

— Akshay / Codex

@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@akshayprabhu200
akshayprabhu200 marked this pull request as ready for review August 13, 2026 04:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af02d8fd8f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

cacheReadTokens: entry?.cacheReadTokens ?? 0,
cacheCreationTokens: entry?.cacheCreationTokens ?? 0,
outputTokens: entry?.outputTokens ?? 0,
totalTokens: entry?.totalTokens ?? 0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve unknown tokens when writing ledger days

For cost-only sources such as OpenCode Go, daily entries legitimately contain a cost while totalTokens is nil; replacing that value with 0 makes the reconstructed ledger snapshot report a complete zero-token total. Selecting All Time then displays and shares 0 tracked tokens instead of leaving tokens unavailable, so absent token fields must remain unknown rather than being coerced to zero.

Useful? React with 👍 / 👎.

}

private func rebuildModel() {
let inputs = self.selectedRange == .allTime ? self.ledgerInputs : self.loadedInputs

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep ledger gaps unknown in the activity heatmap

When two recorded windows have a calendar gap, selecting All Time switches the 365-day token activity calculation to ledgerInputs. The ledger represents that gap by omitting its days but emits a snapshot whose historyDays spans from the first capture to the last and whose coverage is established; tokenActivityInputSummary consequently treats every omitted gap day as a proven zero. The heatmap therefore reports those unobserved days as covered inactivity, so token activity must retain discontinuous coverage or continue using the live/cache inputs.

Useful? React with 👍 / 👎.

@akshayprabhu200

Copy link
Copy Markdown
Contributor Author

Current-head CI failure fixed in signed commit 66fc06ae6.

The only failure was ProviderArchitectureGatekeeperTests: four intentionally Codex-scoped constructs in the DEBUG-only packaged proof lacked the repository-required inline design justification. Each cluster now carries a specific Provider-specific by design reason. Runtime behavior and the PII-free proof artifacts are unchanged.

Verification:

  • ProviderArchitectureGatekeeperTests: 38/38 passed
  • SwiftFormat: 0/1 files require formatting
  • git diff --check: passed

@clawsweeper re-review

— Akshay / Codex

@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 13, 2026
@akshayprabhu200

Copy link
Copy Markdown
Contributor Author

All three contributor-actionable findings are fixed in signed commits b57715b089a84aa7da:

  • persistence now stages a candidate, applies and verifies exact 0600, verifies the final destination, restores the prior verified document on failure, and secures broadened legacy files before decode;
  • priced cost-only days preserve unavailable token/request counters as nil across reload, while genuinely absent covered days remain explicit zeroes;
  • discontinuous All Time ledgers use only established live/cache activity, so uncaptured days remain unknown instead of false zero activity.

Focused verification:

  • ledger + proof-permission + architecture suites: 56/56 passed;
  • capture-gap regression: passed;
  • SwiftFormat and git diff --check: passed.

The hardened packaged verifier then passed two separate processes from executable head 63dc8594d, with identical executable SHA bdb2c5709bc791c01c954fa92a172da024a204a3974c0b126c1c4e805932b3d0. Both manifests are schema v2 and record ledgerPermissions: 0600; reload opens the record ledger SHA and renders 60 covered All Time days. Both original-resolution images were re-inspected and contain no PII, paths, identifiers, account labels, prompts, desktop context, or dialogs.

@clawsweeper re-review

— Akshay / Codex

@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed P1 Urgent regression or broken agent/channel workflow affecting real users now. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 13, 2026
@akshayprabhu200

Copy link
Copy Markdown
Contributor Author

Exact-head lint repair is pushed in signed commit 6255eb0af.

  • Cause: SpendDashboardControllerTests exceeded the SwiftLint 800-line type_body_length limit after adding the lifetime regressions.
  • Fix: moved three existing tests into a same-file extension; no production or proof behavior changed and no lint suppression was added.
  • Validation: strict SwiftLint passes; SwiftFormat and git diff --check pass; the moved disablement, range-persistence, and uncaptured-gap tests all pass.
  • Proof remains exact for the unchanged production implementation and contains no PII.

Please re-review the current head.

— Akshay / Codex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant