Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,9 @@ jobs:
- name: Install dependencies
run: bash scripts/ci/bun-install-frozen.sh . gui

- name: Gateway quota and cache guardrails
run: bun run test:gateway-quota

- name: GUI lint
if: needs.changes.outputs.gui == 'true'
run: |
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Thanks for helping with opencodex.
- Current maintainer invariants live in [`structure/`](./structure); start at [`structure/INDEX.md`](./structure/INDEX.md)
- Maintainer roles and merge policy live in [`MAINTAINERS.md`](./MAINTAINERS.md)
- Attribution for work landed through a maintainer carry lives in [`CREDITS.md`](./CREDITS.md)
- AgentRadar fork maintenance and offline quota checks live in [`FORK.md`](./FORK.md)
- Planning and investigation notes live in [`devlog/`](./devlog); older retired notes remain in git history
- PR screenshots go in the pull request description, never on your branch: drag the image into the
description editor, or, with push access, commit it to the `pr-assets` branch and link it by commit SHA
Expand Down
44 changes: 44 additions & 0 deletions FORK-DELTA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# AgentRadar refresh compatibility inventory

Compared hosted release `v2.65.0-vadymhimself.27` (`d0f166aca52d0cbe3dd132601ae8798aba8e002f`) with upstream `6bae884cbc66306cfbf4e0c2d50ba19fb79305a3` on 2026-11-18. All 99 raw fork-only commits were assigned to behavior groups. Because old port commits squash several concerns, parity was proven per behavior and per test case, not per commit.

## How parity was proven

1. **AR test oracle.** Every test case the AR line added (369) or changed (103) relative to its fork base was extracted from `.27` and run against pure upstream: 96 passed unchanged. Each of the other 376 cases was then resolved with evidence:
- **Carried:** the `.27` test, with only import paths adapted and assertions unchanged, fails on upstream and passes on this branch.
- **Equivalent:** an upstream test asserts the same behavior, or the `.27` test passes unchanged.
- **Replaced-better:** upstream deliberately changed the behavior, with evidence that the replacement is safe and equal or better.
- **Not carried:** the behavior is unreachable for AR traffic or would cause harm. The reason is recorded.
2. **Full upstream suite, both modes.** With `OPENCODEX_AGENTRADAR` unset, the failures are a subset of the pristine-upstream environment failures (same machine, same runner). With `OPENCODEX_AGENTRADAR=1`, the production mode, every failure that does not occur without the flag was triaged. Real hosted regressions were fixed with mutation-checked tests. The remaining flag-only failures are upstream tests that encode upstream-only behavior which hosted mode deliberately replaces with `.27` behavior; each group cites the `.27` behavior.
3. **AR gate.** `bun run test:gateway-quota` runs the AR contract tests in the existing CI `gates` job.

Working ledgers (per case, with commands and evidence) were kept outside the repository during the port; their dispositions are summarized below.

## Hosted contracts carried (gated by `OPENCODEX_AGENTRADAR=1` where upstream deliberately differs)

- **Per-request account pin** (`0c1162dae7` … `fbcc5b2285`): Messages, Chat and `count_tokens` only; refused when malformed or when hosted mode is off. Exact pinned account through every lane, including native Messages. No process-wide selection commit, no rotation off the pin, helpers refused or bound to the pin. The served-account header and the `[ar-acct]` line are written only after a physical send. Real loopback gateway e2e on fake and real-host base URLs; the real-host variant asserts that the native lane served the request.
- **Canonical Anthropic exact relay**: `https://api.anthropic.com/v1/messages` routes take the native lane. The caller's body is forwarded unchanged apart from the wire model and pooled-account metadata. No `ttl` injection, `context_management` is kept, caller betas pass. Upstream SSE and JSON bytes are relayed, with only Content-Type and a bounded Retry-After as headers. A strict SSE tap stops at the first terminal frame and records a root error as failed 502 and a stall as 504. Malformed frames fail before relay. Every rule is scoped to the canonical host; third-party Anthropic-compatible routes keep upstream handling.
- **Deterministic keyed placement** (`0428964be2`, `b60e434917`, `0c4ffad3e3`): rendezvous-hash seat ahead of restored affinity, with the hash runner-up on failover.
- **Pool policy**: a 16-account funded roster, always intersected with the request send budget. A header-less 429 cools the account for 60 seconds and rotates, but is reported to the client as a retryable rate limit, not usage-limit. Cached seven-day exhaustion is a hard hold, with no lazy probe. An org-disabled account rotates and is marked needs-reauth. Terminal re-asks rotate only on 429, quota-400 and org-disabled 403.
- **Quota and refusal handling for all installs**: account rotation on the exact extra-usage and spend-limit 400 envelopes (`45776369ce`). Field-only 400/422 quota evidence (`f4303eb19c`). Family-claim 429s. Pool 401 replay counted at the physical send. Credential-recovery attempt split (upstream #8882 / #8900).
- **Hosted combo policy**: verbatim final Anthropic errors, a 10-minute target cooldown cap (`d3ea59ccb9`) and a quorum-guarded stale-cooldown lift. Spend-limit and free-tier field hops. Combo aliases may carry typed tools to Anthropic targets. Restricted `web_search` keeps its translated fallback.
- **Observability**: the gated usage line (`8ca6f61ec5`) and the privacy-bounded refusal-shape log (`fae0ae4736`). Analytics `physicalBreakdown` and `redAlerts` plus the physical-attempt accounting used by summaries, health, the lab and route explainability. `p<hex6>` Anthropic account labels (`326bdfd7f7`), `comboTargetAdvanced`, cache TTL attribution, the `codex-account-retry` kind, and request-incompatible route traces.
- **Providers and state**: the `xai-apikey` identity (`de6381aa3b`), lower-only response-store environment bounds (`db4cf5cbef`), credit-journal expiry (`326e1a77b7`, co-authored by Gauge), Kimi `usages` precedence (`aa80674b33`), quota explanation (`af51f855b4`), the 20-minute Antigravity paste window (`d6d040ed32`), a 60-second API-key 429 cap, `.27` plan vocabulary for hosted `?quota=1`, and `--code` as an alias of `--headless`.
- **Claude ingress**: hosted exact `count_tokens` (pin-respecting; the `.27` bug that counted on an unpinned pool account is fixed). `prompt_cache_key` on session and parent session. The 5-minute cache default in hosted mode. Image 413 shrink on the native lane. Native-only client tools are refused before send.

## Replaced by upstream (do not reapply)

Native Messages replay (#7374), the server-tool/cache/usage bundle (#7225), per-account recovery usage (#7224), WebSocket/key-429/usage (#7389), redirect refusal (#8868), funded roster (#8871), cache boundary (#8212), native Codex refresh/revocation (#6515/#6523), combo admission ladder (#7355), Claude session-id extraction, and modern catalog rows (#8893; upstream prices kept). Old port-repair commits, version stamps and old manifests are not runtime value.

## Not carried, with reason

- Physical `count_tokens` for non-hosted installs: upstream estimates locally and spends nothing.
- The `.27` lazy weekly usage probe: replaced by the cached gate plus in-request rotation, which avoids the stale-observation race.
- The 4,096-frame inspector cap: it disabled accounting after one bursty read.
- The translated-path citation carrier: unreachable for AR after the canonical native lane.
- Fable temperature 0.3: Anthropic rejects it.
- Old fork release publisher: incompatible with upstream CI policy; see `FORK.md`.

## Known pre-existing failures

The suites listed in `FORK.md` fail identically on pristine upstream on the same machine: Rust ocx-child link (Xcode licence), service and route-to-home sandbox ownership, the catalog `models_cache.json` serve-options row, cli-connect-readiness, codex composed acceptance, update-stop-first, bun-install-frozen and test-git-isolation.
46 changes: 46 additions & 0 deletions FORK-VERIFICATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# AR rebuild validation — 2026-11-19

## Inputs and boundaries

- Fixed upstream base: `6bae884cbc66306cfbf4e0c2d50ba19fb79305a3` (upstream package 2.100.0).
- Compatibility reference: `v2.65.0-vadymhimself.27`, `d0f166aca52d0cbe3dd132601ae8798aba8e002f`.
- Superseding build version: `2.100.0-vadymhimself.2`. The initial `.1` artifact is on HOLD and must not be installed.
- Runtime: pinned Bun 1.4.4. Tests use isolated HOME/OPENCODEX_HOME, synthetic credentials and loopback providers. Running laptop, Mini and hosted gateways were not replaced or deployed.
- Git history was not rebased or force-pushed; this is a fresh upstream-derived branch with the AR overlay reapplied.

## Evidence

| Check | Result | Meaning |
| --- | --- | --- |
| Pristine upstream full suite | 69,990 pass / 753 skip / 33 fail | Same-machine baseline, not a green full suite. |
| Rebuild full suite, hosted flag unset | 70,276 pass / 753 skip / 32 fail | Every failing test also fails on pristine upstream; no new failure names. |
| Rebuild full suite, hosted flag enabled | 69,985 pass / 753 skip / 323 fail | Hosted-only failures were grouped and reviewed against the intentional `.27` contract. These include upstream-only expectations for rewriting native bytes, 502 vs 504, six-account rosters, one-hour cache TTL, and sanitizing canonical server-tool history. Not a green full-suite result. |
| Final repaired AR gate | 534 pass / 0 fail across 29 files | Real-handler budget, cache-prefix, account pin, native fidelity, quota evidence, accounting, count-tokens and final boundary regressions. The metadata-only `.2` version stamp follows these checks. |
| Typecheck, structure, privacy, diff check | Pass | Final version-stamped source. |
| Layout and file-size contracts | 38 pass / 0 fail | No baseline caps increased. |
| Dashboard/package build | Pass | Current upstream dependency versions and lockfiles retained. |
| Extracted package smoke | Pass | CLI reports the fork version, health endpoint returns 200, dashboard serves built HTML from an isolated home. |
| Live Claude cache parity | Blocked | User-authorized laptop probes hit Anthropic 429s. Waterfall used OpenAI; those cache hits do not establish Claude parity. |
| GitHub Actions | Unavailable | The fork rejects workflow dispatch with Actions disabled. No successful GitHub CI is claimed. |

The complete suites preceded the final small sidecar unused-reservation refund and version stamp. Those final changes were validated by the final AR gate, including Error and AbortError refund regressions, and all static/layout/file-size checks. The package smoke uses the final packed files.

## Compatibility method

The committed fork contained 99 fork-only commits, many of them mixed historical port squashes. A semantic inventory classified those changes. An additional oracle extracted 369 fork-added test cases and 103 modified test cases relative to the common base. Port owners recorded whether each behavior was carried, equivalent upstream, intentionally replaced, or unreachable. Literal `.27` tests that depend on removed internal modules were adapted to current seams, with fixture/assertion changes recorded in the working ledgers. The current contract and intentional replacements are summarized in `FORK-DELTA.md`.

Hosted-only full-suite failures were separately triaged across three disjoint slices. Confirmed defects found during that pass were fixed with focused regressions: canonical-only relay scope; response-header filtering; local error-frame identity preservation; combo-alias typed-tool eligibility; anchored quota evidence; classification before verbatim error presentation; retryable headerless 429s; restricted-search fallback; operator advisor opt-out; pinned count-tokens selection and unavailable-route fallback. Existing explicitly configured third-party native passthrough remains supported.

This is evidence for the exercised contracts, not a guarantee that every possible production configuration has been tested. The hosted deployment's actual secret-bearing configuration was not copied into the test tree. Read `FORK.md` before adapting the release pipeline or cutting over an existing gateway.

## Known environment failures

The paired baseline identifies local Rust/Xcode licence failures, sandbox/service ownership and route-intent fixtures, missing Codex catalog cache, connected-runtime probe expectations, composed Codex acceptance and update-stop-first. Some additional timing tests fail in broad runs and pass alone. These are disclosed, not retried into a blanket green claim.

## Delivery boundary

The build is a tarball candidate, not an npm publication, GitHub release tag, merge, deployment or installed runtime replacement. The old fork publisher requires a successful exact-SHA push-CI event that current upstream intentionally no longer creates. No gate was weakened to disguise that incompatibility.

## Final boundary-review correction

A bounded final independent review found two blockers after the initial `.1` package: the strict SSE EOF tail bypassed frame validation, and hosted OAuth token counts could dispatch a captured credential after its account changed during pacing. The initial artifact was explicitly marked HOLD and PR #46 converted to draft. The superseding build validates EOF tails before enqueue and revalidates the same OAuth authority immediately before physical count dispatch. Controlled regressions cover malformed/non-object/invalid-UTF-8 EOF tails and queued pause/removal/credential replacement/cancellation. The token-count response also bounds Retry-After. Focused results for this repair are recorded in the PR; the full-suite results above predate the repair.
33 changes: 33 additions & 0 deletions FORK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# AgentRadar gateway overlay

This branch starts from upstream `lidge-jun/opencodex` development history, not from the old fork's accumulated port commits. The refresh baseline is `6bae884cbc66306cfbf4e0c2d50ba19fb79305a3` (2026-11-18). The source gateway release for the compatibility inventory is `v2.65.0-vadymhimself.27` (`d0f166aca52d0cbe3dd132601ae8798aba8e002f`).

What was carried, replaced or dropped is in [FORK-DELTA.md](./FORK-DELTA.md). Exact validation results and their limits are in [FORK-VERIFICATION.md](./FORK-VERIFICATION.md).

Hosted gateways run with `OPENCODEX_AGENTRADAR=1`. Every AR behavior that deliberately differs from upstream is behind that flag. Without it, this branch behaves like upstream except for generic defect fixes that apply to all installs.

## Maintenance contract

- Keep upstream implementation, dependency versions, generated catalogs and release machinery unless an explicitly documented hosted requirement needs an overlay. A different commit hash does not establish a missing fix: upstream often lands fixes through squash merges or maintainer carries.
- Keep hosted account binding, serving-account visibility and deterministic session placement in a small, tested overlay. Do not replace upstream routing or retry implementations wholesale to preserve these entry points.
- Preserve upstream request-wide physical-send accounting, cancellation, refusal evidence, credential ownership and committed-output boundaries. The hosted 16-account roster is always intersected with the request send budget.
- To branch new gateway work, start from this line. PRs against the old `release/2.65.0-vadymhimself.*` branches are stale and must be re-cut here.
- Keep every genuinely missing generic fix in a separately attributable change so it can be removed when the upstream implementation lands. Record the upstream PR and the original fork commit.
- Refresh from a fixed upstream SHA in a new isolated worktree. Compare the overlay against current upstream behavior, drop equivalents and apply only the remaining changes. Do not rewrite a published release branch, rebase open upstream PRs, force-push, or carry the old baseline's generated files and dependency manifests over newer upstream versions.
- Do not copy local credentials, account databases, logs or deployment configuration into a refresh worktree. Synthetic credentials and loopback mock providers are sufficient for compatibility tests.

## Gateway checks

Run `bun run test:gateway-quota` in addition to the affected suites and the standard typecheck, structure and privacy checks. The command is included in the existing CI `gates` job without changing its triggers, permissions or runner selection.

The gateway gate exercises the AR account pin through real loopback gateway processes, exact canonical Anthropic relay, hosted pool and combo policy, physical-send bounds, funded-roster limits, sidecar reservation ownership, quota-echo resistance, `count_tokens`, analytics and usage logs. Each hosted test sets the flag itself, so the gate runs in the existing CI job without it. An offline pass proves the asserted wire/accounting contracts, not a live Anthropic cache-hit rate or production cost reduction. Missing GitHub checks are not a pass.

For the next refresh, also run the full suite with `OPENCODEX_AGENTRADAR=1` and triage every failure that does not occur without the flag. Upstream tests encode upstream behavior, so a hosted failure is acceptable only when it matches a documented `.27` behavior. Pre-existing environment failures on this machine: Rust ocx-child link (Xcode licence), service and route-to-home sandbox ownership, the catalog `models_cache.json` serve-options row, cli-connect-readiness, codex composed acceptance, update-stop-first, bun-install-frozen and test-git-isolation.

## Release boundary

Preparing this branch does not replace the running gateway or authorize publication. Keep the current laptop build and hosted release line intact until the candidate is validated and deployment is explicitly approved.

The old fork publishes through `.github/workflows/fork-release.yml` after successful exact-SHA push CI on its release line. Current upstream deliberately has no push CI trigger and uses a different release-evidence contract. These workflows are not interchangeable. The refresh does not copy the old publisher, enable Actions, weaken its successful-CI requirement, add release triggers or publish a tag. Release integration requires a separate reviewed change before any cutover.

The initial publication of a new `release/2.100.0-vadymhimself` branch was rejected by the existing required `ci` rule while Actions was disabled. The pristine reference is `baseline/ar-upstream-2026-11-18`; the candidate overlay is `port/ar-on-upstream-2026-11-18`. The rebuild PR targets that reference for a bounded diff. No release-branch protection was bypassed or changed.
2 changes: 1 addition & 1 deletion desktop/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "opencodex-desktop"
version = "2.100.0"
version = "2.100.0-vadymhimself.2"
description = "OpenCodex desktop shell"
authors = ["OpenCodex contributors"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion desktop/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "OpenCodex",
"version": "2.100.0",
"version": "2.100.0-vadymhimself.2",
"identifier": "com.opencodex.desktop",
"build": {
"frontendDist": "../ui",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ocx init

`ocx init` te guía por estos pasos:

1. **Elegir un proveedor**: selecciona uno de los 108 preajustes del registro integrado o `custom` para introducir una URL base y un adaptador.
1. **Elegir un proveedor**: selecciona uno de los 109 preajustes del registro integrado o `custom` para introducir una URL base y un adaptador.
2. **Clave API**: pega una clave o indica una variable de entorno como `${ANTHROPIC_API_KEY}`.
3. **Modelo predeterminado**: para proveedores con clave, locales o personalizados, acepta el preajuste o introduce un identificador de modelo.
4. **Puerto del proxy**: `10100` de forma predeterminada.
Expand Down
Loading