Skip to content

feat(widgets): add a multi-account quota overview - #4400

Merged
steipete merged 3 commits into
mainfrom
triage/20260921-widgets-multi-26
Oct 10, 2026
Merged

steipete merged 3 commits into
mainfrom
triage/20260921-widgets-multi-26

Conversation

@steipete

@steipete steipete commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Adds CodexBar Accounts, a quota-only overview for one provider. Medium shows up to four account rows and large supports eight, ordered by their most constrained general quota's remaining percentage, lowest first. One +N more row combines rows beyond the family limit with accounts omitted by the existing six-account snapshot cap.

The widget reuses ProviderSelectionIntent, the existing timeline and account snapshot data, quota selection, and privacy labels. Only anonymous overflow counts are added to the snapshot; refresh opt-in, ownership guards, the six-account publication cap, and existing widget configurations stay intact. Large currently has at most six populated rows from the app; eight-row capacity is verified synthetically. No paging, combined history, or account-level borrowing of provider costs/credits.

Thanks @nicosuave for the request and @aledeul for #3938. This smaller implementation adopts that PR's widget configuration and provider-safe account filtering; the commit retains Adrien Ledeul's co-author credit. The prior PR is intentionally not adopted wholesale because the approved design excludes its paging, active-account state, combined history, and changes to existing tiles.

Fixes #3144
Refs #3938

Verification

The swift-native wrapper sources Scripts/test_environment.sh and forwards test/build to Swift with --build-system native --jobs 4 -Xswiftc -gnone.

  • Baseline cd24c380e100: ../reports/widgets-multi-26-proof/swift-native test --filter WidgetAccountPublicationTests — 5 tests, 4 passed / 1 failed, specifically the absent overflow count (nil instead of 3). The six-account cap and selected-account retention assertions already passed.
  • CODEXBAR_WIDGET_HEADLINE_PROOF_DIR="$PWD/../reports/widgets-multi-26-proof" ../reports/widgets-multi-26-proof/swift-native test --filter 'Widget|ProviderArchitectureGatekeeperTests' — 284 tests in 33 suites passed. Covers sorting, four/eight cutoffs, combined overflow, redaction, provider/owner isolation, legacy decoding, all three account inventories, and light/dark render/OCR proof.
  • ./Scripts/test.sh --swift-command "$PWD/../reports/widgets-multi-26-proof/swift-native" --direct-workers 4 — all 149 groups passed on final head 0756b45251f, all on the first attempt with zero timeouts or retries; direct mode verified 14,491 test methods. The earlier run also passed after two unrelated status-menu/usage-store batches recovered through 24 isolated retries.
  • Final regenerated proof: the same wrapper with --filter 'WidgetAccountsOverviewTests|WidgetHeadlineRenderTests|WidgetAccountPublicationTests' — 13 tests in 3 suites passed, including the original red test and eight overview renders. The before comparison uses the existing single-account layout with quota-only data.
  • make check — passed; SwiftLint 0 violations across 2,939 files. git diff --check — clean. Independent Codex review — no actionable P0–P2 findings.
  • git diff --shortstat origin/main -- Sources WidgetExtension: 29 files changed, 186 insertions(+), no deletions (authorized feature growth, including 23 generated locale entries). -- Tests: 4 files changed, 265 insertions(+), no deletions.

The first CI run exposed a type-check timeout in the chained account projection/sort on Swift 6.2.4 and 6.3.3. Commit 0756b45251f separates it into explicitly typed steps. Local Swift 6.4 passes the same 284 focused tests and all 149 full-suite groups after the correction; the new CI run checks both older compilers.

Synthetic visual proof

Production SwiftUI views, synthetic accounts, simulated WidgetKit margins. These verify layout and OCR readability; they do not claim installed WidgetKit compositor or upgrade/rollback proof. The owner's app and installed widgets were not touched.

Existing Account Usage (light) New Accounts overview (light)
Before: one pinned account After: four accounts and five omitted
Existing Account Usage (dark) New Accounts overview (dark)
Before: one pinned account, dark After: four accounts and five omitted, dark
Large: six published accounts, three beyond snapshot cap Large: synthetic eight-row layout capacity
Six published rows plus three omitted Eight rows plus two omitted in a larger synthetic snapshot

Show four account quotas on medium and support eight on large, ordered by
remaining quota. Count accounts beyond the existing six-account snapshot
cap without publishing their identities or expanding refreshes.

Reuse the widget configuration and provider-safe account filtering explored
in #3938, with quota-only rows and no paging or combined history.

Fixes #3144
Refs #3938
Co-authored-by: Adrien Ledeul <adrien.ledeul@cern.ch>
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T02:40:31.152934Z 7d23b3e PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex review: blocked before merge.

What this changes

Adds a provider-specific Accounts widget with quota-sorted account rows and a combined overflow count.

Example: Nine Codex accounts are configured and six are published to the widget snapshot.

  • Before: Each Account Usage widget displays one pinned account.
  • After: A medium Accounts widget displays four published accounts ordered by remaining quota and shows “+5 more.”

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, approved scope with focused coverage and inspected visual renders; an unresolved P2 defect and incomplete upgrade evidence prevent readiness.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Users cannot compare several accounts’ remaining quotas in one existing widget.
Reason: The owner explicitly approved this compact presentation, including its row limits and overflow behavior.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep open: this owner-authored PR implements the approved overview missing from main, but the previously reported setup-message defect remains unresolved.

Priority: P3
Reviewed head: 0756b45251f0a4d5e187ccc952159e6c1e083404

Before merge

  • Explain how to enable account publication in the empty state (P2) - With “Keep accounts updated for widgets” disabled, its default value, the writer publishes no accounts. This branch then renders “Open CodexBar” twice because WidgetEmptyState already supplies that heading. Opening or refreshing the app cannot populate the overview until the separate preference is enabled. Replace the message with localized guidance to enable account updates in Settings → Menu → Widgets and refresh the selected provider. This remains the unresolved finding from the prior review.
  • Complete next step - Resolve the GitHub-reported merge conflict against main.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] Explain how to enable account publication in the empty state — Sources/CodexBarWidget/CodexBarAccountUsageWidget.swift:274-275

Tests

  • Missing end-to-end proof: Installed-widget upgrade verification from v0.73.0 with existing selections and settings intact is not supplied.
Agent review details

How this fits together

The app publishes verified, privacy-aware account quotas to shared JSON; WidgetKit reads that snapshot and renders the selected provider’s account overview.

flowchart LR
  A[Saved account inventories] --> B[Verified quota snapshots]
  B --> C[Shared widget JSON]
  C --> D[Provider timeline]
  D --> E[Quota ordering and overflow]
  E --> F[Accounts widget]
Loading

Technical review

Best possible solution:

Land the bounded overview with actionable setup guidance while preserving existing account ownership, privacy, refresh limits, and widget configurations.

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

Source inspection establishes the empty-state failure with accountWidgetsEnabled=false; no runtime reproduction was attempted under the read-only review constraints.

Is this the best way to solve the issue?

Reusing the existing account writer, timeline, quota selector, and privacy labels is a focused implementation of the owner-approved design.

Full review comments:

  • [P2] Explain how to enable account publication in the empty state — Sources/CodexBarWidget/CodexBarAccountUsageWidget.swift:274-275
    With “Keep accounts updated for widgets” disabled, its default value, the writer publishes no accounts. This branch then renders “Open CodexBar” twice because WidgetEmptyState already supplies that heading. Opening or refreshing the app cannot populate the overview until the separate preference is enabled. Replace the message with localized guidance to enable account updates in Settings → Menu → Widgets and refresh the selected provider. This remains the unresolved finding from the prior review.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 08f42ab06704.

Provenance checked

  • Account publication, snapshot projection, and widget rendering keeps the original intent (0f8489d: Provide independently pinned, verified account quotas without borrowing identities, provider-wide costs, or sibling-account readings.)
  • Used-versus-remaining widget display keeps the original intent (37114d2: Honor the existing display preference while retaining raw remaining percentages.)
  • Widget localization catalogs keeps the original intent (Complete app and widget localization in all supported languages #4223: Package complete widget translations and track the generated reference keys.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Rokas Tarasevičius: Raw commit 0f8489d adds Sources/CodexBarCore/WidgetAccountSnapshot.swift:21 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0f8489dd8601; files: Sources/CodexBarCore/WidgetAccountSnapshot.swift)

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #3144
Summary: This PR implements the accepted quota-only overview requested by the canonical issue and adopts a bounded subset of the earlier proposal.

Members:

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

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove proof: 📸 screenshot: Current real behavior proof evidence kind is not_applicable.

Label justifications:

  • P3: This is an optional widget presentation improvement; existing individual account widgets remain available.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rank-up moves

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

  • Provide an isolated v0.73.0-to-candidate upgrade run showing existing widget selections and settings survive the additive snapshot field.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-10T02:41:08.167Z sha 7d23b3e :: blocked before merge. :: [P2] Explain how to enable account publication in the empty state
  • reviewed 2026-10-10T03:17:17.581Z sha 0756b45 :: needs changes before merge. :: [P2] Explain how to enable account publication in the empty state

Reviewed October 9, 2026, 11:37 PM ET / October 10, 2026, 03:37 UTC (Revision 3).

Split the account projection and quota sort into typed steps so Swift 6.2 and 6.3 can compile the overview without a type-check timeout.
@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. 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. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Oct 10, 2026
@steipete
steipete merged commit 2b58ada into main Oct 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Show usage for multiple accounts per provider on widget

1 participant