fix(spend): notify shared dashboard on independent token pubs - #3101
fix(spend): notify shared dashboard on independent token pubs#3101Yuxin-Qiao wants to merge 1 commit into
Conversation
Independent spend-dashboard providers (Claude/Cursor/etc, usesSpendDashboardIndependentTokenSnapshot) published to spendDashboardTokenPublications but never triggered sharedSpendDashboardController update, so background token refreshes completed without updating the Usage & Spend pane or Overview spend until the next config change or pane re-open. Add synchronizeSharedSpendDashboardAfterTokenPublication call in publishSpendDashboardTokenSnapshotState and widen guard to include independent providers, matching the Codex path that already drove the shared dashboard. Background token cost imports now silently refresh the shared publication.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 20, 2026, 6:12 AM ET / 10:12 UTC. ClawSweeper reviewWhat this changesThe PR makes independent provider token-cost publications refresh CodexBar’s shared Usage & Spend dashboard and Overview spend state. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 5 items remain Keep open: the PR fixes the current-main notification gap, but it misses the matching snapshot-clear transition, so a failed independent refresh can still leave stale spend visible. It also needs after-fix real behavior proof before merge. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherIndependent provider refreshes publish token-cost snapshots into the spend dashboard’s shared source state. The shared controller turns that state into the Usage & Spend pane and Overview spend summary. flowchart LR
A[Provider token refresh] --> B[Independent token snapshot]
B --> C[Shared dashboard synchronization]
C --> D[Dashboard controller]
D --> E[Usage and Spend pane]
D --> F[Overview spend]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Notify the shared dashboard for both publication and removal of independent snapshots, cover both transitions with a focused regression test, and attach redacted after-fix runtime evidence. Do we have a high-confidence way to reproduce the issue? Yes—source inspection shows an independent snapshot publication changes shared source revisions only after this branch’s added call, while the corresponding clear path still emits no shared update. Is this the best way to solve the issue? Mostly, but not yet: publication synchronization is the narrow maintainable fix, and it must include invalidation so success and failure transitions have consistent dashboard state. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a3457dafbe63. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Superseded by larger silent-refresh PR |
Independent spend-dashboard providers (
usesSpendDashboardIndependentTokenSnapshot— Claude/Cursor/OpenCodex/etc) published tospendDashboardTokenPublicationsbutpublishSpendDashboardTokenSnapshotState:171never calledsynchronizeSharedSpendDashboardAfterTokenPublication, and the sync itself gated onprovider == .codex(UsageStore+SpendDashboardPublication.swift:64).Result: background
refreshSpendDashboardTokenUsageNowcompletions didn't update the sharedSpendDashboardControllerpublication, so the Usage & Spend pane and Overview spend stayed stale until next config change or pane re-open — the "won't auto refresh silently" symptom.Fix
UsageStore+SpendDashboardPublication.swift:64widen guard toprovider == .codex || isIndependentUsageStore+SpendDashboardTokenCost.swift:171callsynchronizeSharedSpendDashboardAfterTokenPublicationafter publishingBackground imports now drive the shared dashboard like the Codex path already did.
Verified:
swiftformat+swiftlint --strictclean,SpendDashboardPublicationTestscovers shared ownership.