Skip to content

fix: support amp subscription usage - #2438

Merged
steipete merged 5 commits into
steipete:mainfrom
tylergibbs1:agent/amp-subscription-parser
Jul 28, 2026
Merged

fix: support amp subscription usage#2438
steipete merged 5 commits into
steipete:mainfrom
tylergibbs1:agent/amp-subscription-parser

Conversation

@tylergibbs1

@tylergibbs1 tylergibbs1 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

summary

  • parse the subscription output used by Megawatt and other Amp plans
  • expose the other and orb pools as separate monthly usage windows with renewal metadata
  • preserve the plan name and use accurate labels in the menu, CLI, widget, and dashboard
  • keep the existing Amp Free and credit-balance paths unchanged

verification

  • swift test --filter AmpUsageParserTests (18 passed)
  • swift test --filter ProviderPaceCapabilityTests (2 passed)
  • swift test --filter UsageStoreCoverageTests (33 passed)
  • swift test --filter CLIOutputTests (10 passed)
  • swift test --filter DashboardSnapshotBuilderTests (10 passed)
  • make check
  • full make test reaches unrelated existing SpendDashboardTokenProvenanceTests failures

The compatibility coverage explicitly verifies that Amp Free keeps its Amp Free label and receives no monthly pace, credit-only output keeps no rate windows or subscription labels, and only subscription sentinel windows opt into monthly pace.

live subscription proof

Confirmed by the original reporter on a real Megawatt subscription account in a redacted branch-built CLI transcript. The run successfully parsed both monthly usage pools, showed their renewal timing, and preserved the Megawatt plan. The reporter tested on macOS 26.5.1 with Swift 6.3.3 and the current Amp CLI.

Fixes #2435

@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: cb5f89b324

ℹ️ 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 thread Sources/CodexBarCore/Providers/Amp/AmpUsageParser.swift Outdated
@clawsweeper clawsweeper Bot added 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. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Jul 24, 2026
@clawsweeper

clawsweeper Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed July 28, 2026, 12:37 PM ET / 16:37 UTC.

ClawSweeper review

What this changes

The PR parses Amp subscription-plan CLI output and presents its Other and Orb usage pools with renewal timing across the menu bar, widget, CLI, dashboard, and quota warnings while retaining Amp Free and credit-balance behavior.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep this PR open for normal maintainer review. The current rebased head addresses the earlier parser, presentation, dashboard, and quota-warning review concerns, and it includes credible real-account CLI proof; the remaining decision is whether the provider-specific dashboard window kinds and subscription-only pace behavior are acceptable compatibility changes.

Priority: P2
Reviewed head: a0dda690aadc4813a4b269fb36313d88e07c27b4

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The PR has direct real-account proof, resolves all prior findings, and adds broad focused regression coverage for its provider-specific behavior.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): A redacted real Megawatt subscription CLI transcript shows the branch parsing both usage pools, showing renewal timing, and preserving the plan name after the fix.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): A redacted real Megawatt subscription CLI transcript shows the branch parsing both usage pools, showing renewal timing, and preserving the plan name after the fix.
Evidence reviewed 5 items Subscription parsing and normalized usage: The PR head adds a subscription-output pattern, converts Other and Orb remaining percentages into two renewal-based usage windows, and preserves the subscription plan in Amp usage metadata.
Existing Amp behavior is explicitly covered: Focused tests preserve the Amp Free label and no-pace behavior while separately testing subscription labels, renewal windows, plan identity, and optional trailing settings links.
All user-facing projections are covered: The rebased PR adds coverage for CLI labels, dashboard window kinds and labels, provider pace eligibility, menu-card metrics, and quota-warning labels; this incorporates each prior review finding.
Findings None None.
Security None None.

How this fits together

CodexBar obtains Amp account usage from CLI, API, or web strategies and normalizes it into provider usage snapshots. Those snapshots feed labels, pacing, menu and widget metrics, CLI output, dashboard JSON, notifications, and quota-low hooks.

flowchart LR
    A[Amp CLI usage text] --> B[Amp usage parser]
    B --> C[Normalized usage snapshot]
    C --> D[Provider labels and pace rules]
    D --> E[Menu, widget, and CLI output]
    C --> F[Dashboard JSON]
    C --> G[Quota warnings and hooks]
Loading

Before merge

  • Resolve merge risk (P1) - The PR emits other and orb dashboard window kinds and enables calendar-month pace only for subscription sentinel windows; maintainers should confirm those values are acceptable to any dashboard JSON consumers before merge.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Changed surface 10 source files, 6 test files affected The change intentionally carries one new Amp usage shape through every user-visible projection and adds focused regression coverage for each path.
Patch size 368 added, 23 removed Most of the patch is targeted tests and presentation plumbing rather than unrelated restructuring.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #2435
Summary: This PR is the active candidate fix for the reported Amp subscription parsing failure.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Confirm the dashboard contract (recommended)
    Before merging, verify that dashboard JSON consumers accept the new other and orb kinds; otherwise retain generic kinds and use the provider-specific labels for display.
  2. Accept the scoped schema extension
    Merge the provider-specific kinds if maintainers consider dashboard window kinds extensible and subscription snapshots were previously unavailable.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Verify dashboard JSON consumers accept Amp subscription window kinds `other` and `orb`; if not, preserve generic kinds while keeping the new display labels and regression coverage.

Technical review

Best possible solution:

Merge the focused parser and presentation support after confirming dashboard consumers accept the new provider-specific window kinds; retain generic Amp Free and credit-balance behavior unchanged.

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

Yes. The linked report provides a concrete subscription CLI line and a fake-CLI reproduction of the current parser failure, while a real Megawatt account transcript confirms the proposed branch parses the same behavior after the fix.

Is this the best way to solve the issue?

Yes, with a final dashboard-contract check. Parsing the only currently available text output and normalizing it as two renewal windows is the narrowest maintainable path, while preserving the existing free-tier and credit paths.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This repairs paid Amp subscription usage reporting for affected accounts, with a bounded provider-specific blast radius.
  • merge-risk: 🚨 compatibility: The PR changes dashboard JSON window kinds and pace eligibility semantics for the newly supported subscription usage shape.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): A redacted real Megawatt subscription CLI transcript shows the branch parsing both usage pools, showing renewal timing, and preserving the plan name after the fix.
  • proof: sufficient: Contributor real behavior proof is sufficient. A redacted real Megawatt subscription CLI transcript shows the branch parsing both usage pools, showing renewal timing, and preserving the plan name after the fix.

Evidence

What I checked:

  • Subscription parsing and normalized usage: The PR head adds a subscription-output pattern, converts Other and Orb remaining percentages into two renewal-based usage windows, and preserves the subscription plan in Amp usage metadata. (Sources/CodexBarCore/Providers/Amp/AmpUsageParser.swift:34, a0dda690aadc)
  • Existing Amp behavior is explicitly covered: Focused tests preserve the Amp Free label and no-pace behavior while separately testing subscription labels, renewal windows, plan identity, and optional trailing settings links. (Tests/CodexBarTests/AmpUsageParserTests.swift:85, a0dda690aadc)
  • All user-facing projections are covered: The rebased PR adds coverage for CLI labels, dashboard window kinds and labels, provider pace eligibility, menu-card metrics, and quota-warning labels; this incorporates each prior review finding. (Tests/CodexBarTests/UsageStoreSessionQuotaTransitionTests.swift:664, a0dda690aadc)
  • Real subscription proof: A reporter ran the branch against a real Megawatt account and posted a redacted CLI transcript showing separate Other and Orb windows, renewal timing, and the preserved Megawatt plan.
  • Review continuity: Earlier review comments identified linked subscription rows, incorrect CLI/dashboard labels, and generic quota-warning labels; the current head includes targeted fixes and regression coverage for all three. (Sources/CodexBar/UsageStore+QuotaWarnings.swift:77, a0dda690aadc)

Likely related people:

  • steipete: The repository owner is the best available routing candidate for the remaining compatibility decision; local history inspection was unavailable in this read-only environment. (role: likely final reviewer; confidence: low; files: Sources/CodexBarCore/Providers/Amp/AmpUsageParser.swift, Sources/CodexBarCLI/DashboardSnapshotBuilder.swift)
  • diegomrv: Reported the subscription-output failure and supplied the redacted Megawatt-account after-fix CLI proof used to validate the intended behavior. (role: real-world behavior verifier; confidence: high; files: Sources/CodexBarCore/Providers/Amp/AmpUsageParser.swift)

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 (2 earlier review cycles)
  • reviewed 2026-07-24T14:31:34.556Z sha 0cae2ff :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-28T04:41:00.295Z sha 71e20e3 :: needs maintainer review before merge. :: none

@tylergibbs1

Copy link
Copy Markdown
Contributor Author

@diegomrv, could you help close the live-proof gate by running this PR from your Amp subscription setup and posting a redacted transcript?

git fetch https://github.com/tylergibbs1/CodexBar.git agent/amp-subscription-parser
git worktree add /tmp/codexbar-amp-proof FETCH_HEAD
cd /tmp/codexbar-amp-proof
swift run CodexBarCLI usage --provider amp --source cli --no-color

Please redact the account email and exact percentages if preferred; the important evidence is that the command succeeds and shows the Megawatt plan with Other usage and Orb usage instead of a parse error.

I addressed the compatibility concern in 68aab85d4: Amp Free retains its existing label and no monthly pace, credit-only output retains no rate windows/subscription labels, and only subscription windows receive monthly pace. All 18 Amp parser tests, 2 pace-capability tests, and 33 usage-store coverage tests pass; make check also passes.

@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: 68aab85d41

ℹ️ 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 thread Sources/CodexBarCore/Providers/Amp/AmpUsageSnapshot.swift
@diegomrv

Copy link
Copy Markdown

Confirmed working on my Megawatt subscription. 🎉

Built your branch (agent/amp-subscription-parser) and ran it against my real Amp account:

git clone --branch agent/amp-subscription-parser https://github.com/tylergibbs1/CodexBar.git
cd CodexBar
swift run CodexBarCLI usage --provider amp --source cli --no-color

Output (email + percentages redacted):

== Amp (cli) ==
Other usage: NN% left [============]
Resets in 29d
Orb usage: NN% left [============]
Resets in 29d
Account: <redacted>
Plan: Megawatt

Parses cleanly now. Plan name (Megawatt) is preserved, both pools show up as separate windows (Other usage / Orb usage) with the renewal reset, and no more Could not parse Amp usage: Missing Amp usage data.

For reference, same account on 0.45.2 gave:

Error: No Amp session cookie found. Please log in to ampcode.com in your browser.

Env: macOS 26.5.1 (Apple Silicon), Swift 6.3.3, amp CLI 0.0.1784902288-g0b2dc4. Thanks for the quick fix!

@tylergibbs1

Copy link
Copy Markdown
Contributor Author

Live subscription proof is now available from the original reporter and linked in the PR body: #2438 (comment)

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 24, 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 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. and removed 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 Jul 28, 2026
@tylergibbs1
tylergibbs1 force-pushed the agent/amp-subscription-parser branch from 71e20e3 to 3050ef3 Compare July 28, 2026 15:39
@tylergibbs1

tylergibbs1 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and resolved the ProviderPaceCapabilityTests overlap by preserving the new Kimi weekly mapping alongside Amp’s subscription-only monthly mapping. The branch is conflict-free again at 3050ef3e.

Verification:

  • make check — passed (SwiftFormat + SwiftLint, 0 violations)
  • focused affected suites — 73 tests passed
  • make test — all 724 selections passed across 61/61 shards, with no retries or timeouts

GitGuardian is running on the rebased head. The GitHub Actions CI run is currently action_required and needs maintainer approval.

@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: 3050ef3e6c

ℹ️ 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 thread Sources/CodexBarCore/Providers/Amp/AmpUsageSnapshot.swift
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 28, 2026
@steipete

Copy link
Copy Markdown
Owner

Merged after full verification. Amp subscription plans (e.g. Megawatt) now parse: the Other and Orb pools render as monthly-reset windows with plan labels preserved across menu, CLI, widget, and dashboard; Amp Free and credit-only behavior is unchanged by tests. Exact-head CI: all nine checks green (https://github.com/steipete/CodexBar/actions/runs/30329327706, shard 0 green on rerun after infra DNS timeouts). Review + autoreview clean. Thanks @tylergibbs1!

@steipete

Copy link
Copy Markdown
Owner

Correction: the previous comment fired while the branch was being updated — the merge was blocked by our head-verification guard and has NOT happened yet. The new head (main catch-up + the Amp label fixes) is being re-reviewed and re-verified on CI now; #2435 has been reopened until this actually lands. Apologies for the noise.

@steipete
steipete merged commit e1f91ba into steipete:main Jul 28, 2026
9 checks passed
@steipete

Copy link
Copy Markdown
Owner

Now actually merged ✅ — final head a0dda690 verified: the delta since the earlier review was upstream main catch-up plus the Amp label/warning fixes and behavior-preservation tests, all reviewed clean; exact-head CI fully green (https://github.com/steipete/CodexBar/actions/runs/30378787440). Thanks @tylergibbs1!

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. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.

Amp: subscription plans (Megawatt) fail to parse; misleading "No Amp session cookie found" error hides a CLI parse failure

3 participants