Skip to content

Commit ae9741a

Browse files
committed
Merge remote-tracking branch 'origin/dev' into fix/codex-spark-quota-scope-dev
# Conflicts: # src/codex/auth-context.ts # src/codex/routing.ts # src/server/responses/core.ts
2 parents c2af95b + c380ef7 commit ae9741a

108 files changed

Lines changed: 5158 additions & 411 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/scripts/issue-quality.cjs‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,10 @@ function detectIssueKind(issue) {
374374
// ---------------------------------------------------------------------------
375375

376376
function isEmpty(text) {
377-
return clean(text).length === 0;
377+
const c = clean(text);
378+
if (c.length === 0) return true;
379+
// Stand-ins like "...", "…", "---" are not actionable report content.
380+
return /^[\p{P}\p{S}\s]+$/u.test(c);
378381
}
379382

380383
function allSameCanonical(sections) {
@@ -642,6 +645,17 @@ function validateIssue(issue) {
642645
reasons.push("Both Summary and Reproduction are empty.");
643646
guidance.push("Describe what happened and how to reproduce it.");
644647
}
648+
} else {
649+
// Each mapped field is required on its own — a filled Summary with an
650+
// empty / ellipsis Reproduction (e.g. #598) must not pass.
651+
if (isEmpty(summary)) {
652+
reasons.push("Summary is empty.");
653+
guidance.push("Describe what happened (the symptom or error).");
654+
}
655+
if (isEmpty(repro)) {
656+
reasons.push("Reproduction is empty.");
657+
guidance.push("List the exact steps to reproduce the problem.");
658+
}
645659
}
646660

647661
// Required environment fields removed after submission.

‎.github/scripts/issue-quality.test.cjs‎

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ describe("validateIssue - feature", () => {
362362
assert.equal(result.kind, "feature");
363363
assert.equal(result.valid, false, `Expected terse goal "${goal}" to be invalid`);
364364
assert.ok(
365-
result.reasons.some((r) => r.includes("too vague")),
366-
`Expected too vague reason for "${goal}", got: ${result.reasons.join(", ")}`,
365+
result.reasons.some((r) => r.includes("too vague") || /missing or empty/i.test(r)),
366+
`Expected too vague or empty reason for "${goal}", got: ${result.reasons.join(", ")}`,
367367
);
368368
}
369369
});
@@ -536,6 +536,70 @@ describe("validateIssue - bug", () => {
536536
assert.equal(result.valid, false);
537537
});
538538

539+
it("rejects a bug with Summary filled but Reproduction empty", () => {
540+
const body = [
541+
"### Client or integration",
542+
"Codex CLI",
543+
"### Area",
544+
"CLI",
545+
"### Summary",
546+
"The 'gpt-5.6-sol' model is not supported when using Codex with a ChatGPT account.",
547+
"### Reproduction",
548+
"No response",
549+
"### Version",
550+
"2.7.42",
551+
"### Operating system",
552+
"macOS",
553+
].join("\n");
554+
const result = validateIssue({ title: "Open Codex Error", body, labels: ["bug"] });
555+
assert.equal(result.kind, "bug");
556+
assert.equal(result.valid, false);
557+
assert.ok(result.reasons.some((r) => /Reproduction is empty/i.test(r)));
558+
assert.ok(!result.reasons.some((r) => /Summary is empty/i.test(r)));
559+
});
560+
561+
it("rejects a bug whose Reproduction is only an ellipsis (#598)", () => {
562+
const body = [
563+
"### Client or integration",
564+
"Codex CLI",
565+
"### Area",
566+
"CLI",
567+
"### Summary",
568+
"{\"detail\":\"The 'gpt-5.6-sol' model is not supported when using Codex with a ChatGPT account.\"}",
569+
"### Reproduction",
570+
"...",
571+
"### Version",
572+
"2.7.42",
573+
"### Operating system",
574+
"mac os",
575+
].join("\n");
576+
const result = validateIssue({ title: "Open Codex Error", body, labels: ["bug"] });
577+
assert.equal(result.kind, "bug");
578+
assert.equal(result.valid, false);
579+
assert.ok(result.reasons.some((r) => /Reproduction is empty/i.test(r)));
580+
});
581+
582+
it("rejects a bug with Reproduction filled but Summary empty", () => {
583+
const body = [
584+
"### Client or integration",
585+
"Codex CLI",
586+
"### Area",
587+
"CLI",
588+
"### Summary",
589+
"",
590+
"### Reproduction",
591+
"1. Run ocx start\n2. Send a request",
592+
"### Version",
593+
"2.7.42",
594+
"### Operating system",
595+
"macOS",
596+
].join("\n");
597+
const result = validateIssue({ title: "Crash", body, labels: ["bug"] });
598+
assert.equal(result.kind, "bug");
599+
assert.equal(result.valid, false);
600+
assert.ok(result.reasons.some((r) => /Summary is empty/i.test(r)));
601+
});
602+
539603
it("accepts a terse real crash report", () => {
540604
const body = [
541605
"### Client or integration",

‎.github/workflows/react-doctor.yml‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# React Doctor — finds security, performance, correctness, accessibility,
22
# bundle-size, and architecture issues in React codebases.
33
#
4-
# Advisory-only and least-privilege: findings appear in the step log and the
5-
# Actions run summary. All write-scoped outputs (sticky PR comments, inline
6-
# review comments, commit statuses) are explicitly disabled so the workflow
7-
# needs no write permissions. Do not re-add write scopes without revisiting
8-
# tests/ci-workflows.test.ts, which pins this contract.
4+
# Gating and least-privilege: findings fail the job (`blocking: warning`).
5+
# Write-scoped outputs (sticky PR comments, inline review comments, commit
6+
# statuses) stay disabled so the workflow needs no write permissions. Do not
7+
# re-add write scopes without revisiting tests/ci-workflows.test.ts, which
8+
# pins this contract.
99
#
10-
# Docs: https://www.react.doctor/ci
10+
# Docs: https://www.react.doctor/docs/ci-and-prs/github-actions-setup
1111
# Source: https://github.com/millionco/react-doctor
1212

1313
name: React Doctor
@@ -24,7 +24,7 @@ permissions:
2424
contents: read
2525
# Needed so the action can list PR files for --changed-files-from.
2626
# Without this, listFiles fails, the changed-files file is never written,
27-
# and the CLI exits 1 on ENOENT even with blocking: none (fork PRs).
27+
# and the CLI exits 1 on ENOENT even for fork PRs.
2828
pull-requests: read
2929

3030
# Cancels any in-flight scan for the same PR (or branch, on push) the moment a
@@ -50,9 +50,9 @@ jobs:
5050
directory: gui
5151
# Pin the npm engine — the action wrapper would otherwise fetch
5252
# react-doctor@latest, silently skewing CI from the local pinned runs.
53-
version: "0.9.1"
54-
# Advisory contract: report to the step log only; never gate, never write.
55-
blocking: none
53+
version: "0.9.2"
54+
# Fail the job on any finding (errors or warnings).
55+
blocking: warning
5656
comment: false
5757
review-comments: false
5858
commit-status: false

‎docs-site/src/content/docs/getting-started/how-it-works.mdx‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ account before the request is forwarded upstream. The rule is intentionally spli
3232
- **Existing thread ids keep affinity.** A thread is bound to the account generation that started it,
3333
so a long SSH, tmux, or mobile-attached Codex session keeps using one account instead of being
3434
rebalanced mid-conversation.
35-
- **New sessions can rebalance.** For a new thread, opencodex compares known quota usage across 5h,
36-
weekly, and 30d windows, skips accounts that need reauthentication or are in cooldown, and can
37-
switch to a lower-usage eligible account when the active account crosses the configured threshold.
35+
- **New sessions can rebalance.** For a new thread, opencodex picks among eligible accounts using
36+
`accountPoolStrategy` (`quota` by default, or `round-robin` / `fill-first`). The `quota` strategy
37+
compares known usage across 5h, weekly, and 30d windows and can switch to a lower-usage account
38+
when the active account crosses `autoSwitchThreshold`. Accounts in cooldown or needing
39+
reauthentication are skipped regardless of strategy.
3840
- **Quota and failure signals feed routing.** The dashboard can force a quota refresh with
3941
`GET /api/codex-auth/accounts?refresh=1`; successful upstream responses capture quota headers,
4042
429 puts an account in cooldown, and 401/403 marks it for reauthentication.

‎docs-site/src/content/docs/guides/claude-code.md‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ You can log in multiple Claude accounts via the Providers dashboard (`ocx login
1313
add-account). By default every request uses the **active** account only.
1414

1515
An **experimental, opt-in** Claude account pool (`anthropicAccountPool.enabled`) adds sticky
16-
session affinity and 429 cooldown failover across those OAuth accounts, with optional
17-
new-session lowest-usage pick from the 5-hour quota bars. It is **off by default**, shows a
18-
GUI warning, and is not battle-tested — Anthropic may restrict accounts that look like
19-
automated rotation.
16+
session affinity and 429 cooldown failover across those OAuth accounts. For **new** sessions
17+
only, `anthropicAccountPool.strategy` selects among eligible accounts: `quota` (default) picks
18+
lowest known 5-hour usage when above `autoSwitchThreshold`; `round-robin` spreads evenly
19+
(`stickyLimit`, default `1`); `fill-first` drains the active account until cooldown,
20+
reauthentication, or threshold, then advances. It is **off by default**, shows a GUI warning,
21+
and is not battle-tested — Anthropic may restrict accounts that look like automated rotation;
22+
rotation does not protect against provider enforcement.
2023

2124
Operational contract when enabled:
2225

‎docs-site/src/content/docs/guides/codex-integration.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ Standalone `/images/generations` calls never enter that bridge.
6363
tool offered at all, disable it in Codex with `codex features disable image_generation`
6464
(`[features] image_generation = false` in `config.toml`).
6565

66+
The tool declaration still travels with the model's Responses request. For API-key Responses
67+
providers, opencodex lowers Codex's private `image_gen` namespace to an upstream-safe
68+
`image_gen__<inner-name>` alias (for example `image_gen__imagegen`). When that usable alias replaces
69+
the client declaration, opencodex removes a duplicate hosted `image_generation` declaration. It maps
70+
the function call to the explicit `image_gen` namespace before Codex sees it, and encodes the native
71+
call again when later history is replayed upstream. This keeps client-side image generation callable
72+
on public-compatible upstreams that reserve the namespace or reject dotted function names. ChatGPT
73+
forward mode remains untouched and keeps its native Responses Lite shape.
74+
6675
For an OpenAI-compatible custom gateway, configure a dedicated provider and select it only for
6776
standalone Images requests:
6877

‎docs-site/src/content/docs/guides/providers.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ ocx logout <provider>
9090
| `cursor` | `cursor` | `https://api2.cursor.sh` | Experimental PKCE login, live HTTP/2 transport, and account-filtered model discovery. |
9191
| `github-copilot` | `openai-chat` | `https://api.githubcopilot.com` | Experimental. GitHub device flow + `copilot_internal` exchange (VS Code OAuth client). Requires an active Copilot subscription; not an official third-party API. |
9292

93+
For the canonical Kimi Coding Plan presets (`kimi` account login and `kimi-code` API key),
94+
opencodex forwards only a caller-supplied stable `prompt_cache_key` to the Chat Completions request;
95+
it never generates one. Kimi documents a stable session/task key as required to improve Code Plan
96+
cache hit rates, while requests without a key remain keyless. If an opted-in upstream rejects the
97+
field, opencodex does not strip it and retry or mutate saved configuration. Other providers remain
98+
deny-by-default.
99+
93100
You can also start OAuth from the [web dashboard](/guides/web-dashboard/).
94101

95102
### Multiple OAuth accounts

‎docs-site/src/content/docs/ja/guides/codex-integration.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ ChatGPT bearer 認証で直接 POST します。注入された `base_url` が o
5757
`codex features disable image_generation`(`config.toml` の `[features] image_generation = false`)を
5858
使ってください。
5959

60+
ツール宣言はモデルへの Responses リクエストにも引き続き含まれます。API キー方式の Responses
61+
プロバイダーでは、opencodex は Codex のプライベートな `image_gen` 名前空間を、上流で安全な
62+
`image_gen__<inner-name>` エイリアス(例: `image_gen__imagegen`)に変換します。その利用可能な
63+
エイリアスがクライアント宣言を置き換える場合にのみ、重複する hosted `image_generation` 宣言を
64+
削除します。関数呼び出しは Codex に届く前に明示的な `image_gen` 名前空間へ戻され、後続の履歴を
65+
上流へ再送するときは再びエンコードされます。これにより、名前空間を予約している、またはドットを
66+
含む関数名を拒否する OpenAI 互換の上流でも、クライアント側の画像生成を呼び出せます。ChatGPT
67+
forward モードは変更されず、ネイティブな Responses Lite 形式を維持します。
68+
6069
`hostname` がループバックアドレスでない場合、Codex が自動生成した API 認証ヘッダーを送る必要があります。このとき専用
6170
プロバイダーを注入します。
6271

‎docs-site/src/content/docs/ja/guides/providers.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ ocx logout <provider>
8484
| `google-antigravity` | `google` | `https://daily-cloudcode-pa.googleapis.com` | Google OAuth を Cloud Code Assist wire で使用。 |
8585
| `cursor` | `cursor` | `https://api2.cursor.sh` | 実験的 PKCE ログイン、HTTP/2 トランスポート、アカウント別モデル探索をサポート。 |
8686

87+
正規の Kimi Coding Plan プリセット(`kimi` アカウントログインと `kimi-code` API key)では、
88+
opencodex は呼び出し元が指定した安定した `prompt_cache_key` だけを Chat Completions リクエストへ
89+
転送し、自ら生成しません。Kimi のドキュメントでは、Code Plan のキャッシュヒット率を高めるために
90+
安定したセッション/タスク key が必須とされています。key のないリクエストは keyless のままです。
91+
opt-in した上流がこのフィールドを拒否しても、opencodex はフィールドを削除して再試行したり、保存済み
92+
設定を変更したりしません。他のプロバイダーは deny-by-default のままです。
93+
8794
[ウェブダッシュボード](/ja/guides/web-dashboard/)からも OAuth を開始できます。
8895

8996
### 複数の OAuth アカウント

‎docs-site/src/content/docs/ja/reference/adapters.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ interface ProviderAdapter {
4545
## `anthropic`
4646

4747
**対象:** Anthropic **Messages**(`/v1/messages`)。
48-
**認証:** `key`(`x-api-key`)または `oauth`(Bearer + `anthropic-beta`、Claude Pro/Max 用)。
48+
**認証:** `key`(デフォルトは `x-api-key`、または `apiKeyTransport: "bearer"` による `Authorization: Bearer`)または `oauth`(Bearer + `anthropic-beta`、Claude Pro/Max 用)。
4949

5050
- メッセージを Anthropic content block(text、base64 image、`tool_use`、`thinking`)に変換します。
5151
- **Extended thinking の計算:** Anthropic は `max_tokens > thinking.budget_tokens` を要求します。

0 commit comments

Comments
 (0)