Skip to content

[WRONG BRANCH] rebuild daily main onto upstream v2.31.0 - #6

Merged
yansigit merged 140 commits into
mainfrom
run/main
Aug 22, 2026
Merged

yansigit merged 140 commits into
mainfrom
run/main

Conversation

@yansigit

@yansigit yansigit commented Aug 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Keep the reviewed run/main rebuild based on upstream v2.31.0 at 6ae83b1f189c353935d4977bb01227484fbdb52b, with the fork overlay and selected feature heads.
  • Record origin/main as a parent with a history-only git merge --no-ff -s ours, so GitHub can merge this reviewed tree into the fork's main.
  • Update the fork docs/skill to use merge-from-main daily syncs and add the fork-only enforce-target base overlay (dev remains upstream-only; this fork allows dev and main).

Rebuild decision table

Area Decision
Antigravity hosts Keep ours: HTTPS rewrite and canonical host behavior.
src/adapters/google-http.ts Cooldown first, then host failover.
src/server/responses/core.ts Antigravity 429 carousel first, then opaque-blob recovery.
Web search Keep both onCompletedResponse and accountId behavior.
Quota tests Keep HEAD tests plus the feature's HTTP catalog test.

Verification

  • node --test .github/scripts/enforce-pr-target.test.cjs: 21 pass / 0 fail.
  • bun test tests/ci-workflows.test.ts: 132 pass / 0 fail.
  • bun run typecheck: passed.
  • bun run privacy:scan: passed.
  • Catch-up tree check: git diff --exit-code PRE HEAD -- passed.
  • Ancestry check: git merge-base --is-ancestor origin/main HEAD passed.
  • The PR remains a draft intentionally. The enforce-target check may stay red on this PR because pull_request_target reads the default branch; that is expected until this PR lands on main.

Subagent roles dashboard

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed; the daily-loop plan is 2026-08-22-fork-main-daily-loop.md.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults; no secret material is included.

Landing

Human only: click Create a merge commit / Merge pull request on PR #6. Do not squash or rebase, and do not auto-merge. After it lands, daily syncs should start from origin/main, merge origin/vendor/main, replay only unabsorbed overlay/features, and open a mergeable draft PR into main.

If the workflow overlay is reported as a sponsored surface by hygiene, that is expected for this fork-owned pull_request_target policy change; retain it so upstream lidge-jun remains dev-only.

This is a fork-internal human-merge PR. Do not merge it upstream and do not open a PR to lidge-jun/opencodex.

Made with Cursor

olddonkey and others added 30 commits August 18, 2026 14:55
Phase B2 of the FastWire umbrella (lidge-jun#1886), closing the
request in lidge-jun#1875. Fast now works end to end for xAI, and only where xAI
documents it.

Capability follows the transport. The registry gains a key-auth service-tier
overlay applied only when a preset allows the key override and the captured
effective auth transport is key-based; xAI declares Fast there and stays
unclassified on OAuth, because Priority Processing is documented for the public
api.x.ai endpoints and not for the Grok CLI subscription gateway. The overlay
resolves inside the shared FastPolicyAuthority capture, so the catalog and the
runtime cannot disagree — and the runtime only rewrites the base URL to that
gateway when authMode is "oauth", exactly when the overlay withholds the
capability, so Fast can never be injected into the unverified endpoint.

The catalog stops telling every provider OpenAI's story. Fast tier copy is now
per-provider, and xAI's says what xAI actually charges: priority processing at
2x token price, not "1.5x speed". Providers that declare nothing keep their
current bytes.

Pricing is declared rather than hardcoded to one vendor. The OpenAI-only
provider gate becomes exact (provider, model) priority rules, so xAI gets its
documented flat 2x while routed resellers sharing the grok slug inherit
nothing. The long-context relationship is likewise a declaration: OpenAI
publishes that Fast and long context are exclusive regimes, while xAI publishes
neither a combined rate nor an exclusion — so a confirmed-priority request above
200k prices at the published long-context rate and is marked a known lower
bound, surfaced in the dashboard as "≥$" rather than an invented stacked
multiplier. Billing still follows the response echo, which matches xAI's rule
that the priority rate applies only when the response confirms it.

NOTE — beyond the Fast path: xAI's bundled cached-input price for grok-4.6 was
$0.30 against an official $0.50, so every xai cost estimate (not just Fast) was
low. A verified-override layer corrects it ahead of the bundled row, which the
existing expected-price overlays sit behind and could not reach. The Fast
multiplier applies on top of the base price, so shipping the premium without
this correction would have compounded the error.

Full suite at this commit: 13330 pass / 10 skip / 1 fail — the one failure is
the pre-existing dev-side key-login-live-update regression, confirmed to
reproduce on this branch's own base commit (bcc77c0) with none of these
changes applied.

Co-Authored-By: Claude Fable 5 <[email protected]>
The readiness checklist requires a screenshot for GUI changes. Three seeded
grok-4.6 rows exercise every branch of the new pricing path in one view:
standard, a response-confirmed priority request at exactly the documented 2x
premium, and a confirmed-priority request above the long-context threshold
rendering as "≥$" because xAI publishes no combined rate.

Captured against a local proxy with a seeded usage log; no live xAI request was
billed to produce it.

Co-Authored-By: Claude Fable 5 <[email protected]>
# Conflicts:
#	docs-site/src/content/docs/reference/configuration/providers.md
#	gui/src/i18n/de.ts
#	gui/src/i18n/en.ts
#	gui/src/i18n/fr.ts
#	gui/src/i18n/ja.ts
#	gui/src/i18n/ko.ts
#	gui/src/i18n/ru.ts
#	gui/src/i18n/tr.ts
#	gui/src/i18n/zh-TW.ts
#	gui/src/i18n/zh.ts
#	gui/src/pages/Logs.tsx
#	gui/src/pages/logs-cost-format.ts
#	src/codex/catalog/provider-fetch.ts
#	src/providers/registry.ts
#	src/providers/service-tier.ts
#	tests/service-tier-capability.test.ts
33e1c3e split the OAuth subscription gateway from the API-key endpoint in the
provider table for en, ja, ko, ru, and zh-cn, but zh-tw, fr, and tr kept
https://api.x.ai/v1 as the base URL. OAuth routes through the Grok CLI gateway
at https://cli-chat-proxy.grok.com/v1; only the API-key override targets
api.x.ai, and only that transport injects Priority Processing.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_017zpLCh4eEms6un3VjapRgL
Claude Code's Anthropic Messages path never received a reasoning-replay scope because it does not send the Codex parent-thread header. Derive one from the stable per-session prompt_cache_key (metadata.user_id) so Gemini/Antigravity thought signatures are remembered by call_id and survive history replay. Also read nested extra_content.google.thought_signature when parsing Google responses.
Adds regression coverage for the Anthropic Messages reasoning-replay scope and for reading nested extra_content.google.thought_signature from Google response parts.
`ROUTED_CUSTOM_TOOL_PASSTHROUGH` exempted `apply_patch` from routed
custom-tool lowering unconditionally, so it reached every routed destination
as a `type: "custom"` tool with `custom_tool_call` items. xAI's Responses
endpoint rejects that item type:

  422 Failed to deserialize the JSON body into the target type:
      input[5]: invalid "custom_tool_call" item: missing field `id`

The message is misleading — the id is present. Instrumenting the adapter
showed the item leaving as
`{"type":"custom_tool_call","id":"ctc_abc123","call_id":"c1",...}`; xAI
reports the first field its own parser cannot satisfy rather than the real
problem, which is that it does not accept the item type. Same class as its
"Could not decode the compaction blob" message for a reasoning field, so the
fix is not to generate or preserve ids.

Live A/B against the endpoint — identical body, identical id, only the tool
name differs:

  apply_patch      (exempt from lowering)  -> 422
  my_custom_thing  (lowered to a function) -> 200

Lowering is what makes it work; the exemption is what breaks it. It surfaces
on Codex's compact turn because a real session always contains apply_patch
calls, but a plain replay reproduces it too.

The exemption is not wrong everywhere — the canonical ChatGPT surface speaks
custom_tool_call natively and lowering there would regress it. The defect is
that one unconditional rule about "routed providers" encoded a claim about a
single destination's capability. Add `supportsResponsesCustomTools`,
following the existing `supportsOpenAiWebSearchToolFields` shape: declared on
the registry row and the provider config, filled only when unset, and
consumed as an explicit denial. Absent or true keeps today's behaviour
byte-identical; only xAI declares false.

The response path needed no special case: it is name-generic, so once
apply_patch joins the converted set the existing repair restores the
function_call and its streaming argument events to a custom_tool_call with
the original call id.

Co-Authored-By: Claude Fable 5 <[email protected]>
Every routed lowering step derives its plan from the tool declarations, and
the compaction body build deletes them. It ran first, so on a compaction turn
the plan was empty and replayed call items reached the wire in their private
shapes. Against xAI:

  422 Failed to deserialize the JSON body into the target type:
      input[5]: invalid "custom_tool_call" item: missing field `id`

The id is present; xAI reports the first field its own parser cannot satisfy
rather than the real problem, which is that it does not accept the item type.

Instrumented the adapter to pin the mechanism: with declarations present the
call item is converted; with them absent, or on a compaction turn, it goes out
raw. Reordering locally produced `function_call` / `function_call_output` with
`tools` still absent and the compact prompt still appended.

This is the second time this exact shape has been fixed here — a replayed
namespace key survived for the same reason. That fix taught one lowering step
to cope; this one fixes the pipeline, so the next private field added does not
need its own workaround. The invariant is now stated at the call site: the
compaction body build removes the tool surface and must be the last routed
transform.

Two effects beyond the call items, both improvements: `promoteClientLoadedTools`
could previously reintroduce top-level `tools` after compaction had removed
them, which running compaction last now prevents; and namespace-collision
validation runs before the declarations are deleted. Non-compaction output is
byte-identical, pinned by an exact comparison test.

Co-Authored-By: Claude Fable 5 <[email protected]>
(cherry picked from commit 59d0cde7f75f0e645a12ec44a388609dfba50ce6)
The namespace-replay restore test verified the restored custom_tool_call events
but never checked that the stream still ends with data: [DONE], so a regression
that drops the terminal marker would have passed. The sibling lowering test
already asserts it; match that.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_017zpLCh4eEms6un3VjapRgL
Forward auth is not an OpenAI-destination identity. A noncanonical
forward provider that denies native custom tools must still convert
apply_patch. Pin the adapter serialization and the handleResponses path.
Refresh B2 onto current dev without rewriting contributor history.
Keep the xAI Priority response-confirmation boundary and the grok-4.6
cached-input $0.50 correction. Resolve the leftover privacy:scan example
using the wording already on dev.

# Conflicts:
#	devlog/_plan/260820_bug_pr_backlog_consolidation/100_release_safety_audit.md
lidge-jun#2255's wire/tier matrix assumed API-key Grok chat does not forward
service_tier. B2 documents Priority Processing on that transport, so the
key-auth chat row must now match the Responses key-auth row.
OAuth remains unclassified.
yansigit and others added 17 commits August 22, 2026 12:39
Restrict vendor updates to fast-forward-only main and dev refs.

Co-authored-by: Cursor <[email protected]>
Route selected sync events through an extensible registry and upsert one labeled GitHub issue per release tag.

Co-authored-by: Cursor <[email protected]>
Notify the Cursor Automation with signed pin-updated events while keeping no-op and divergence paths silent.

Co-authored-by: Cursor <[email protected]>
Expose detect, pin, and plugin-driven emit commands for the GitHub workflow.

Co-authored-by: Cursor <[email protected]>
Poll released upstream tags with least-privilege vendor pinning and plugin notifications.

Co-authored-by: Cursor <[email protected]>
Document action and Cursor Automation ownership, fork paths, secrets, and human landing boundaries.

Co-authored-by: Cursor <[email protected]>
Fetch local vendor branches for detection and push only successful vendor ref updates.

Co-authored-by: Cursor <[email protected]>
Share a fetch implementation type across scripts and keep the SDD artifacts exact.

Co-authored-by: Cursor <[email protected]>
Keep the new fork sync design compatible with repository diff checks.

Co-authored-by: Cursor <[email protected]>
Add reusable HTTP and CLI coordinator adapters so future agents can integrate through configuration while preserving Cursor's signed webhook contract and the human-reviewed merge boundary.

Co-authored-by: Cursor <[email protected]>
Skip preview tags that are not on upstream/main, treat a vendor pin that
already contains the release as current, bootstrap missing vendor branches,
and keep coordinators running if the issue notifier fails.

Co-authored-by: Cursor <[email protected]>
Replay live quota RPC and geoblock onto the v2.31.0 pin.
Replay Claude CCA wire fidelity onto the v2.31.0 pin.
Replay CCA host failover onto the v2.31.0 pin.
Replay process-local account cooldowns onto the v2.31.0 pin. Keep host
failover and opaque-blob recovery from the release, and re-fit cooldown
recording plus the Antigravity 429 carousel on shared hotspots.

Co-authored-by: Cursor <[email protected]>
Replay named subagent role catalog onto the v2.31.0 pin.
Replay the Subagents Roles editor onto the v2.31.0 pin.
@github-actions

Copy link
Copy Markdown

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot changed the title rebuild daily main onto upstream v2.31.0 [WRONG BRANCH] rebuild daily main onto upstream v2.31.0 Aug 22, 2026
@github-actions

github-actions Bot commented Aug 22, 2026 •

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.

Its title has been prefixed with [WRONG BRANCH].
Automatic draft conversion failed (token cannot change draft status). Please convert this pull request to a draft manually. The required enforce-target check will keep failing until every issue above is resolved.

@yansigit
yansigit marked this pull request as ready for review August 22, 2026 19:28
@github-actions
github-actions Bot marked this pull request as draft August 22, 2026 19:28
yansigit and others added 4 commits August 22, 2026 13:41
Make released-main synchronization the normal fork path and reserve the
reviewed run/main rebuild for explicit catch-up.

Co-authored-by: Cursor <[email protected]>
Keep upstream pull requests dev-only while letting this fork's merge-from-main
sync PRs pass the target-branch gate.

Co-authored-by: Cursor <[email protected]>
Catch-up only: record old main as a parent so GitHub can merge this
branch with a merge commit. The tree stays vendor v2.31.0 plus overlay
and selected feats.
Update workflow contract assertions for the fork's main merge path while
preserving the upstream dev-only policy.

Co-authored-by: Cursor <[email protected]>
@yansigit
yansigit marked this pull request as ready for review August 22, 2026 20:18
@yansigit
yansigit merged commit a5aa822 into main Aug 22, 2026
30 of 32 checks passed
@yansigit
yansigit deleted the run/main branch August 22, 2026 21:29
cursor Bot pushed a commit that referenced this pull request Oct 12, 2026
…ge-jun#6090) (lidge-jun#6173)

* feat(quota): report Devin account quota from GetUserStatus

Devin accounts had no quota row, so headroom-based account ranking had
nothing to order them by. Probe Cognition's unary
SeatManagementService/GetUserStatus with the default cloud-direct
Metadata, against the credential's allowlisted api-server host with
redirects refused and no response body echoed.

Only dated daily/weekly windows the plan does not hide are published:
credit-billed plans leave those percents at a zero default that would
read as exhausted. Prompt plus flex credits form one monthly pool
measured against the server balance; a negative balance is unlimited.
4xx other than 408/429 is terminal; a decoded status with nothing
measurable is authoritative-empty.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit b493e0d)

* fix(quota): tighten Devin quota mapping and failure handling

- Publish the credit pool only for credit-billed plans (or an unknown
  strategy with no dated window); a quota-billed plan with a zero credit
  balance no longer reads monthly-exhausted.
- Drop dated windows whose reset is not after now.
- Read the body through the bounded byte reader and decode inside the
  try, so a truncated or oversized body keeps last-good instead of
  throwing.
- Treat 409 and 499 as retryable alongside 408 and 429.
- Cover flow credits (#5/#9/#13), hide_weekly (#37), and 403/404/429.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 7d12eb1)

* fix(quota): reject truncated Devin quota protobufs and document the probe

- Require the decoded fields to account for every byte. iterFields stops
  quietly at a truncated length-delimited field, so half a response decoded
  to an empty status and was published as authoritative-empty, deleting the
  last-good row.
- Use the Web Crypto randomUUID instead of node:crypto.
- List Devin in the per-account quota section of the CLI accounts reference.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit a71f149)

* fix(quota): stop flow credits gating Devin accounts; key the cache by tenant host

- Flow credits are decoded but no longer published. They meter agent tool
  actions, not chat turns, and ranking reads the fullest custom window as
  the account's limit, so an empty flow balance retired accounts that could
  still serve.
- A credit-billed plan with nothing used and nothing left reads 100%
  instead of unmeasured, so ranking no longer prefers it as untested.
- The account quota identity includes the credential's own api base URL
  when it has one, so a tenant host change invalidates the cached reading.
  Credentials without one keep their existing key.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 9e23686)

* fix(quota): reject a Devin status with no plan or a malformed plan-end timestamp

- A present plan-end timestamp that fails to decode now fails the whole
  status instead of reading as absent, so a malformed response keeps the
  last-good row rather than publishing an authoritative-empty one.
- A status with neither the top-level PlanInfo nor the nested PlanStatus
  plan is rejected instead of decoded into a zero-valued plan, which could
  read as a credit-billed account with every credit spent.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 52d9b62)

* fix(devin): reject malformed quota statuses and preserve last-good

Validate known protobuf wire types and 64-bit varint bounds before quota mapping. Require observed prompt balances for a monthly window, treat only credential rejection as terminal, and scope tenant host cache identity to Devin. Update the provider contract and regression coverage.

Co-authored-by: Sayo <[email protected]>

* fix(quota): count a lone Devin balance field as credit evidence

GetUserStatus is proto3, which omits zero-valued fields, so an exhausted pool
arrives with used_prompt and no available_prompt. Requiring both fields hid
that account's 100% monthly window and ranked it as untested headroom. Any of
the four pooled balance fields (#4, #6, #7, #8) is now evidence; only a status
with none of them publishes no credit window.

Co-authored-by: Sayo <[email protected]>

* fix(quota): keep last-good Devin quota on a GetUserStatus 403

A 403 from GetUserStatus can forbid that one RPC for a key that still serves
chat, so treating it as a rejected credential cleared a usable account's
quota. Only 401 is terminal now. The structure and CLI reference describe the
balance-evidence rule as shipped: any one of the pooled balance fields counts.

Co-authored-by: Sayo <[email protected]>

* fix(quota): honor configured Devin tenant for legacy credentials

Co-authored-by: Sayo <[email protected]>

* fix(quota): keep expired Devin windows out of credit fallback

Co-authored-by: Sayo <[email protected]>

* fix(quota): enforce one Devin probe deadline

Co-authored-by: Sayo <[email protected]>

* fix(quota): reject negative Devin used credits

Co-authored-by: Sayo <[email protected]>

---------

Co-authored-by: Sayo <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.

7 participants