- Codex Model Selector Empty After Restart - Fix the model selector frequently showing "Custom" with an empty list for 5-10+ minutes after quitting Codex (ChatGPT.app) and relaunching via APIBypass. Chat already worked (models resolved by slug), but the selector stayed empty until Codex's own periodic refresh happened to hit an installed hook. Root cause was a timing race: Codex's startup model fetch often completed before APIBypass's CDP injection hooks were installed, and once Codex cached an empty list nothing forced a re-fetch. Three fixes: (1) the injector fast-polls (400ms vs 3s) after a page disappears so hooks are re-installed within 2s of a relaunch; (2) after bootstrap the injection script proactively dispatches a
model/listrequest so an already-installed hook is guaranteed to intercept at least one fetch, refilling the selector within seconds; (3) the request-side app-server patch no longer permanently gives up when its webpack chunk isn't loaded yet at injection time - it retries via a PerformanceObserver plus a bounded poll once the chunk loads, restoring the most direct interception channel.
CodexAppInjector: addreconnectMonitorInterval(400ms) and a puremonitorInterval(for:)selector; the monitor loop sleeps fast while disconnected/reconnecting and 3s once stableCDPInjectionScript: addforceCodexModelListRefresh()(force-reload catalog, dispatchmodel/liston the appserver_message channel, extend refresh window to 10s), called afterensureCodexModelWhitelistInstalls()inbootstrapModelWhitelistCDPInjectionScript: replace the "mark installed and give up" branch ininstallAppServerModelRequestPatchwithscheduleAppServerModelRequestPatchRetry()(PerformanceObserver + ~2s bounded poll, max ~30s) so the request-side patch installs when theapp-server-manager-signals-chunk loads lazily; extract the chunk name tocodexAppServerSignalsChunkNameCDPInjectionScript: emitmodel_fetch_intercepted { channel, modelCount }at the four model-container rewrite sites (json_response / appserver_message / appserver_request / statsig), plusforced_refresh_dispatched { hasModels }andappserver_request_retry { attempt, assetFound }- distinguishing "hook installed" from "hook actually intercepted" so timing-race outcomes are observable- Add
APIBypassTests/CodexAppInjectorTests.swift(monitor interval selection) and extendCDPDiagnosticsTests(new events ->.info)
- Provider Sidebar Reorder — Fix drag-to-reorder in the config page's provider list landing in wrong positions. The list groups providers by API protocol (Chat Completions / Anthropic / Responses API) into separate sections, each with its own
.onMove. SwiftUI gives.onMoveoffsets relative to that section's filtered subset, butmoveProvidertreated them as global array offsets — so reordering landed wrong in every group (including the first) whenever the stored order wasn't perfectly clustered by protocol.moveProvidernow takes theapiProviderscope and remaps section-local offsets onto the group's fixed global slots (extract group →Array.move→ backfill), keeping non-group items in place. Drag is scoped to within-group; cross-group drags clamp to the group boundary.
ConfigDataStore.moveProvidergains anapiProvider: APIProviderparameter and uses the extract-group →Array.move→ backfill-slots algorithm (preserves the group's occupied global slots)ConfigManager.moveProviderforwards theapiProviderscopeConfigWindow.swift's three.onMovehandlers pass.openai/.anthropic/.responsesrespectively- Add
APIBypassTests/ProviderReorderTests.swiftwith 7 cases covering within-group move (forward/backward/mixed-storage), cross-group clamp, persistence, empty-group no-op, and out-of-range source drop
- ChatGPT.app Support — Adapt to OpenAI's Codex.app → ChatGPT.app rename. The app is now detected, launched, and injected correctly regardless of whether the installed version is named Codex.app or ChatGPT.app.
- CDP Target Matching — Fix injection failure when ChatGPT.app is installed. The previous
pickCodexTargetlogic only matched pages with "codex" in the title/URL and fell back to the first page, which could inject into the wrong target (DevTools, extension pages). Now uses precise matching: ChatGPT desktop pages are identified by exact title ("ChatGPT") plus URL whitelist (chatgpt.com, chat.openai.com, data:text/html), and the unsafe first-page fallback is removed.
- Add ChatGPT.app paths to
CodexAppLauncher.defaultCandidates(after legacy Codex.app paths, matching CodexPlusPlus priority order) - Add
resolveExecutableName(appURL:)to readCFBundleExecutablefrom Info.plist instead of hardcoding "Codex" - Add
appNameFromURL(_:)to derive app display name from bundle path - Update
manualLaunchCommandto acceptappNameparameter for correctopen -acommand generation - Extract
pickCodexTargetas a public function in CodexRouterCore with two-pass matching (codex keyword → ChatGPT desktop → nil) - Update localization strings to reference "Codex/ChatGPT" in detection and error messages
- Add 29 new tests covering ChatGPT detection, executable resolution, and CDP target matching
-
swift_task_dealloc Crash — Fix a crash (
swift_task_deallocwith "freed pointer was not the last allocation") that occurred when clicking "Launch Codex" while CodexAdaptorService was running. The crash was caused by Swift Issue #86204 —Task.sleep(for:)cross-module Duration specialization conflict. Replaced allTask.sleep(for:)calls withTask.sleep(nanoseconds:)to work around this Swift compiler bug. -
Codex Not Restarting After Termination — Fix an issue where Codex would close but fail to restart when clicking "Launch Codex". The previous fixed 800ms wait was unreliable — process exit time varies. Now polls every 200ms to detect when the process has actually exited (with 5-second timeout protection), ensuring reliable restart.
- Replace
Task.sleep(for:)withTask.sleep(nanoseconds:)in three locations:CodexAppLauncher.swift— terminate wait and debug port pollingCodexAdaptorService.swift— CDP state pollingCodexAppInjector.swift(CodexRouterCore) — monitor loop
- Protocol Switch Restart Confirmation — When switching communication protocol (Chat Completions ↔ Responses API) while Codex APP is running, show a confirmation dialog informing the user that a restart is required. Unsaved model changes are merged into a single dialog when applicable.
- Move config mirror file from
~/.codex/to~/Library/Application Support/com.apibypass.APIBypass/for better separation from Codex APP's directory - Add
ProtocolSwitchDecisionMakercomponent with unit tests for protocol switch logic
-
Verbose Logging Toggle — Add a "Verbose" switch in Codex Adaptor's Logs tab. When disabled, only errors are logged and consecutive duplicate events are skipped, reducing log noise.
-
Automatic Parameter Error Retry — When upstream returns a 400 error due to parameter issues (e.g., thinking budget exceeded, signature mismatch), the proxy automatically retries with corrected parameters.
- Model Resolution — Fix model name resolution in Codex Adaptor to prioritize the
model(slug) field overdisplayNamewhen matching catalog entries, improving compatibility with Codex's identifier handling.
- Consolidate logging by removing redundant
CodexLoggingService, usingCodexLogStoreas the single logging component with OSLog integration - Add
ParamErrorRetryutility for parsing upstream error responses and determining retry actions - Improve request logging with unique request IDs for better traceability
-
WireAPI persistence — Fix communication protocol (Chat Completions / Responses API) setting not persisting correctly in Codex adaptor. The selection now persists across app restarts.
-
CancellationError handling — Fix potential crash from not properly propagating CancellationError in async sleep calls.
- Add hasLoadedConfig and oldValue != newValue guards in onChange
- Use DispatchQueue.main.async to clear isHandlingProtocolSwitch flag after state updates
- Fix error handling in CodexAppLauncher, CodexAdaptorService, and CodexAppInjector