DeepSeek: add web-session usage and cost summary#1166
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 26a4ffed37
ℹ️ 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".
| // Try to fetch usage summary, but don't fail if it errors - balance display takes priority | ||
| var usageSnapshot = usage | ||
| do { | ||
| let usageSummary = try await DeepSeekUsageFetcher.fetchUsageSummary(apiKey: apiKey) |
There was a problem hiding this comment.
Return balance result without awaiting optional summary
The summary fetch is optional, but this await makes the whole DeepSeek fetch path block on two extra network calls before returning any result. Because fetchUsageSummary performs fetchAmount and fetchCost sequentially and each request uses a 15s timeout, a slow or degraded platform.deepseek.com can delay a successful balance response by up to ~30s, which contradicts the stated “balance display takes priority” behavior and makes the provider appear hung.
Useful? React with 👍 / 👎.
| let summary = try DeepSeekUsageFetcher._parseUsageSummaryForTesting( | ||
| amountData: Data(amountJSON.utf8), | ||
| costData: Data(costJSON.utf8)) |
There was a problem hiding this comment.
Make date-sensitive DeepSeek aggregation tests deterministic
These assertions depend on today matching the fixture date (2026-05-26), but the test call does not inject a fixed clock, so parsing uses Date() and will fail as soon as the real date changes. This introduces a time-based CI failure that is unrelated to code correctness; pass an explicit now/calendar into the parser path used by this test.
Useful? React with 👍 / 👎.
26a4ffe to
c0651d9
Compare
|
Codex review: needs real behavior proof before merge. Reviewed May 26, 2026, 1:33 PM ET / 17:33 UTC. Summary Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge Review detailsBest possible solution: Retry the Codex review after fixing the execution failure. Do we have a high-confidence way to reproduce the issue? Unclear. The review failed before ClawSweeper could establish a reproduction path. Is this the best way to solve the issue? Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model gpt-5.5, reasoning high; reviewed against 8fccb454acbb. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
7e3fc62 to
e4570be
Compare
e4570be to
6ec5719
Compare
Summary
Add a DeepSeek web-session usage/cost summary alongside the existing DeepSeek balance display.
This uses the DeepSeek dashboard endpoints observed from the web console:
https://platform.deepseek.com/api/v0/usage/amount?month=<month>&year=<year>https://platform.deepseek.com/api/v0/usage/cost?month=<month>&year=<year>The existing balance endpoint remains unchanged on
https://api.deepseek.com/user/balance.What changed
Safety
x-ds-trace-id, account IDs, emails, or raw credential material.Testing
swift build— passedswift test --filter "DeepSeekUsageCostParserTests"— passedswift test --filter "DeepSeekUsageFetcherTests"— passedswift test --filter "MiniMax"— passedswift test— passed, 2956 tests./Scripts/lint.sh lint— passed, 0 violations