Skip to content

Commit 5bb63ab

Browse files
committed
docs: add roadmap for untouched issue sweep (WP0)
- 000_plan.md: objective, constraints, work-phase map - 001_issue_inventory.md: all 7 issues with analysis - 010-030: diff-level fix plans for lidge-jun#322, lidge-jun#327, lidge-jun#323 - 040: triage comment drafts for lidge-jun#320, lidge-jun#324, lidge-jun#326, lidge-jun#294 Part of untouched-issue-sweep goalplan.
1 parent f88564c commit 5bb63ab

6 files changed

Lines changed: 479 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# 260723 Untouched Issue Sweep
2+
3+
## Objective
4+
5+
Triage and fix 7 GitHub issues that have no maintainer review or comment.
6+
Three require code fixes (#322, #327, #323); four need English triage comments
7+
(#320, #324, #326, #294).
8+
9+
## Constraints
10+
11+
- Branch: `codex/260723-untouched-issue-sweep-2`
12+
- Local commits only (no push without approval)
13+
- No gui/ changes without explicit approval
14+
- All GitHub comments in English, evidence-backed
15+
- `bun run typecheck` + `bun run test` + `bun run privacy:scan` must stay green
16+
17+
## Work-Phase Map (dependency-ordered)
18+
19+
| Phase | Decade | Title | Dependencies |
20+
|-------|--------|-------|-------------|
21+
| WP0 | 000-009 | Docs-first roadmap | None |
22+
| WP1 | 010 | Fix #322: shim first-arg bypass | WP0 |
23+
| WP2 | 020 | Fix #327: __main__ needsReauth | WP0 |
24+
| WP3 | 030 | Fix #323: reasoning_summary compat | WP0 |
25+
| WP4 | 040 | Triage comments #320/#324/#326/#294 | WP0 |
26+
27+
WP1-WP3 are independent of each other (disjoint file sets).
28+
WP4 is pure GitHub comments, no code changes.
29+
30+
## Success Criteria
31+
32+
- c1-roadmap: All decade docs written to diff-level
33+
- c2-322-fix: Shim bypass works with flags before subcommand + regression test
34+
- c3-327-fix: __main__ DTO includes needsReauth + 401/403 marks reauth + test
35+
- c4-323-fix: reasoning_summary not sent for unsupported models + test
36+
- c5-triage: English comments posted on #320, #324, #326, #294
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Issue Inventory — Untouched Issue Sweep
2+
3+
## Code-Fix Issues
4+
5+
### #322 — Shim first-arg bypass (uncleblue)
6+
- **Title:** Shim only checks $1 for CODEX_INTERNAL_COMMANDS
7+
- **Root cause:** Unix/Windows/PS shim checks only first CLI arg against
8+
CODEX_INTERNAL_COMMANDS. `codex -s read-only -a untrusted app-server` has
9+
$1="-s", so app-server bypass is missed and ocx ensure runs.
10+
- **Impact:** CodexBar polls defeat `ocx stop` — proxy revives every ~20s.
11+
- **Fix scope:** src/codex/shim.ts (Unix, Windows cmd, PowerShell shim builders)
12+
- **Priority:** High — active user pain with CodexBar
13+
14+
### #327 — __main__ needsReauth not exposed (jhste102lab)
15+
- **Title:** Account list API/dashboard doesn't show __main__ invalid state
16+
- **Root cause:** Two gaps in src/codex/auth-api.ts:
17+
1. listCodexAuthAccounts() main DTO omits needsReauth (pool DTOs have it)
18+
2. fetchMainAccountInfo() silently swallows 401/403 without marking reauth
19+
- **Impact:** Dashboard shows no warning when main credential dies; pool rotation
20+
picks invalid main account causing upstream 403s
21+
- **Fix scope:** src/codex/auth-api.ts
22+
- **Priority:** High — silent auth failures in pool mode
23+
24+
### #323 — reasoning_summary_delivery compatibility (Eleven-is-cool)
25+
- **Title:** Per-model reasoning summary delivery compatibility
26+
- **Root cause:** ensureStrictCatalogFields() defaults supports_reasoning_summaries
27+
to true. Codex sends sequential_cutoff to models that reject it with 400.
28+
- **Impact:** Third-party Responses API models fail with upstream 400
29+
- **Fix scope:** src/codex/catalog.ts (or equivalent catalog field defaults)
30+
- **Priority:** Medium — affects third-party Responses routes
31+
32+
## Triage-Comment Issues
33+
34+
### #320 — Pool OK but native auth expired shows login (jhste102lab)
35+
- **Verdict:** Partially valid / CLI limitation
36+
- **Analysis:** Codex CLI checks native auth.json before proxy intercept. Pool
37+
being alive cannot prevent CLI's own login gate. Shim reinstall after npm
38+
update is real pain. Suggest: fix #327 first (needsReauth exposure), then
39+
document the CLI-side limitation. "Pool should suppress login" needs upstream
40+
CLI changes outside OpenCodex scope.
41+
42+
### #324 — websockets:false returns 426 (jhste102lab)
43+
- **Verdict:** Intended behavior + UX/docs issue
44+
- **Analysis:** Default websockets:false, Design B. Builtin openai tries WS
45+
first, gets 426, should fall back to HTTP. If fallback works, it's a
46+
codex doctor warning, not a bug. If it blocks, user needs websockets:true.
47+
Needs docs/doctor message improvement.
48+
49+
### #326 — Tool-heavy WS continuation loop (kdnsna)
50+
- **Verdict:** Needs-info / investigation required
51+
- **Analysis:** Intermittent, 200-response continuation loop. Not a simple retry.
52+
Distinct from #215 (400 mismatch) and #272 (item ID instability). Needs
53+
redacted WS event sequence (response.completed presence, tool output handling,
54+
new resp_* creation pattern).
55+
56+
### #294 — Claude account pool feature request (str0203)
57+
- **Verdict:** Roadmap park
58+
- **Analysis:** Feature request for Claude pool parity with ChatGPT pool.
59+
Already triaged as roadmap item. HaydernCenterpoint noted Claude's stricter
60+
account security makes pool approach risky. Park with acknowledgment.
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# 010 — Fix #322: Shim First-Arg Bypass
2+
3+
## Summary
4+
5+
The codex autostart shim checks only $1 against CODEX_INTERNAL_COMMANDS.
6+
When global flags precede the subcommand (e.g. `codex -s read-only -a untrusted
7+
app-server`), $1 is "-s" and the bypass is missed — ocx ensure runs and
8+
respawns the proxy after every `ocx stop`.
9+
10+
## File Change Map
11+
12+
### src/codex/shim.ts — MODIFY
13+
14+
CODEX_INTERNAL_COMMANDS at line 15 — no change needed.
15+
16+
**Change 1: Unix shim (line ~199) — scan all args before `--`**
17+
18+
Replace first-argument `case "$1"` with a for-loop that scans every arg:
19+
20+
```diff
21+
-case "$1" in
22+
- ${internalCommands}|--help|-h|--version|-V)
23+
- ;;
24+
- *)
25+
- if [ -z "$OCX_SHIM_BYPASS" ]; then
26+
- ${shQuote(bunPath)} ${shQuote(cliPath)} ensure >/dev/null 2>&1 || true
27+
- fi
28+
- ;;
29+
-esac
30+
+skipEnsure=
31+
+if [ -n "$OCX_SHIM_BYPASS" ]; then
32+
+ skipEnsure=1
33+
+else
34+
+ for arg in "$@"; do
35+
+ case "$arg" in
36+
+ --)
37+
+ break
38+
+ ;;
39+
+ ${internalCommands}|--help|-h|--version|-V)
40+
+ skipEnsure=1
41+
+ break
42+
+ ;;
43+
+ esac
44+
+ done
45+
+fi
46+
+
47+
+if [ -z "$skipEnsure" ]; then
48+
+ ${shQuote(bunPath)} ${shQuote(cliPath)} ensure >/dev/null 2>&1 || true
49+
+fi
50+
```
51+
52+
**Change 2: Windows cmd shim (line ~230-250) — scan with shift loop**
53+
54+
Replace `%~1`-only checks with a `:scan_codex_args` loop using shift:
55+
56+
```diff
57+
if not "%OCX_SHIM_BYPASS%"=="" goto run_codex
58+
-${internalCommandChecks}
59+
-if /I "%~1"=="--help" goto run_codex
60+
-...
61+
+:scan_codex_args
62+
+if "%~1"=="" goto ensure_ocx
63+
+if "%~1"=="--" goto ensure_ocx
64+
+${internalCommandChecks}
65+
+if /I "%~1"=="--help" goto run_codex
66+
+if /I "%~1"=="-h" goto run_codex
67+
+if /I "%~1"=="--version" goto run_codex
68+
+if /I "%~1"=="-V" goto run_codex
69+
+shift
70+
+goto scan_codex_args
71+
+:ensure_ocx
72+
+"%OCX_BUN%" "%OCX_CLI%" ensure >nul 2>nul
73+
+:run_codex
74+
```
75+
76+
Note: internalCommandChecks already generated, just used inside the loop now.
77+
`%*` preserves original args despite shift (batch behavior).
78+
79+
**Change 3: PowerShell shim (line ~263) — foreach scan**
80+
81+
Replace `$firstArg` single-check with foreach loop:
82+
83+
```diff
84+
-$firstArg = if ($args.Count -gt 0) { [string]$args[0] } else { "" }
85+
-$skipEnsure = $env:OCX_SHIM_BYPASS -or $internalCommands -contains $firstArg ...
86+
+$skipEnsure = [bool]$env:OCX_SHIM_BYPASS
87+
+if (-not $skipEnsure) {
88+
+ foreach ($candidate in $args) {
89+
+ $candidate = [string]$candidate
90+
+ if ($candidate -eq "--") { break }
91+
+ if (($internalCommands -contains $candidate) -or
92+
+ (@("--help", "-h", "--version", "-V") -contains $candidate)) {
93+
+ $skipEnsure = $true
94+
+ break
95+
+ }
96+
+ }
97+
+}
98+
```
99+
100+
### tests/codex-shim.test.ts — MODIFY
101+
102+
Extend existing shim tests (Unix execution ~line 200, Windows builder ~line 235):
103+
104+
Test cases:
105+
- `codex app-server` → no ensure (existing, verify still works)
106+
- `codex -s read-only -a untrusted app-server` → no ensure (THE FIX)
107+
- `codex -s read-only exec hello` → ensure runs (exec not internal)
108+
- `codex hello` / no args → ensure runs
109+
- `codex -s read-only --help` → no ensure
110+
- `codex -- app-server` → ensure runs (after `--` = prompt text)
111+
- `OCX_SHIM_BYPASS=1` → no ensure
112+
113+
## Scope Boundary
114+
115+
- IN: shim.ts Unix/Windows/PS shim generation, shim tests
116+
- OUT: CODEX_INTERNAL_COMMANDS array itself (correct as-is)
117+
- OUT: shim install/uninstall logic
118+
119+
## Edge Cases
120+
121+
- Flags with values (`-s read-only`): scan doesn't try to parse flag values,
122+
just checks each token for exact match — `read-only` doesn't match any command
123+
- `--flag=value`: complete token doesn't match internal command
124+
- `--` separator: stop scanning, everything after is prompt text
125+
- False positive: flag value named `doctor` could trigger bypass — acceptable
126+
tradeoff vs. duplicating Codex's option parser in 3 shell languages
127+
- Batch `%*` after shift: batch preserves original args in `%*`
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# 020 — Fix #327: __main__ needsReauth Exposure
2+
3+
## Summary
4+
5+
The `__main__` (native Codex auth) account DTO omits `needsReauth`, while pool
6+
accounts expose it. When main credential dies (401/403 from WHAM), the management
7+
API and dashboard show no warning. Pool rotation picks the invalid main account,
8+
causing upstream 403s with no diagnostic signal.
9+
10+
## File Change Map
11+
12+
### src/codex/auth-api.ts — MODIFY
13+
14+
**Change 1: Import markAccountNeedsReauth (line ~1-10)**
15+
16+
```diff
17+
-import { clearAccountNeedsReauth, isAccountNeedsReauth } from "./account-runtime-state";
18+
+import {
19+
+ clearAccountNeedsReauth,
20+
+ isAccountNeedsReauth,
21+
+ markAccountNeedsReauth,
22+
+} from "./account-runtime-state";
23+
```
24+
25+
**Change 2: fetchMainAccountInfo() — mark reauth on 401/403 (line ~233)**
26+
27+
```diff
28+
const resp = await fetch("https://chatgpt.com/backend-api/wham/usage", {
29+
headers: { Authorization: `Bearer ${tokens.access_token}`, ... },
30+
signal: AbortSignal.timeout(8000),
31+
});
32+
- if (!resp.ok) return { email: null, plan: null, quota: null };
33+
+ if (!resp.ok) {
34+
+ if (resp.status === 401 || resp.status === 403) {
35+
+ markAccountNeedsReauth(MAIN_CODEX_ACCOUNT_ID);
36+
+ }
37+
+ return { email: null, plan: null, quota: null };
38+
+ }
39+
+ clearAccountNeedsReauth(MAIN_CODEX_ACCOUNT_ID);
40+
const data = (await resp.json()) as WhamUsageResponse;
41+
```
42+
43+
Rationale: 401/403 = credential dead. 429/5xx/timeout = transient, don't mark.
44+
Clear on success so CLI re-login recovery works without process restart.
45+
46+
**Change 3: CodexAuthAccountDto — make needsReauth required (line ~264)**
47+
48+
```diff
49+
export interface CodexAuthAccountDto {
50+
...
51+
- needsReauth?: boolean;
52+
+ needsReauth: boolean;
53+
hasCredential: boolean;
54+
}
55+
```
56+
57+
**Change 4: listCodexAuthAccounts() — add needsReauth to main DTO (line ~378)**
58+
59+
```diff
60+
const main: CodexAuthAccountDto = {
61+
id: MAIN_CODEX_ACCOUNT_ID,
62+
email: maskEmail(mainInfo.email) ?? "Codex App login",
63+
plan: mainInfo.plan,
64+
isMain: true,
65+
hasCredential: true,
66+
+ needsReauth: isAccountNeedsReauth(MAIN_CODEX_ACCOUNT_ID),
67+
quota: mainInfo.quota ? { ...quotaForPlan(...) } : null,
68+
};
69+
```
70+
71+
### tests/codex-auth-api.test.ts — MODIFY
72+
73+
Add regression test:
74+
1. Write auth.json with main tokens
75+
2. Mock WHAM fetch returning 401, then 403
76+
3. Call listCodexAuthAccounts with forceRefresh
77+
4. Assert __main__ DTO has needsReauth === true
78+
5. Mock WHAM 200, refresh again
79+
6. Assert needsReauth === false (clear on success)
80+
7. Cleanup: clearAccountNeedsReauth in beforeEach/afterEach
81+
82+
## Scope Boundary
83+
84+
- IN: auth-api.ts changes, regression test
85+
- OUT: GUI CodexAccountPool.tsx mainSwitchEntry (gui/ change needs approval)
86+
- OUT: hasCredential semantics (separate contract)
87+
88+
## Edge Cases
89+
90+
- 429/5xx/timeout: NOT reauth (transient)
91+
- auth.json missing: current synthetic-main contract unchanged
92+
- Cache hit: DTO reads runtime marker directly, so marked state shows immediately
93+
- Recovery: clearAccountNeedsReauth on 200 ensures re-login recovery works

0 commit comments

Comments
 (0)