Skip to content

Port upstream 0.68.0: Abacus concurrent credits and billing, session candidates, strict parsing - #628

Open
Finesssee wants to merge 1 commit into
port/upstream-0.68.0from
port/micro-0.68.0-abacus-fetch
Open

Finesssee wants to merge 1 commit into
port/upstream-0.68.0from
port/micro-0.68.0-abacus-fetch

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Summary

Ports the Abacus AI fetch behaviors from upstream 0.68.0 (steipete#4047) to the native Rust provider:

  • Required credits request GET https://apps.abacus.ai/api/_getOrganizationComputePoints and optional billing request POST https://apps.abacus.ai/api/_getBillingInfo (body {}) now run concurrently. Billing is capped at min(request timeout, 5 s); a billing error or timeout keeps the credits with the 30-day fallback window and no plan or reset. A credits failure cancels billing immediately.
  • {success, result} envelope decoded with #[derive(Deserialize)] structs. Missing or non-finite totalComputePoints / computePointsLeft is a parse failure (previously 0%).
  • success:false (or no result) is an auth error only when the lowercased error matches expired|session|login|authenticate|unauthorized|unauthenticated|forbidden; anything else is a parse failure. 401/403 stay auth errors; other non-200 is Abacus AI API error: HTTP <n>.
  • Up to 5 browser cookie candidates (providers::browser_cookie_headers_for_domain("abacus.ai"), Chrome first), skipping cookie sets without a session cookie (upstream exact names, then session|auth|sid|jwt substrings, excluding csrf|_ga|_gid|tracking|analytics prefixes). A failing candidate moves on to the next; the last error is reported. No candidates yields the upstream "No Abacus AI session found..." message (mapped to needs-authentication).
  • A pasted (manual) Cookie header is exclusive: no browser fallback, errors propagate.
  • Timeouts: request timeout is the web timeout clamped to 1..90 s; total refresh deadline is min(90 s, 5T + min(T, 5 s)).
  • Calendar-month pacing is unchanged (RateWindow::monthly_window_minutes, 43,200-minute fallback).

Upstream reference

  • Release bullet: "Abacus AI: fetch credits and optional billing through the bundled plugin, preserving calendar-month pacing and Chrome-first sessions, with bounded retries and a five-second billing budget (feat(abacus): cut over credits and billing to plugin steipete/CodexBar#4047)".
  • Tag-pinned (v0.68.0) reads: Sources/CodexBarCore/Resources/Plugins/abacus.ts, Sources/CodexBarCore/Plugins/ProviderPluginHTTPResponse.swift (optional-request budget semantics), AbacusProviderDescriptor.swift, AbacusCookieImporter.swift, TestsPlugin/AbacusPluginTests.swift.

Ported / Deferred

  • Ported: all behaviors above.
  • Not ported (SKIP): the QuickJS/JavaScriptCore plugin-engine migration itself, and the plugin settings REQUEST_TIMEOUT / MAX_COOKIE_CANDIDATES (Windows uses the existing web timeout and a fixed limit of 5).
  • Month arithmetic stays UTC (upstream uses the host time zone); the difference is at most one hour across DST and was left as an optional follow-up.

Validation

  • cargo +1.98.0 fmt --all -- --check: clean
  • cargo +1.98.0 clippy --workspace --all-targets -- -D warnings: clean
  • cargo +1.98.0 test -p codexbar abacus: 23 passed, 0 failed (fixtures copied from upstream wire shapes; mockito stubs for wire requests, candidate rotation, manual exclusivity; paused-time tests for the 5 s billing budget and cancellation)

Affected areas

  • Provider-specific behavior

UI proof

Not applicable

@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: ae8b12f0-f600-4910-a1b4-5163e1196294

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant