Repository navigation
Conversation
Enterprise-paid Amp workspaces report no balance, so the parser failed with "Missing Amp usage data". Parse them, and feed the shared cost-history chart and inline menu card with per-day recorded cost, tokens, and models from `amp usage --details`.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d019bba3e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| sessionTokens: today?.totalTokens ?? 0, | ||
| sessionCostUSD: today?.costUSD ?? 0, |
There was a problem hiding this comment.
Preserve unknown values when today's Amp query fails
When today's per-day amp usage --details call times out or fails, recentUsage omits that day and sets dailyUsageIsPartial, but these fallbacks still publish exact zeroes for today's tokens and cost. The new inline Amp dashboard consumes the session fields directly, so it reports 0 / $0.00 instead of an unknown value even though today's bucket was never read; keep these fields nil when the relevant day is missing from a partial scan.
Useful? React with 👍 / 👎.
|
|
||
| public init() { | ||
| self.arguments = ["usage"] | ||
| self.calendar = .current |
There was a problem hiding this comment.
Use the configured statistics zone for Amp buckets
When the user selects a Statistics time zone different from the Mac's current zone, or travels after the zone was pinned, this hard-coded .current makes Amp's query bounds and day keys use the Mac zone while UsageStore and Usage & Spend interpret those keys with settings.costUsageBucketCalendar. Midnight-adjacent usage is then assigned to the wrong configured day and can cross a reporting-period boundary, so the configured bucket calendar needs to be threaded into the probe.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. What this changesThis PR recognizes enterprise-paid Amp workspaces and adds CLI-derived daily cost, token, and model history to existing spend displays. Example: Amp returns
Review scores
ProductKind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep open: enterprise-only accounts expose a real parser gap, but this PR introduces two reporting defects and its broader history feature needs owner direction. Priority: P2 Decision needed
Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Amp provider reads CLI or API display text, parses account usage, and projects snapshots into shared menu and spend models. flowchart TD
A[Amp fetch strategy] --> B[Amp CLI usage]
B --> C[Usage parser]
C --> D[Enterprise snapshot]
D --> E[Daily detail queries and memory cache]
E --> F[Shared cost snapshot]
F --> G[Menu and Usage Spend]
Technical reviewBest possible solution: Preserve enterprise recognition and, if history is approved, use the configured statistics calendar and retain unknown values for unread days. Do we have a high-confidence way to reproduce the issue? Main's parser deterministically rejects enterprise-only output because it requires a recognized quota or balance; this was verified from source without executing target code. Is this the best way to solve the issue? Enterprise recognition fits the existing parser and detail-row owners; the history implementation reuses shared displays but currently violates unknown-value and statistics-calendar semantics. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1f6da9bec444. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 19, 2026, 11:25 AM ET / 16:25 UTC. |
Summary
Amp accounts whose usage is paid by an enterprise workspace report no balance or quota, only a line like
Workspace <name>: usage paid by your enterprise. The parser rejected that output with "Missing Amp usage data", so Amp showed nothing for these accounts.Workspace <name>row under Credits.amp usage --details: 30-day recorded cost and tokens, plus per-day cost, tokens, cache split, and per-model breakdowns.How it works
amp usage --detailsonly reports tokens and models for the whole requested range; its daily table has cost only. So the probe runs one 30-day query, then one single-day query per day that had spend, up to eight at a time in a drained task group. Days that ended more than six hours ago are cached in memory for the life of the process. A failed day query drops that day and marks the history partial; a failed 30-day query leaves the account loaded without history.Costs are labelled "Recorded cost reported by Amp" and carry
vendorMeteredprovenance, since they are billed amounts and not estimates. Days are bucketed by the local calendar.Trade-offs
Testing
swift test --filter 'InlineCostHistoryDashboardLabelTests|AmpUsageParserTests|SpendDashboardModelTests|MenuCardModelTests|AmpTierMenuRegressionTests': 229 tests pass.ampscript (daily tokens/cost/models, partial history, details failure), local-day overlap, and the Amp inline dashboard tiles.Not run:
make check(SwiftFormat/SwiftLint are not installed on this machine) and the full suite. Leaving both to CI.