Skip to content

sync: integrate upstream wave 4 (settings reorg, usage limits, compaction) - #265

Draft
aaditagrawal wants to merge 39 commits into
codex/sync-upstream-20260904-wave-3-bb46from
codex/sync-upstream-20260904-wave-4-bb46
Draft

sync: integrate upstream wave 4 (settings reorg, usage limits, compaction)#265
aaditagrawal wants to merge 39 commits into
codex/sync-upstream-20260904-wave-3-bb46from
codex/sync-upstream-20260904-wave-4-bb46

Conversation

@aaditagrawal

Copy link
Copy Markdown
Owner

What changed

Integrates upstream commits 129–160 through 710f6dc41, stacked on #264.

Included upstream work

  • Settings page reorganization, including the Limits tab
  • Provider usage-limit snapshots, CLI proxy sources, and Codex reset credits
  • Context compaction command (/compact)
  • Related contracts, server ingestion, and web settings search updates

Fork adaptations

  • Keep every fork driver (including Antigravity, Oh My Pi, Pi, Hermes, Fx, Grok, ACP Agent)
  • Keep the thread rate-limit panel: adapters now emit typed ProviderUsageLimitsUpdate windows, and ingestion maps those into persisted activities
  • Cursor stays on the TypeScript SDK; /compact is advertised on the SDK snapshot only
  • Hermes companion, Night sky artwork, and provider-aware runtime modes stay in the reorganized settings UI
  • Append-only migrations (usage-limit sources as 053)
  • Fork-first README and AGENTS.md already carried from earlier waves

Stack

  1. sync: integrate upstream wave 1 through 355fbd96d #262 wave 1 → main
  2. sync: integrate upstream wave 2 through 652515a34 #263 wave 2 → wave 1
  3. sync: integrate upstream wave 3 (Antigravity + cookie import) #264 wave 3 → wave 2
  4. This PR → wave 3
  5. Wave 5 → this branch (remaining 30 commits through upstream HEAD 09d13de43)

Verification

  • vp run typecheck passed after the usage-window mapping
  • All GitHub operations are fork-only (aaditagrawal/t3code)
  • Do not merge until review comments on this stack are addressed
Open in Web Open in Cursor 

juliusmarminge and others added 30 commits September 3, 2026 17:04
Co-authored-by: Claude Code <noreply@anthropic.com>
…g#9518)

Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>
pingdotgg#9507)

Users on Codex or Claude Code subscriptions could not see how much quota was left or when it resets without leaving T3 Code. A user whose CLIs route through a CLIProxyAPI hub could not see it at all.

Each driver now returns `usageLimits` on its own snapshot (Codex from `account/rateLimits/read`, Claude from the SDK's `get_usage`), adapters normalise turn-driven rate-limit events at the boundary, and a driver-blind ingestion layer folds them onto the owning instance. The Usage page gains a Limits tab (mobile a card) with a bar per window, elapsed marker, pace, and reset countdown. CLIProxyAPI hubs can be added as read-only usage-limit sources; their accounts show badged "via CLIProxyAPI" with emails blurred.

Distilled from pingdotgg#1732 (server model, provider rows) and pingdotgg#9421 (Limits tab, window bars, pace maths). Closes #228.

Co-authored-by: Aditya Mer <101453576+Aditya190803@users.noreply.github.com>
Co-authored-by: Wout Stiens <71498452+StiensWout@users.noreply.github.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>
…ingdotgg#9528)

Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>
…ingdotgg#9482)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Include SQLite conditions and schema issue tags without copying query data.

Continue @Sy-D's [pingdotgg#4837](pingdotgg#4837). Add the missing Bun error codes and test the real SQL client.

Created with GPT-6 Astra (preview) in Codex.

Co-authored-by: Sy-D <8460326+Sy-D@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>
…ictation (pingdotgg#9548)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…g#9534)

Follow-up to pingdotgg#9507, carrying over the reset-credit redemption from pingdotgg#9421.

Codex grants a reset credit when it has rate-limited an account unfairly (`"Thanks for using Codex! You've been granted one free rate limit reset."`). Redeeming one clears the current 5h/weekly windows. The Limits tab now shows how many are banked and when the next expires, with a confirmed **Use a reset credit** action.

## How it works

- `ServerProviderUsageLimits.resetCredits` carries the count and soonest expiry; the Codex probe reads it from the same `account/rateLimits/read` it already makes.
- `ProviderInstance.consumeResetCredit` is a new optional hook — account-level, so it sits beside `refreshModels` rather than on the thread-routed adapter. The Codex driver implements it over a short-lived app-server (via `withCodexAppServerClient`, factored out of the status and skills probes which duplicated the setup), then re-probes.
- Single-flight per instance with one idempotency key kept until Codex reports an outcome, so a retry after a timeout does not open a second attempt.
- New `provider.consumeResetCredit` RPC under the operate scope; the outcome (`reset` / `nothingToReset` / `noCredit` / `alreadyRedeemed`) is shown inline.

Only Codex reports credits today. A provider without the hook gets a clear "does not bank reset credits" error; one without credits shows nothing.

## Screenshots

The local Codex row with one banked credit (the same account via the CLIProxyAPI hub above it shows no credit, as expected — the hub does not relay them):

![Limits tab with the Codex row showing "1 reset credit banked · next expires in 16d 22h" and a "Use a reset credit" button](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/2897db5e357f12b3/credits-tab.png)

Close-up of the row:

![Codex row: Weekly 25% used bar, then "1 reset credit banked · next expires in 16d 22h" with the "Use a reset credit" button](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/0e80f9114cab8f36/credits-row.png)

Clicking it opens the confirmation; nothing is sent until **Use credit**:

![Confirm dialog: "Use a reset credit? This redeems one credit on your account and clears the current rate-limit windows. It cannot be undone." with Cancel and Use credit](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/dc728580889ef1fe/credits-confirm.png)

## Verification

- Mapper tests for the credit summary; provider, contract, and Usage page suites pass; typecheck clean.
- Verified against a real Codex Pro account holding one credit: summary and expiry render, the confirm dialog opens. **Not redeemed** — that would spend the credit.

Written by Claude Fable 5 via Claude Code; design and single-flight approach from @StiensWout's pingdotgg#9421.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Redemption spends real account credits over a new RPC; correctness depends on per-account locking and idempotency, though disabled instances and non-Codex providers are rejected explicitly.
> 
> **Overview**
> Adds **end-to-end redemption of banked Codex rate-limit reset credits** from the Limits UI on web and mobile, backed by a new operate-scoped `provider.consumeResetCredit` RPC.
> 
> **Contracts and server:** `ServerProviderUsageLimits` can include `resetCredits` (count + next expiry). Codex probes attach that from `account/rateLimits/read`. Optional `ProviderInstance.consumeResetCredit` is implemented for Codex via a scoped app-server call to `account/rateLimitResetCredit/consume`, then a limits refresh. `CodexResetCreditCoordinator` serializes redemptions per Codex account directory, reuses one idempotency key until Codex returns an outcome, and times out hung requests. `withCodexAppServerClient` is extracted so status, skills, and redemption share the same short-lived app-server setup.
> 
> **Clients:** Limits rows show banked credits and a confirmed **Use a reset credit** action that calls `serverEnvironment.consumeResetCredit` and surfaces outcomes (`reset`, `nothingToReset`, etc.) or errors.
> 
> **Web usage sources (same PR):** Adding/removing CLIProxyAPI hubs and the add dialog target a **selected connected environment** (with picker when several are connected), gated by operate access—not only the primary environment.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 98f32e6. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->


Co-authored-by: Wout Stiens <71498452+StiensWout@users.noreply.github.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
…otgg#9125)

Refresh missing PR associations after agent turns on the thread's current branch. Preserve background policy, known PR caches, and failed-lookup backoff. Serialize status loads and refreshes to prevent stale responses from hiding a PR. Find branches pushed under their own name while still tracking the default branch.

Original work by Theo Browne with Claude Fable 5.1 in Claude Code. Takeover fixes created with GPT-6 Astra (preview) in Codex.

Co-authored-by: Theo Browne <me@t3.gg>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
juliusmarminge and others added 4 commits September 3, 2026 19:30
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>
Adapters now emit typed ProviderUsageLimitsUpdate payloads. Keep the fork
thread panel by projecting those windows into persisted activities.
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL 1,000+ effective changed lines (test files excluded in mixed PRs). labels Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.5 KiB 15.1 KiB
Codex Thread snapshot wire 7.0 KiB 7.3 KiB
Codex Live turn WebSocket wire 6.5 KiB 7.8 KiB
Codex Live turn WebSocket decoded 57.0 KiB 66.4 KiB
Codex Live turn messages 8 21
Claude Total thread wire 13.5 KiB 15.1 KiB
Claude Thread snapshot wire 7.0 KiB 7.3 KiB
Claude Live turn WebSocket wire 6.5 KiB 7.8 KiB
Claude Live turn WebSocket decoded 57.8 KiB 66.4 KiB
Claude Live turn messages 8 21

Baseline: unavailable · PR result: 200a8db · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 113.9 KiB
  • Claude decoded thread snapshot: 114.6 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

cursoragent and others added 5 commits September 4, 2026 11:32
Keep fork opaque-attachment claims while resolving inline documents with
fileName/mimeType and forcing downloads for other generic files. Accept
empty skillDispatchInput on promptless continuation, and mock expo-image
so the mobile ProviderIcon suite can load after Antigravity.
Stop duplicating Claude prompt text when there is no skill dispatch, keep
opaque attachment downloads flagged, assert only Codex binaries on the
binaryPath re-probe, and advertise Antigravity in PROVIDER_OPTIONS.
…e-3-bb46' into codex/sync-upstream-20260904-wave-4-bb46

Co-authored-by: aaditagrawal <aaditagrawal@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.