Skip to content

Add DeepSeek rolling usage metrics - #2894

Draft
kyoubelyu wants to merge 1 commit into
steipete:mainfrom
kyoubelyu:agent/add-deepseek-rolling-usage
Draft

Add DeepSeek rolling usage metrics#2894
kyoubelyu wants to merge 1 commit into
steipete:mainfrom
kyoubelyu:agent/add-deepseek-rolling-usage

Conversation

@kyoubelyu

@kyoubelyu kyoubelyu commented Aug 13, 2026

Copy link
Copy Markdown

Summary

  • add rolling 5-hour and 7-day DeepSeek token totals
  • add rolling 5-hour and 7-day DeepSeek spend totals
  • reuse the existing DeepSeek Platform session, declarative detail rows, and optional-usage gating
  • keep rolling dashboard endpoint failures isolated from existing monthly usage details
  • document the balance, monthly usage, and rolling usage request flow

Implementation notes

DeepSeek's documented public API exposes account balance, but not rolling usage windows. The additional totals use the private Platform dashboard's usage/by_api_key/amount and usage/by_api_key/cost endpoints with exact Unix timestamp ranges. Responses are aggregated across API keys, models, and time buckets.

These values are absolute rolling totals. DeepSeek does not provide quota denominators or reset timestamps, so they are intentionally rendered as detail rows rather than percentage-based rate-limit bars.

The four rolling requests run concurrently and have their own bounded join. Missing, failed, or slow rolling responses degrade independently and do not discard the existing monthly detail response.

Tests

  • swift test --filter DeepSeek — passed (121 tests; one screenshot proof skipped unless its output directory is configured)
  • make check — passed (0 SwiftLint violations in 1,848 files)
  • make test — 60 groups passed; the StatusMenuTests group failed on merged data tick keeps row count and card views stable (menu.items.count 18 vs. 16). The same failure reproduces in an isolated rerun with only Codex and Claude enabled; it does not exercise DeepSeek code.

@clawsweeper

clawsweeper Bot commented Aug 13, 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. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. 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 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed August 12, 2026, 11:07 PM ET / August 13, 2026, 03:07 UTC.

ClawSweeper review

What this changes

The PR adds optional five-hour and seven-day DeepSeek token and spend totals using private Platform dashboard usage endpoints.

Merge readiness

Blocked until real behavior proof from a real setup is added - 5 items remain

Keep this draft PR open: it introduces a real multi-currency display defect and lacks after-fix proof from a DeepSeek Platform session.

Priority: P3
Reviewed head: 88aea4f17d0d7d49901f8d6a311b9f24113e4fdf
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has focused parser and menu tests, but a correctness defect and missing real-session proof keep it below merge-ready.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The reported tests are useful supplemental evidence, but no after-fix run against a real DeepSeek Platform session shows the new rolling values or failure isolation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The reported tests are useful supplemental evidence, but no after-fix run against a real DeepSeek Platform session shows the new rolling values or failure isolation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Current main does not provide rolling windows: Current documentation says DeepSeek has no session or weekly window; the proposed rolling behavior is not already implemented on main.
Currency is dropped before display: The rolling parser returns a currency, but production passes no preferred currency and the summary retains only spend doubles; the renderer formats those values with the monthly summary currency.
Documented currency contract: Current DeepSeek documentation says USD is preferred when multiple currencies are present, while the rolling parser falls back to the first group when called with nil.
Findings 1 actionable finding [P2] Preserve the currency of rolling spend values
Security None None.

How this fits together

CodexBar’s DeepSeek provider combines a Platform session with monthly usage data to render detail rows in the menu bar. This PR adds four rolling-window requests, aggregates their responses, and sends the resulting totals to the same detail-row renderer.

flowchart LR
A[DeepSeek Platform session] --> B[Monthly usage requests]
A --> C[Rolling usage requests]
B --> D[Monthly usage summary]
C --> E[Rolling usage parser]
D --> F[Menu detail rows]
E --> F
F --> G[CodexBar menu]
Loading

Decision needed

Question Recommendation
Should CodexBar support rolling usage totals from DeepSeek’s undocumented by-API-key dashboard endpoints once the currency behavior and live proof are corrected? Sponsor the rolling metrics: Accept the private-endpoint dependency after the PR preserves currency semantics and demonstrates a redacted live result.

Why: The endpoints are a new user-visible dependency on a private dashboard contract, so correctness alone cannot establish whether this provider surface should be maintained.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The reported tests are useful supplemental evidence, but no after-fix run against a real DeepSeek Platform session shows the new rolling values or failure isolation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Preserve the currency of rolling spend values (P2) - The rolling parser may select a currency group, but this call supplies nil; its currency is then discarded by the summary and both values are formatted with the monthly summary’s currency. A response whose rolling and monthly selections differ will therefore show a mislabeled spend total. Carry the selected currency through to rendering, or explicitly select the monthly currency, and cover that case.
  • Resolve merge risk (P1) - Rolling spend can be shown with the monthly currency symbol even when the rolling endpoint selected a different currency group.
  • Resolve merge risk (P1) - The new metrics rely on undocumented Platform dashboard endpoints; their live schema and availability need redacted after-fix evidence before merge.

Findings

  • [P2] Preserve the currency of rolling spend values — Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:725-733
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Implementation and coverage size production +454/-1, tests +150, docs +16/-6 across 7 files The provider-only feature adds four authenticated requests and a new parser, making live endpoint proof particularly important.

Merge-risk options

Maintainer options:

  1. Preserve rolling spend currency before merge (recommended)
    Carry or explicitly select the same currency used for each rolling cost value and cover a response containing multiple currency groups.
  2. Accept first-group currency behavior
    Maintain the current implementation only if maintainers explicitly accept that rolling spend may not follow the documented preferred-currency behavior.

Technical review

Best possible solution:

Preserve one explicit currency contract for rolling and monthly spend, add multi-currency regression coverage, then attach redacted live menu or terminal proof from a real Platform session.

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

Yes for the currency defect: the parser accepts multiple currency groups, production passes it no preference, and the renderer uses the separate monthly currency field.

Is this the best way to solve the issue?

No: the current path loses each rolling result’s currency before display; retaining or explicitly selecting that currency is the narrower safe solution.

Full review comments:

  • [P2] Preserve the currency of rolling spend values — Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:725-733
    The rolling parser may select a currency group, but this call supplies nil; its currency is then discarded by the summary and both values are formatted with the monthly summary’s currency. A response whose rolling and monthly selections differ will therefore show a mislabeled spend total. Carry the selected currency through to rendering, or explicitly select the monthly currency, and cover that case.
    Confidence: 0.93

Overall correctness: patch is incorrect
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is an optional provider-metric feature with no evidence of an urgent current-user regression.
  • add merge-risk: 🚨 compatibility: The new rolling spend values can be labeled with a currency sourced from a different response.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The reported tests are useful supplemental evidence, but no after-fix run against a real DeepSeek Platform session shows the new rolling values or failure isolation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P3: This is an optional provider-metric feature with no evidence of an urgent current-user regression.
  • merge-risk: 🚨 compatibility: The new rolling spend values can be labeled with a currency sourced from a different response.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The reported tests are useful supplemental evidence, but no after-fix run against a real DeepSeek Platform session shows the new rolling values or failure isolation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Current main does not provide rolling windows: Current documentation says DeepSeek has no session or weekly window; the proposed rolling behavior is not already implemented on main. (docs/deepseek.md:76, 208016687098)
  • Currency is dropped before display: The rolling parser returns a currency, but production passes no preferred currency and the summary retains only spend doubles; the renderer formats those values with the monthly summary currency. (Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:729, 88aea4f17d0d)
  • Documented currency contract: Current DeepSeek documentation says USD is preferred when multiple currencies are present, while the rolling parser falls back to the first group when called with nil. (docs/deepseek.md:74, 208016687098)
  • Feature-history routing: DeepSeek usage summaries and bounded optional enrichment were introduced and subsequently maintained in this path by Peter Steinberger; Trim introduced browser-only usage support. (Sources/CodexBarCore/Providers/DeepSeek, 92598f8d5640)
  • No real behavior proof supplied: The PR body reports parser/unit tests and checks, but contains no redacted after-fix Platform-session output, recording, or menu capture. (88aea4f17d0d)

Likely related people:

  • Peter Steinberger: Introduced DeepSeek usage summaries and repeatedly maintained the provider’s optional-enrichment and session behavior. (role: feature owner and recent area contributor; confidence: high; commits: 92598f8d5640, fe210acb57da, 0f7731294ea4; files: Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift, Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift)
  • Trim: Authored the earlier browser-only DeepSeek usage implementation that this PR extends through the Platform-session path. (role: introduced browser-only usage support; confidence: medium; commits: f27decf35fab, d1a53d49668a; files: Sources/CodexBarCore/Providers/DeepSeek)

Rank-up moves

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

  • Preserve or explicitly select rolling-cost currency and add a multi-currency regression test.
  • Attach redacted after-fix proof from a real Platform session; redact API keys, account details, and private endpoints.

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.

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. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant