From 20c4431c26d791a470f3daed650828701d0c3e66 Mon Sep 17 00:00:00 2001 From: Vadym O Date: Fri, 6 Nov 2026 12:19:23 +0800 Subject: [PATCH 1/2] ci(fork): green CI on release/* branches - ci.yml push trigger gains release/** so a release branch gets the push-event run a tag gates on; enforce-pr-target accepts release/* bases. - Quarantine 5 release-preflight scenarios on -vadymhimself versions: they run upstream's npm policy, and the fork never publishes to npm (GW-CD-19243). - Bump the version sources to 2.65.0-vadymhimself.16 after the .15 tag. - Baseline the files that grew past their ratchet cap. - Keep the main account's last-known plan only on a terminal auth failure: a transient usage-read failure left a stale plan in place, so stale quota was no longer reported as unknown-plan coverage-only (regressed by b93f22bbc). Co-Authored-By: Claude Code --- .github/workflows/ci.yml | 5 ++-- .github/workflows/enforce-pr-target.yml | 6 ++-- desktop/src-tauri/Cargo.lock | 2 +- desktop/src-tauri/Cargo.toml | 2 +- desktop/src-tauri/tauri.conf.json | 2 +- package.json | 2 +- src/codex/auth-api/main-account-probe.ts | 7 +++-- tests/ci-workflows/ci-review-lanes.test.ts | 2 +- tests/ci-workflows/ci-scope-reduction.test.ts | 4 +-- tests/ci-workflows/ci-workflows.test.ts | 28 +++++++++++++++++++ tests/ci-workflows/release-preflight.test.ts | 14 ++++++---- tests/fixtures/file-size-baseline.json | 6 ++-- 12 files changed, 59 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af09564cd08..72af24c514c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,9 +28,10 @@ on: # main and preview MUST stay: release.yml requires a successful # push-event Cross-platform CI run for the exact release SHA and states # that a pull-request run does not qualify, so removing either branch - # breaks publication. + # breaks publication. release/** is the fork's release line: fork-release.yml + # demands the same push-event run for the tagged SHA on its release branch. push: - branches: [main, preview] + branches: [main, preview, 'release/**'] paths: - "Dockerfile" - "compose.yaml" diff --git a/.github/workflows/enforce-pr-target.yml b/.github/workflows/enforce-pr-target.yml index cd8ad762e1e..0c1beb0d090 100644 --- a/.github/workflows/enforce-pr-target.yml +++ b/.github/workflows/enforce-pr-target.yml @@ -651,7 +651,8 @@ jobs: let behindBase = 0; let aheadMain = 0; let ancestryLookupFailed = false; - const baseAllowed = ALLOWED_BASES.includes(pr.base.ref); + // Fork release lines (release/) take PRs too; a tag is cut only from them. + const baseAllowed = ALLOWED_BASES.includes(pr.base.ref) || pr.base.ref.startsWith("release/"); // Stacked PR exception: base is another open PR's head branch (same // head repo as this PR's base repo). Closed/missing parent stays wrong_base. @@ -760,7 +761,8 @@ jobs: let failures = collectPrQualityFailures({ baseRef: pr.base.ref, - allowedBases: ALLOWED_BASES, + // pr-quality.cjs is checked out from dev; widen its allow-list for this PR's own base here. + allowedBases: baseAllowed ? [pr.base.ref] : ALLOWED_BASES, title: pr.title, body: pr.body, behindMain, diff --git a/desktop/src-tauri/Cargo.lock b/desktop/src-tauri/Cargo.lock index 9408dd3e89f..7f4be96ed9f 100644 --- a/desktop/src-tauri/Cargo.lock +++ b/desktop/src-tauri/Cargo.lock @@ -2541,7 +2541,7 @@ dependencies = [ [[package]] name = "opencodex-desktop" -version = "2.65.0-vadymhimself.15" +version = "2.65.0-vadymhimself.16" dependencies = [ "dbus", "reqwest 0.12.24", diff --git a/desktop/src-tauri/Cargo.toml b/desktop/src-tauri/Cargo.toml index 7218fb16c2a..1eadc759b33 100644 --- a/desktop/src-tauri/Cargo.toml +++ b/desktop/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "opencodex-desktop" -version = "2.65.0-vadymhimself.15" +version = "2.65.0-vadymhimself.16" description = "OpenCodex desktop shell" authors = ["OpenCodex contributors"] license = "MIT" diff --git a/desktop/src-tauri/tauri.conf.json b/desktop/src-tauri/tauri.conf.json index 33b77b6426c..48ea7b3fcf5 100644 --- a/desktop/src-tauri/tauri.conf.json +++ b/desktop/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "OpenCodex", - "version": "2.65.0-vadymhimself.15", + "version": "2.65.0-vadymhimself.16", "identifier": "com.opencodex.desktop", "build": { "frontendDist": "../ui", diff --git a/package.json b/package.json index 94e9f24fe82..d020d2025ff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bitkyc08/opencodex", - "version": "2.65.0-vadymhimself.15", + "version": "2.65.0-vadymhimself.16", "description": "Universal provider proxy for OpenAI Codex & Claude Code — use any LLM with Codex CLI/App/SDK and Claude Code", "type": "module", "main": "./bin/package-main.mjs", diff --git a/src/codex/auth-api/main-account-probe.ts b/src/codex/auth-api/main-account-probe.ts index e97c21b5b26..902252b707d 100644 --- a/src/codex/auth-api/main-account-probe.ts +++ b/src/codex/auth-api/main-account-probe.ts @@ -245,9 +245,12 @@ export async function fetchMainAccountInfoWhileOwned( markAccountNeedsReauth(MAIN_CODEX_ACCOUNT_ID, writerGeneration); } // Keep the last-known plan visible: after a plan change revokes the session, the plan the - // account HAD is what tells the operator why it stopped working. + // account HAD is what tells the operator why it stopped working. A transient failure proves + // nothing about the plan, so it stays unknown and stale quota is reported as coverage-only. return { - info: { ...EMPTY_MAIN_ACCOUNT_INFO, plan: nonEmptyPlan(cached?.plan) ?? nonEmptyPlan(getMainAccountPlan()) }, + info: terminalAuthFailure + ? { ...EMPTY_MAIN_ACCOUNT_INFO, plan: nonEmptyPlan(cached?.plan) ?? nonEmptyPlan(getMainAccountPlan()) } + : EMPTY_MAIN_ACCOUNT_INFO, credentialChecked: true, hasCredential: true, quotaRefresh: { status: "http_error", httpStatus: resp.status, ...(authFailure.code ? { code: authFailure.code } : {}) }, diff --git a/tests/ci-workflows/ci-review-lanes.test.ts b/tests/ci-workflows/ci-review-lanes.test.ts index b06de5b7300..dd09260d184 100644 --- a/tests/ci-workflows/ci-review-lanes.test.ts +++ b/tests/ci-workflows/ci-review-lanes.test.ts @@ -72,7 +72,7 @@ describe("CI review lanes", () => { jobs?: Record | undefined>; }; expect([...(ci.on?.push?.branches ?? [])].sort()) - .toEqual(["main", "preview"]); + .toEqual(["main", "preview", "release/**"]); // The PR trigger must carry NO base-branch filter, and the two triggers // differ on purpose. GitHub matches `branches:` against the BASE ref, so diff --git a/tests/ci-workflows/ci-scope-reduction.test.ts b/tests/ci-workflows/ci-scope-reduction.test.ts index 2023c551b58..40f30d4d9d7 100644 --- a/tests/ci-workflows/ci-scope-reduction.test.ts +++ b/tests/ci-workflows/ci-scope-reduction.test.ts @@ -293,14 +293,14 @@ function runGate(inputs: GateInputs, results: Record): { gatedJo } describe("the push trigger", () => { - test("carries main and preview, and no longer dev", () => { + test("carries main, preview and the fork release lines, and no longer dev", () => { // main and preview must stay: release.yml requires a successful push-event // run for the exact release SHA and states that a pull_request run does not // qualify, so removing either breaks publication. dev is the deliberate // removal — its integration evidence is the pull_request run, and // workflow_dispatch covers anything else — so the push run stopped doubling // the full matrix behind a merge that was just verified as a PR. - expect([...(workflow.on?.push?.branches ?? [])].sort()).toEqual(["main", "preview"]); + expect([...(workflow.on?.push?.branches ?? [])].sort()).toEqual(["main", "preview", "release/**"]); }); }); diff --git a/tests/ci-workflows/ci-workflows.test.ts b/tests/ci-workflows/ci-workflows.test.ts index 2e0c8036f8b..99685b5190f 100644 --- a/tests/ci-workflows/ci-workflows.test.ts +++ b/tests/ci-workflows/ci-workflows.test.ts @@ -3875,6 +3875,34 @@ describe("GitHub Actions hardening", () => { expect(result.warnings.some((w) => w.startsWith("setFailed:"))).toBe(true); }); + test("a fork release-line base is allowed", async () => { + const result = await run({ + pr: { base: { ref: "release/2.65.0-vadymhimself.16" }, title: "Release fix", draft: false }, + authorPermission: "write", + }); + + expect(methodsOf(result)).toEqual(readsAllowedBase()); + expect(callsTo(result, "pulls.update")).toEqual([]); + expect(result.warnings.some((w) => w.startsWith("setFailed:"))).toBe(false); + }); + + test("a base that only starts with the word release is still wrong-base", async () => { + const result = await run({ + pr: { base: { ref: "releasefoo" }, title: "Not a release", draft: false }, + authorPermission: "write", + }); + + expect(methodsOf(result)).toEqual(readsWrongBase([ + "pulls.update", + "issues.createComment", + "graphql", + ])); + expect(callsTo(result, "pulls.update")).toEqual([ + { owner: "lidge-jun", repo: "opencodex", pull_number: 42, title: "[WRONG BRANCH] Not a release" }, + ]); + expect(result.warnings.some((w) => w.startsWith("setFailed:"))).toBe(true); + }); + test("a non-dev base with no open parent PR is still wrong-base", async () => { const result = await run({ pr: { base: { ref: "feature/orphan" }, title: "Orphan stack", draft: false }, diff --git a/tests/ci-workflows/release-preflight.test.ts b/tests/ci-workflows/release-preflight.test.ts index e53989bb6f8..9dd0047c349 100644 --- a/tests/ci-workflows/release-preflight.test.ts +++ b/tests/ci-workflows/release-preflight.test.ts @@ -94,6 +94,10 @@ const OWN_IS_PREVIEW = OWN_VERSION.includes("-preview."); const OWN_REF = OWN_IS_PREVIEW ? "refs/heads/preview" : "refs/heads/main"; const OWN_TAG = OWN_IS_PREVIEW ? "preview" : "latest"; const NEXT_CORE = `${MAJOR}.${MINOR + 1}.0`; +// Fork quarantine (GW-CD-19243; the fork has issues disabled): these scenarios release the checkout's +// own version through upstream's npm policy (stable semver on main, no version npm already has). A +// `-vadymhimself.N` tree can never satisfy that and the fork never publishes to npm, so they skip there. +const FORK = /-vadymhimself\./.test(OWN_VERSION); const FAKE_GH = [ "#!/bin/sh", @@ -180,7 +184,7 @@ function preflight(scenario: Scenario): { status: number | null; output: string; } describe.skipIf(process.platform === "win32")("scripts/ci/release-preflight.sh, executed", () => { - test("replays run 35783865160: a higher-core tag refuses the release before packaging", () => { + test.skipIf(FORK)("replays run 35783865160: a higher-core tag refuses the release before packaging", () => { const blocker = OWN_IS_PREVIEW ? `v${NEXT_CORE}` : `v${NEXT_CORE}-preview.20260923`; const result = preflight({ tags: ["v0.0.1", blocker] }); expect(result.status, result.output).toBe(1); @@ -189,14 +193,14 @@ describe.skipIf(process.platform === "win32")("scripts/ci/release-preflight.sh, expect(result.summary).toContain(`Release preflight refused ${OWN_VERSION}`); }, SPAWN_BUDGET_MS); - test("passes a release every check can already approve", () => { + test.skipIf(FORK)("passes a release every check can already approve", () => { const result = preflight({ tags: ["v0.0.1"] }); expect(result.status, result.output).toBe(0); expect(result.output).toContain("Release preflight passed"); expect(result.summary).toBe(""); }, SPAWN_BUDGET_MS); - test("refuses a version npm already has unless the run is a dry run", () => { + test.skipIf(FORK)("refuses a version npm already has unless the run is a dry run", () => { const real = preflight({ tags: ["v0.0.1"], npm: "present" }); expect(real.status, real.output).toBe(1); expect(real.output).toContain("already exists on npm"); @@ -217,7 +221,7 @@ describe.skipIf(process.platform === "win32")("scripts/ci/release-preflight.sh, expect(result.output).toContain("is not on npm"); }, SPAWN_BUDGET_MS); - test("warns rather than blocks when npm cannot be read", () => { + test.skipIf(FORK)("warns rather than blocks when npm cannot be read", () => { const result = preflight({ tags: ["v0.0.1"], npm: "unreadable" }); expect(result.status, result.output).toBe(0); expect(result.output).toContain("::warning::Could not read npm"); @@ -232,7 +236,7 @@ describe.skipIf(process.platform === "win32")("scripts/ci/release-preflight.sh, expect(missing.output).toContain("refs/remotes/origin/dev"); }, SPAWN_BUDGET_MS); - test("reports every problem in one run", () => { + test.skipIf(FORK)("reports every problem in one run", () => { const wrongTag = OWN_TAG === "latest" ? "preview" : "latest"; const result = preflight({ tags: ["v0.0.1"], distTag: wrongTag, npm: "present" }); expect(result.status, result.output).toBe(1); diff --git a/tests/fixtures/file-size-baseline.json b/tests/fixtures/file-size-baseline.json index 088890a4758..e10ea43e06f 100644 --- a/tests/fixtures/file-size-baseline.json +++ b/tests/fixtures/file-size-baseline.json @@ -18,7 +18,7 @@ ".github/scripts/issue-quality.test.cjs": 2143, "gui/src/pages/Models.tsx": 2787, "gui/src/styles.css": 2958, - "src/adapters/anthropic.ts": 2031, + "src/adapters/anthropic.ts": 2035, "src/adapters/openai-chat.ts": 820, "src/adapters/openai-responses.ts": 6, "src/bridge.ts": 7, @@ -35,11 +35,11 @@ "src/server/index.ts": 890, "src/server/request-log.ts": 2152, "src/server/responses/core.ts": 210, - "tests/ci-workflows/ci-workflows.test.ts": 5449, + "tests/ci-workflows/ci-workflows.test.ts": 5477, "tests/claude-integration/claude-messages-endpoint.test.ts": 6026, "tests/claude-integration/claude-outbound.test.ts": 2035, "tests/cli/cli-account.test.ts": 2313, - "tests/codex-integration/codex-auth-api.test.ts": 6514, + "tests/codex-integration/codex-auth-api.test.ts": 6544, "tests/codex-integration/codex-auth-context.test.ts": 2433, "tests/codex-integration/codex-catalog.test.ts": 7974, "tests/codex-integration/codex-reset-credit-recovery.test.ts": 2135, From 9c395b57fd77d46d43427831e9c489a72685de22 Mon Sep 17 00:00:00 2001 From: Vadym O Date: Fri, 6 Nov 2026 12:19:23 +0800 Subject: [PATCH 2/2] ci(fork): publish a GitHub Release with a sha256 on a vadymhimself tag New fork-release.yml on `v*-vadymhimself.*` tags, contents: write only, no npm. Refuses unless the tag commit is on main or release/*, a push-event Cross-platform CI run for it on that branch succeeded, and package.json equals the tag. Then npm pack, sha256sum, gh release create --verify-tag. Co-Authored-By: Claude Code --- .github/workflows/fork-release.yml | 81 ++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/fork-release.yml diff --git a/.github/workflows/fork-release.yml b/.github/workflows/fork-release.yml new file mode 100644 index 00000000000..aff0415bde4 --- /dev/null +++ b/.github/workflows/fork-release.yml @@ -0,0 +1,81 @@ +name: Fork release + +# Fork-only (vadymhimself): a `v*-vadymhimself.*` tag publishes a GitHub Release carrying the +# npm tarball and its sha256. No npm publish. Upstream's release.yml is left untouched so syncs +# do not conflict. AgentRadar pulls only releases this workflow created. +on: + push: + tags: ['v*-vadymhimself.*'] + +permissions: + contents: write + +concurrency: + group: fork-release-${{ github.ref }} + cancel-in-progress: false + +jobs: + release: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Require a release branch, its green push CI, and a matching version + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + run: | + set -euo pipefail + branches="$(git branch -r --contains "$GITHUB_SHA" --format='%(refname:short)' \ + | sed -n -E 's#^origin/(main|release/.+)$#\1#p')" + if [ -z "$branches" ]; then + echo "::error::tag ${GITHUB_REF_NAME} (${GITHUB_SHA}) is on no release branch (main or release/*)" + exit 1 + fi + + # Same gate as release.yml: a push-event Cross-platform CI success for this exact SHA on + # the branch itself. A pull-request run does not qualify. + ci_url="" + for branch in $branches; do + ci_url="$(gh run list --workflow ci.yml --branch "$branch" --commit "$GITHUB_SHA" \ + --event push --limit 10 --json conclusion,url \ + --jq '[.[] | select(.conclusion == "success")][0].url // ""')" + [ -n "$ci_url" ] && break + done + if [ -z "$ci_url" ]; then + echo "::error::No successful push-event Cross-platform CI run for ${GITHUB_SHA} on: ${branches//$'\n'/ }" + exit 1 + fi + echo "Cross-platform CI passed for ${GITHUB_SHA} on ${branch}: ${ci_url}" + + version="$(node -p "require('./package.json').version")" + if [ "$version" != "${GITHUB_REF_NAME#v}" ]; then + echo "::error::package.json version ${version} does not match tag ${GITHUB_REF_NAME}" + exit 1 + fi + + - name: Setup project Bun + uses: ./.github/actions/setup-project-bun + + - name: Build the package + run: | + set -euo pipefail + bun install --frozen-lockfile + bun run build:gui + + - name: Pack and publish the GitHub Release + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + run: | + set -euo pipefail + tgz="$(npm pack --silent | tail -n 1)" + sha256sum "$tgz" > "$tgz.sha256" + cat "$tgz.sha256" + gh release create "$GITHUB_REF_NAME" "$tgz" "$tgz.sha256" --verify-tag \ + --title "gateway ${GITHUB_REF_NAME#v}" --notes-from-tag