fix(codex): align auth config and rate limits#8293
Conversation
📝 WalkthroughWalkthroughCodex managed-home synchronization now enforces 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
45bd811 to
7a0bfda
Compare
|
Final stale-overlay cleanup follow-up is now on the rebased current head The implementation uses a versioned body marker plus same-directory stage/quarantine and no-clobber hard-link publication. It removes only unmodified Orca-managed stale overlays; unmarked/user-modified files, non-regular type changes, and concurrent targets are preserved or quarantined with a warning. The earlier manifest/fd/inode/copy/symlink-reconstruction design was removed. Three independent hard-gate rounds closed the stale-restore, quarantined-symlink, and active-publish races; final verdict is Spec PASS / Quality APPROVED. Post-rebase verification: 11 changed test files / 253 tests, focused 3 files / 76 tests, node/CLI/web typecheck, lint/format/max-lines/diff, and exact two-commit range-diff all pass under Node 24.18.0. Electron/E2E and physical Windows filesystem exercise were not run. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/main/rate-limits/codex-backend-base-url.ts (2)
29-41: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate top-level TOML line-scanning loop.
The
isTomlStructuralLine→getTomlTableHeader/break → match →updateTomlLineScanStateloop inparseTopLevelTomlString(Lines 69-81) mirrors the same scan pattern incodex-config-auth-store.ts(Lines 23-39). Both files already share the low-level helpers fromconfig-toml-line-scan.ts; extracting a generic "find/replace top-level key line" iterator there would remove the duplicated control flow and centralize future fixes (e.g. the CRLF edge case flagged in the sibling file).// e.g. in config-toml-line-scan.ts export function findTopLevelTomlLine( lines: string[], predicate: (line: string) => boolean ): number | null { let scanState = createTomlLineScanState() for (let index = 0; index < lines.length; index += 1) { const line = lines[index] ?? '' if (isTomlStructuralLine(scanState)) { if (getTomlTableHeader(line)) return null if (predicate(line)) return index } scanState = updateTomlLineScanState(scanState, line) } return null }Also applies to: 63-83
37-37: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUnreachable
|| url.originfallback.
${url.origin}${...}is always a non-empty string (url.origin is never falsy for a successfully parsed URL), so|| url.originnever triggers.🧹 Proposed cleanup
- return `${url.origin}${path === '/' ? '' : path}` || url.origin + return `${url.origin}${path === '/' ? '' : path}`
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: c47d8768-98e0-4e56-bce6-7f535ef8553c
📒 Files selected for processing (24)
config/tsconfig.cli.jsonsrc/main/codex-accounts/runtime-home-service.test.tssrc/main/codex-accounts/service.test.tssrc/main/codex-accounts/service.tssrc/main/codex/codex-config-auth-store.tssrc/main/codex/codex-config-mirror.test.tssrc/main/codex/codex-config-mirror.tssrc/main/codex/codex-config-path-reference-rewrite.tssrc/main/codex/codex-profile-config-overlay-active-publish.tssrc/main/codex/codex-profile-config-overlay-mirror.test.tssrc/main/codex/codex-profile-config-overlay-mirror.tssrc/main/codex/config-settings-promotion.test.tssrc/main/rate-limits/codex-backend-base-url.test.tssrc/main/rate-limits/codex-backend-base-url.tssrc/main/rate-limits/codex-fetcher-backend.test.tssrc/main/rate-limits/codex-fetcher-buckets.test.tssrc/main/rate-limits/codex-fetcher.test.tssrc/main/rate-limits/codex-fetcher.tssrc/main/rate-limits/codex-rpc-rate-limit-mapping.tssrc/renderer/src/components/status-bar/StatusBar.tsxsrc/renderer/src/components/status-bar/status-bar-provider-menu-focus.test.tsxsrc/renderer/src/components/status-bar/tooltip.test.tssrc/renderer/src/components/status-bar/tooltip.tsxsrc/shared/rate-limit-types.ts
✅ Files skipped from review due to trivial changes (1)
- src/shared/rate-limit-types.ts
🚧 Files skipped from review as they are similar to previous changes (17)
- src/main/codex-accounts/service.ts
- src/main/codex/config-settings-promotion.test.ts
- src/renderer/src/components/status-bar/StatusBar.tsx
- src/main/rate-limits/codex-fetcher.test.ts
- src/renderer/src/components/status-bar/tooltip.test.ts
- src/main/rate-limits/codex-fetcher-backend.test.ts
- src/main/codex/codex-config-path-reference-rewrite.ts
- src/renderer/src/components/status-bar/tooltip.tsx
- src/renderer/src/components/status-bar/status-bar-provider-menu-focus.test.tsx
- src/main/rate-limits/codex-rpc-rate-limit-mapping.ts
- src/main/rate-limits/codex-fetcher-buckets.test.ts
- src/main/codex-accounts/runtime-home-service.test.ts
- src/main/codex/codex-config-mirror.test.ts
- src/main/codex/codex-config-mirror.ts
- src/main/rate-limits/codex-backend-base-url.test.ts
- src/main/rate-limits/codex-fetcher.ts
- src/main/codex-accounts/service.test.ts
7a0bfda to
880ad9e
Compare
|
Current-head review-body nitpick dispositions:
The branch was rebased again onto current main |
Summary
chatgpt_base_urlfrom top-level TOML, including BOM-prefixed configs, for custom-backend rate-limit requestswindowDurationMinsand retain additional by-ID bucketsThis is the focused auth/config/rate-limit replacement extracted from #7950. It intentionally excludes hooks/status, startup delivery, and session/native-chat changes.
Refs #7950
Screenshots
No visual redesign; Codex status-bar usage can now retain session/weekly while exposing additional meters in the tooltip.
Testing
pnpm typecheck(node, CLI, web)pnpm lint(passes with repository-existing warnings)oxlintoxfmt --checkpnpm check:max-lines-ratchetgit diff --check origin/main...HEADgit range-diffafter rebase ontoe5efbc9ffAI Review Report
The first independent gate found four blockers: profile overlays could override file auth, rate-limit durations were rounded as though they were remaining time, Codex dynamic buckets hid the weekly meter, and a BOM could hide the first-line backend URL. Each was reproduced and fixed before submission.
A separate three-round hard gate reviewed stale-overlay ownership and concurrent filesystem behavior. It found and drove tests for no-clobber stale restore, post-quarantine symlink type changes, and active-publish replacement races. The final implementation removed the earlier manifest/fd/inode/copy/symlink-reconstruction design and split active publishing into one concrete module.
A current-head CodeRabbit review then identified that a final hard-link failure could strand the previous overlay in quarantine. The finding was independently confirmed and severity-calibrated, then fixed with a pre-quarantine hard-link capability probe plus best-effort no-clobber restore for non-
EEXISTfinal failures. Two new RED-to-GREEN tests cover permanent preflight failure and a one-shot final publish failure. Final independent verdict: Spec PASS / Quality APPROVED, with no confirmed blocker.Cross-platform review covered macOS, Linux, and Windows path/type behavior: paths use Node utilities, rename/link operations stay within one directory, Windows overlay names compare case-insensitively, the existing writer retains Windows ACL repair, and no UI shortcut/label/Electron-specific behavior changes.
Security Audit
CODEX_HOME; no credential value crosses a new channelEEXISTpreserves the concurrent targetCompatibility
TOML handling preserves BOM placement and rewrites platform paths through existing path utilities. Status rendering changes only the Codex bucket branch; Gemini's bucket-only compact behavior remains unchanged.
The no-clobber protocol preflights same-directory hard links before moving an existing target. A filesystem or share without hard-link support therefore fails closed with a warning and leaves the existing overlay at its original path. If a transient final publish and subsequent no-clobber restore both fail, the previous regular file remains under an explicit quarantine name for manual recovery.
Notes
Validation used the repository-declared Node 24.18.0. The branch is rebased onto
e5efbc9ff; all three branch commits are range-diff equivalent to their pre-rebase commits.