Skip to content

Surface Devin overage balance as extra usage#1893

Merged
steipete merged 10 commits into
steipete:mainfrom
FNDEVVE:feat/devin-extra-usage
Jul 5, 2026
Merged

Surface Devin overage balance as extra usage#1893
steipete merged 10 commits into
steipete:mainfrom
FNDEVVE:feat/devin-extra-usage

Conversation

@FNDEVVE

@FNDEVVE FNDEVVE commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Surfaces Devin's remaining prepaid extra-usage balance across the app menu, CLI, and widgets. The implementation reuses CodexBar's balance-only cost model while keeping provider data isolated and respecting the existing optional credits/extra-usage visibility setting.

Improvements made during review

  • Rejects negative and non-finite dollar or cents balances instead of rendering invalid money values.
  • Prevents another provider's balance snapshot from appearing as Devin extra usage.
  • Persists Devin balance into widget snapshots only when optional credits and extra usage are enabled.
  • Adds Devin to widget provider selection and renders the balance in both regular and compact widget layouts.
  • Keeps the CLI output provider-specific, so Factory's equivalent balance model cannot leak into Devin output.

Changes

  • Parse and normalize Devin overage_balance, with overage_balance_cents as a fallback.
  • Map a valid value to a USD balance-only ProviderCostSnapshot.
  • Render Devin extra usage in menu-card and menu-entry surfaces.
  • Support Devin in widget configuration, snapshots, and compact/expanded views.
  • Render Extra usage in Devin CLI output.
  • Add focused parser, CLI, widget-provider, snapshot-visibility, compact-rendering, and provider-isolation coverage.

Current diff: 13 files, +406/-20.

Verification

  • make check: passed; SwiftFormat clean and SwiftLint reported 0 violations.
  • Focused suite: 147 tests passed across DevinUsageFetcherTests, CodexBarWidgetProviderTests, CLISnapshotTests, UsageStoreWidgetSnapshotTests, and the main-merge UsageFormatterTests.
  • Autoreview: no accepted or actionable findings remain after the provider-isolation, visibility, and compact-widget fixes.
  • Contributor live proof against an authenticated Devin account showed Extra usage: $48.00.
  • Full make test: all 47 shards passed; the subprocess suite's built-in retry passed cleanly.
  • Exact-head CI: 10/10 checks passed on f3bbc4ca after maintainer workflow approval.
  • Fresh signed app and widget bundle: packaged successfully with the supported extended widget-build timeout, launched, and opened on screen from the exact head.
  • A bounded local Devin web probe completed without hanging but rejected the machine's imported session as invalid, so no local authenticated balance claim is made; the authenticated balance proof below is the contributor's.
Devin menu showing an Extra usage balance

Notes

  • The row is omitted when Devin does not return a valid overage balance.
  • A balance-only snapshot does not activate the menu-bar extra-usage percentage metric because no spending limit is available.

@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed July 4, 2026, 10:35 PM ET / 02:35 UTC.

Summary
The branch parses Devin overage balance into a balance-only ProviderCostSnapshot and surfaces it in the menu, CLI, and widgets with focused parser, CLI, widget, and visibility tests.

Reproducibility: not applicable. as a feature PR rather than a bug report. Source inspection, tests, and screenshot proof show the new Devin balance path instead of a failing current-main behavior.

Review metrics: 2 noteworthy metrics.

  • Changed surface: 13 files, +406/-20. The PR spans parser, app menu, provider menu, CLI, widget model/views, and tests, so cross-surface behavior matters before merge.
  • Widget model shape: 1 optional field added. ProviderEntry now carries providerCost, which is backward-compatible as an optional field but relevant to privacy and widget persistence review.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Confirm the existing optional credits/extra-usage setting is accepted as the privacy gate for Devin widget balances.
  • Use full make test, fresh-bundle runtime proof, or exact-head CI as the final merge gate.

Risk before merge

  • [P1] The PR intentionally stores and displays Devin balance-like data in widget snapshots when the existing optional credits/extra-usage setting is enabled, so maintainers should explicitly accept that privacy boundary.
  • [P1] The PR body says full make test, fresh-bundle runtime proof, and exact-head CI were still being rerun; only GitGuardian was visible in the inspected status rollup.

Maintainer options:

  1. Accept the gated balance surface (recommended)
    Merge after confirming the existing optional credits/extra-usage setting is the right privacy gate for Devin menu, CLI, and widget balance display.
  2. Hold for a separate privacy gate
    Pause the PR if maintainers want Devin widget balances to require a Devin-specific setting or clearer user-facing consent before being persisted to widget snapshots.

Next step before merge

  • No automated repair is needed; maintainers should decide the privacy/product acceptance point and finish normal exact-head validation.

Security
Cleared: No dependency, CI, secret-handling, or concrete data-leak defect remains in the inspected diff; the sensitive balance display is gated by the existing optional extra-usage setting.

Review details

Best possible solution:

Land this ProviderCostSnapshot-based implementation if maintainers accept the existing optional credits/extra-usage setting as the consent boundary for Devin balances, with full exact-head validation before merge.

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

Not applicable as a feature PR rather than a bug report. Source inspection, tests, and screenshot proof show the new Devin balance path instead of a failing current-main behavior.

Is this the best way to solve the issue?

Yes, conditionally: reusing ProviderCostSnapshot and the existing optional extra-usage visibility setting is the narrowest maintainable implementation if maintainers accept that privacy boundary.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Screenshot proof shows the changed Devin menu rendering an Extra usage balance row in a real app surface after the change.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review merge-risk labels are merge-risk: 🚨 security-boundary.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded provider-surface improvement with limited blast radius but enough UI/widget/privacy surface to merit normal maintainer review.
  • merge-risk: 🚨 security-boundary: The PR adds display and widget persistence for Devin balance-like account data, so maintainers should explicitly accept the existing visibility setting as the privacy boundary.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Screenshot proof shows the changed Devin menu rendering an Extra usage balance row in a real app surface after the change.
  • proof: sufficient: Contributor real behavior proof is sufficient. Screenshot proof shows the changed Devin menu rendering an Extra usage balance row in a real app surface after the change.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Screenshot proof shows the changed Devin menu rendering an Extra usage balance row in a real app surface after the change.
Evidence reviewed

What I checked:

Likely related people:

  • steipete: Available blame/log history attributes the current-main Devin parser, provider implementation, widget snapshot builder, and widget provider baseline to the v0.39.0 commit. (role: introduced current Devin and widget baseline; confidence: medium; commits: e437044c32ba; files: Sources/CodexBarCore/Providers/Devin/DevinUsageSnapshot.swift, Sources/CodexBar/Providers/Devin/DevinProviderImplementation.swift, Sources/CodexBar/UsageStore+WidgetSnapshot.swift)
  • JoeVenner: Added current-main Mistral widget support in the same ProviderChoice and widget-provider test area that this PR now extends for Devin. (role: recent adjacent widget contributor; confidence: medium; commits: 4f281ab3d866; files: Sources/CodexBarWidget/CodexBarWidgetProvider.swift, Tests/CodexBarTests/CodexBarWidgetProviderTests.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • 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.
Review history (5 earlier review cycles)
  • reviewed 2026-07-04T14:49:22.790Z sha 0fcda7c :: needs changes before merge. :: [P2] Skip the generic CLI cost fallback for Devin overage
  • reviewed 2026-07-04T14:55:37.747Z sha 99d275a :: needs changes before merge. :: [P2] Render Devin extra usage in widgets before enabling it
  • reviewed 2026-07-04T15:10:11.989Z sha 8dd1079 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-04T15:26:52.696Z sha 8dd1079 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T02:13:46.317Z sha 8dd1079 :: needs changes before merge. :: [P1] Gate widget balances on the extra-usage setting

Parses Devin's overage_balance (remaining prepaid USD credit) into a
ProviderCostSnapshot with period 'Extra usage balance', mirroring the
Factory prepaid-balance path across the menu card, widget, and CLI.

- Core: DevinUsageSnapshot parses root-level overage_balance (and
  overage_balance_cents fallback) into providerCost with limit 0
- Menu: show the balance row for Devin under the Factory-parity branch;
  stop hiding optional provider cost for Devin
- Widget: add ProviderChoice.devin to the extra-usage display enum
- CLI: append an 'Extra usage: $X' line for Devin (provider-guarded so
  Factory's same period string stays silent)
- Tests: cover dollars, cents, and absence
@FNDEVVE FNDEVVE force-pushed the feat/devin-extra-usage branch from 9d7cfbe to 0fcda7c Compare July 4, 2026 14:42
@FNDEVVE

FNDEVVE commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up: added a provider choice supports devin round-trip test (ProviderChoice(provider: .devin) == .devin / .devin.provider == .devin) to cover the new widget enum case (Behavior C) — the existing widget suite didn't exercise it.

Re-verified on the final tree (commit 0fcda7c6):

  • make check: ✅ 0 violations, 0 serious in 1260 files (SwiftFormat + SwiftLint with analyzer_rules; caught and fixed a missing blank line before the new test)
  • swift test --filter CodexBarWidgetProviderTests: ✅ 32/32 pass, incl. the new Devin case
  • Focused tests on all touched surfaces (168 tests / 24 suites): ✅

@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: 9d7cfbe91c

ℹ️ 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/Devin/DevinUsageSnapshot.swift
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal priority bug or improvement with limited blast radius. labels Jul 4, 2026
When a Devin account has no primary rate window (weekly-only /
hide_daily_quota path), appendPrimaryLines previously saw
providerCost with period 'Extra usage balance' and emitted a bogus
'Cost: <balance> / 0.0' line before the dedicated Extra usage line.
Guard the generic fallback so Devin extra-usage balances render only
via appendDevinOverageBalanceLine. Factory keeps the fallback since it
always sets primary alongside providerCost.

Adds a CLI test: Devin snapshot with primary == nil + overage balance
asserts the Extra usage line is present and no generic Cost: line
appears.

@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: 99d275aa49

ℹ️ 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/CodexBarWidget/CodexBarWidgetProvider.swift
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 4, 2026
Add providerCost field to WidgetSnapshot.ProviderEntry and populate
it in UsageStore.makeWidgetEntry so the overage balance flows from
the snapshot into widget data. Render an 'Extra usage · Balance: $X'
row in small/medium/large and switcher widget views, gated on
period == 'Extra usage balance' so unrelated provider costs (Claude
spend, Bedrock budgets, etc.) are not mislabeled.

Extract WidgetBalanceFormatter.extraUsageBalance as a testable
internal helper returning a WidgetBalanceLine title+value, with the
views wrapping it in ValueLine.

Tests: assert the formatter renders the balance for a Devin entry
with period 'Extra usage balance', returns nil for a non-balance
providerCost (Claude monthly spend), and that providerCost survives
JSON round-trip through ProviderEntry.
@clawsweeper clawsweeper Bot added 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. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 4, 2026
@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed 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. labels Jul 5, 2026
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Jul 5, 2026
@clawsweeper clawsweeper Bot added 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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Jul 5, 2026
@steipete steipete merged commit 37e4225 into steipete:main Jul 5, 2026
10 checks passed
@steipete

steipete commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Landed in 37e4225 from exact head f3bbc4c after 10/10 checks passed. make check, all 47 make test shards, and 147 focused parser/CLI/widget/snapshot/formatter tests passed; the fresh signed app and widget bundle built, launched, and opened on screen. The bounded local Devin probe correctly completed but found this Mac's imported session invalid, so authenticated balance proof remains the contributor's live screenshot. Changelog follow-up: 68f5f91. Thanks @FNDEVVE!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants