Skip to content

Commit 59964ad

Browse files
authored
fix(codex): emit modern env_key admission line on non-loopback inject (#2076)
* docs(devlog): 260819 triage-execution campaign roadmap (r2-audited) * fix(codex): emit modern env_key admission line on non-loopback inject codex-cli 0.146+ documents env_key as the bearer auth form for custom model providers: it sends Authorization: Bearer $VAR and hard-errors on a missing variable instead of silently omitting the header. The server side already admits and substitutes this bearer (#1686 chain), so the injector was the stale half. Loopback Design B still emits no auth line; the #2061 orphan sub-table cleanup keeps handling historic env_http_headers configs. Closes #2073 * test(codex): pin non-loopback legacy env_http_headers -> env_key upgrade
1 parent abaa75a commit 59964ad

16 files changed

Lines changed: 174 additions & 15 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# 000 — 260819 triage-execution campaign plan
2+
3+
Baseline: 4-lane sol-medium triage (2026-08-19) over 53 open PRs + 75 open
4+
issues. This unit EXECUTES the verdicts. All merges via gh pr merge --admin
5+
(user pre-approved). Issue-closure rule: a merged PR that resolves an issue
6+
closes that issue in the same work-phase.
7+
8+
Live-state reverify (wp0, 2026-08-19): all 14 merge candidates OPEN,
9+
MERGEABLE, base=dev, zero FAILED checks — but NOT all CI-proven: #2061 #2066
10+
#2042 #2072 #2068 #1903 #2075 have no Cross-platform CI run on their exact
11+
heads (only hygiene/enforce-target). mergeStateStatus=BLOCKED is the
12+
review-requirement ruleset; admin merge passes. #1885 CONFLICTING (close
13+
target anyway), #1498 draft+CONFLICTING+red hygiene (close target).
14+
15+
**Pre-merge validation rule (r1 audit fold-back):** a PR without a
16+
Cross-platform CI conclusion on its exact head must NOT be merged on
17+
mergeability alone. Before merging such a PR: scratch-merge its head onto
18+
current dev in a lidge worktree and run the focused suites the diff touches
19+
(plus tsc); only a clean scratch-merge run authorizes the admin merge. The
20+
post-merge push CI on the merge SHA remains the decisive gate; a red
21+
post-merge CI triggers immediate fix-forward or revert of that one merge.
22+
23+
## Work-phase map (dependency-ordered)
24+
25+
| wp | scope | PRs / issues | gate |
26+
|---|---|---|---|
27+
| wp1 | batch-quota | merge #2056 #2055 -> close #2047 #2046 | sol review lane per PR, then admin merge, CI on merge SHA |
28+
| wp2 | batch-small-fixes | merge #2053 #2045 #2061 #2066 -> close #2065 | same |
29+
| wp3 | batch-lab-chat | merge #2042 #2059; re-diff #2075 vs #2042 (prefix-matching claim); #2044 test-gap decision (merge with follow-up test or request change) | same + 2075 contradiction resolution |
30+
| wp4 | batch-features | SERIALIZED: merge #2072 first, then re-diff/re-review/scratch-validate #1903 against post-2072 dev before merging it (both touch src/codex/catalog/provider-fetch.ts + provider docs + 9 GUI locales); then #2068 #2057; close #1885 (superseded by #2072) #1498 (stale/dont-merge) | same + serialization gate |
31+
| wp5 | redesign #2073 | injector env_http_headers -> env_key (codex 0.146+) | C3: wp5's P WRITES 010_env_key_contract.md (contract proof from codex-rs source/release notes via cxc-search) BEFORE impl; impl+tests, PR, admin merge, close #2073 |
32+
| wp6 | redesign #2064 | Remote raw-thinking on empty summary[] | C3: wp6's P WRITES 020_remote_reasoning_leak_rca.md (root-cause in OUR relay; model-side intermittent exposure is out of scope) BEFORE impl; impl+tests, PR, merge, close #2064 |
33+
| wp7 | redesign #1926 | tsig credential scope | C4 security: design 051_tsig_credential_scope.md (fin unit), impl+tests, PR, merge, close #1926 |
34+
| wp8 | redesign #1942 | Windows transactional update rollback | C4: base design 090_transactional_update_rollback.md has a KNOWN path-structure defect (staging/backup as CHILDREN of <prefix> makes the live-prefix swap move them with it, and live cannot move into its own subdirectory) — wp8's P MUST amend the design to sibling-of-prefix staging/backup paths (e.g. <prefix>.ocx-staging-<ts>) before impl; impl+tests, PR, merge, close #1942 |
35+
| wp9 | closeout | final dev-head CI verify, ledger, unit disposition | push-CI green or pre-existing-red classified |
36+
37+
## Review-lane contract (every merge batch)
38+
39+
- One sol-medium read-only reviewer per PR (parallel), packet includes
40+
$codexclaw:cxc-dev + $codexclaw:cxc-search mentions, full diff read,
41+
verdict line MERGE-OK | BLOCK(reason).
42+
- Main agent merges only MERGE-OK PRs; BLOCK verdicts downgrade the PR to
43+
NEEDS-WORK with an evidence comment.
44+
- Merge method: squash when the branch has fixup/noise commits, merge
45+
otherwise.
46+
- Suites: lidge dispatch without long blocking waits; decisive gate is the
47+
Cross-platform CI push run on the merged SHA.
48+
49+
## Known risks
50+
51+
- Seven merge candidates lack head CI (see pre-merge validation rule above);
52+
scratch-merge lidge validation is mandatory for them.
53+
- wp4 #2072/#1903 file overlap (provider-fetch.ts, provider docs, locales):
54+
serialized merge with re-validation between.
55+
- #1942 base design path defect: fixed at wp8 P via design amendment.
56+
- #2075 verdict conflict: 1st-pass ADOPT-NOW vs sol NEEDS-WORK (claims it
57+
reintroduces prefix matching #2042 fixes). Resolve by diffing #2075 head
58+
against #2042 semantics AFTER #2042 lands.
59+
- #2064: reasoning leakage can be intermittent model-side behavior; fix only
60+
what our relay provably does wrong (persisting/rendering raw reasoning when
61+
summary[] is empty).
62+
- Windows dispatch CI leg is known-red pre-campaign (Log Guard families) —
63+
not a gate for these merges.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# 010 — #2073: injector env_key contract (codex-cli 0.146+)
2+
3+
## Contract facts (verified against openai/codex rust-v0.146.0 source, wp5 research lane)
4+
5+
- env_key reads the named env var and sends Authorization: Bearer <value>
6+
(model-provider-info/src/lib.rs#L263-281). Missing/empty var = HARD error
7+
(CodexErr::EnvVar), never an empty bearer.
8+
- env_key + requires_openai_auth = true is valid; env_key WINS for wire auth
9+
(first-party scoped auth disabled), requires_openai_auth keeps login/account
10+
UX (provider.rs#L153-174, auth.rs#L162-178).
11+
- env_http_headers is still honored in 0.146 (not removed), but bearer auth is
12+
the documented modern form.
13+
14+
## Server-side prerequisite (already landed)
15+
16+
#1686 chain (22d5492b2, acfedae0a, f848b4997): /v1/responses admits our
17+
admission secret via Authorization: Bearer and SUBSTITUTES stored main auth
18+
upstream (materializeCodexUpstreamAuth). So an env_key client works end to end
19+
on dev today. The injector is the only stale half (this issue).
20+
21+
## Change
22+
23+
src/codex/inject.ts buildProviderTableBlock (legacy/non-loopback mode only —
24+
loopback Design B emits no auth line at all):
25+
26+
- BEFORE: env_http_headers = { "x-opencodex-api-key" = "OPENCODEX_API_AUTH_TOKEN" }
27+
- AFTER: env_key = "OPENCODEX_API_AUTH_TOKEN"
28+
29+
requires_openai_auth = true stays (login UX; env_key wins wire auth).
30+
Sub-table strip logic from #2061 (env_http_headers orphan cleanup) STAYS — it
31+
cleans historic configs regenerated by the app. stripExistingModelProvider
32+
already removes the whole marker-owned block, so old env_http_headers lines
33+
from prior injections are replaced on next inject (idempotent).
34+
35+
## Behavior deltas (accepted)
36+
37+
- Missing OPENCODEX_API_AUTH_TOKEN in the codex process env: was silent header
38+
omission -> 401; now a clear codex-side hard error. Better diagnosability;
39+
the unauthenticated-loopback-listener case already suppresses the auth line
40+
entirely (shouldInjectApiAuthHeader), so the known no-var environment never
41+
sees env_key.
42+
- The client's own ChatGPT bearer is no longer forwarded on this path (env_key
43+
replaces Authorization); the proxy substitutes stored main auth — exactly the
44+
#1686 design. Hand-configured env_http_headers remains honored by the runtime
45+
for users who want the legacy form.
46+
47+
## Tests
48+
49+
- tests/codex-inject.test.ts:44,194 — flip to env_key expectation + add a
50+
regression that env_http_headers is NOT emitted.
51+
- tests/loopback-listener-admission.test.ts:199 / integration:617 — extend the
52+
not-contains to env_key (loopback emits no auth line).
53+
- Keep #2061 sub-table strip tests untouched.
54+
55+
## Docs
56+
57+
- structure/02_config-and-codex-home.md provider-block sample: update line.
58+
- docs-site reference mentions of env_http_headers (if any) updated.
59+
60+
Verifier: bun test tests/codex-inject.test.ts tests/loopback-listener-admission.test.ts tests/loopback-listener-integration.test.ts + bun x tsc --noEmit.
61+

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ name = "OpenCodex Proxy"
125125
base_url = "http://your-host:10100/v1"
126126
wire_api = "responses"
127127
requires_openai_auth = true
128-
env_http_headers = { "x-opencodex-api-key" = "OPENCODEX_API_AUTH_TOKEN" }
128+
env_key = "OPENCODEX_API_AUTH_TOKEN"
129129
# supports_websockets = true # only when config.websockets is true
130130
```
131131

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ name = "OpenCodex Proxy"
121121
base_url = "http://your-host:10100/v1"
122122
wire_api = "responses"
123123
requires_openai_auth = true
124-
env_http_headers = { "x-opencodex-api-key" = "OPENCODEX_API_AUTH_TOKEN" }
124+
env_key = "OPENCODEX_API_AUTH_TOKEN"
125125
# supports_websockets = true # only when config.websockets is true
126126
```
127127

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ name = "OpenCodex Proxy"
8787
base_url = "http://your-host:10100/v1"
8888
wire_api = "responses"
8989
requires_openai_auth = true
90-
env_http_headers = { "x-opencodex-api-key" = "OPENCODEX_API_AUTH_TOKEN" }
90+
env_key = "OPENCODEX_API_AUTH_TOKEN"
9191
# supports_websockets = true # only when config.websockets is true
9292
```
9393

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ name = "OpenCodex Proxy"
7979
base_url = "http://your-host:10100/v1"
8080
wire_api = "responses"
8181
requires_openai_auth = true
82-
env_http_headers = { "x-opencodex-api-key" = "OPENCODEX_API_AUTH_TOKEN" }
82+
env_key = "OPENCODEX_API_AUTH_TOKEN"
8383
# supports_websockets = true # only when config.websockets is true
8484
```
8585

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ name = "OpenCodex Proxy"
127127
base_url = "http://your-host:10100/v1"
128128
wire_api = "responses"
129129
requires_openai_auth = true
130-
env_http_headers = { "x-opencodex-api-key" = "OPENCODEX_API_AUTH_TOKEN" }
130+
env_key = "OPENCODEX_API_AUTH_TOKEN"
131131
# supports_websockets = true # only when config.websockets is true
132132
```
133133

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ name = "OpenCodex Proxy"
140140
base_url = "http://your-host:10100/v1"
141141
wire_api = "responses"
142142
requires_openai_auth = true
143-
env_http_headers = { "x-opencodex-api-key" = "OPENCODEX_API_AUTH_TOKEN" }
143+
env_key = "OPENCODEX_API_AUTH_TOKEN"
144144
# supports_websockets = true # yalnızca config.websockets true olduğunda
145145
```
146146

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ name = "OpenCodex Proxy"
115115
base_url = "http://your-host:10100/v1"
116116
wire_api = "responses"
117117
requires_openai_auth = true
118-
env_http_headers = { "x-opencodex-api-key" = "OPENCODEX_API_AUTH_TOKEN" }
118+
env_key = "OPENCODEX_API_AUTH_TOKEN"
119119
# supports_websockets = true # only when config.websockets is true
120120
```
121121

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ name = "OpenCodex Proxy"
113113
base_url = "http://your-host:10100/v1"
114114
wire_api = "responses"
115115
requires_openai_auth = true
116-
env_http_headers = { "x-opencodex-api-key" = "OPENCODEX_API_AUTH_TOKEN" }
116+
env_key = "OPENCODEX_API_AUTH_TOKEN"
117117
# supports_websockets = true # 僅當 config.websockets 為 true
118118
```
119119

0 commit comments

Comments
 (0)