fix(codex): pass ccsx resume through to native codex

Closes #1287
This commit is contained in:
Kai (Tam Nhu) Tran authored and GitHub committed 2026-05-18 09:45:20 -04:00
1 parent 5a7c2202f4
commit 5a54c1b536
7 files changed
+43 -9

No files matched your search

+12 -5
View File
@@ -43,7 +43,7 @@ export interface DispatcherBootstrap {
* - setGlobalConfigDir (--config-dir flag)
* - Cloud-sync warnings
* - Completion short-circuit via tryHandleRootCommand
* - Codex native passthrough via execNativeCodexFlagCommand
* - Codex native passthrough via execNativeCodexCommand
*
* Adapter registration (registerTarget calls) stays in main() because it is
* singleton wiring with no dependency on the parsed args.
@@ -141,9 +141,9 @@ export async function bootstrapAndParseEarlyCli(rawArgs: string[]): Promise<Disp
return { args, isCompletionCommand, browserLaunchOverride: undefined, exitNow: true };
}
if (shouldPassthroughNativeCodexFlagCommand(args)) {
const { execNativeCodexFlagCommand } = await import('./target-executor');
execNativeCodexFlagCommand(args);
if (shouldPassthroughNativeCodexCommand(args)) {
const { execNativeCodexCommand } = await import('./target-executor');
execNativeCodexCommand(args);
return { args, isCompletionCommand, browserLaunchOverride: undefined, exitNow: true };
}
@@ -175,6 +175,7 @@ export const CODEX_RUNTIME_REASONING_LEVELS = new Set([
]);
export const CODEX_NATIVE_PASSTHROUGH_FLAGS = new Set(['--help', '-h', '--version', '-v']);
export const CODEX_NATIVE_PASSTHROUGH_SUBCOMMANDS = new Set(['resume']);
export const NATIVE_CLAUDE_EFFORT_LEVELS = ['low', 'medium', 'high', 'xhigh', 'max'] as const;
@@ -314,7 +315,7 @@ export function shouldNormalizeNativeClaudeEffort(
// ========== Native Codex Passthrough ==========
export function shouldPassthroughNativeCodexFlagCommand(args: string[]): boolean {
export function shouldPassthroughNativeCodexCommand(args: string[]): boolean {
return getNativeCodexPassthroughArgs(args) !== null;
}
@@ -328,11 +329,17 @@ export function getNativeCodexPassthroughArgs(args: string[]): string[] | null {
if (CODEX_NATIVE_PASSTHROUGH_FLAGS.has(firstArg)) {
return targetArgs;
}
if (CODEX_NATIVE_PASSTHROUGH_SUBCOMMANDS.has(firstArg)) {
return targetArgs;
}
const secondArg = targetArgs[1] || '';
if (firstArg === 'codex' && CODEX_NATIVE_PASSTHROUGH_FLAGS.has(secondArg)) {
return targetArgs.slice(1);
}
if (firstArg === 'codex' && CODEX_NATIVE_PASSTHROUGH_SUBCOMMANDS.has(secondArg)) {
return targetArgs.slice(1);
}
return null;
}
+3 -3
View File
@@ -3,7 +3,7 @@
* and top-level profile dispatcher (Phase E switch).
*
* Extracted from src/ccs.ts (lines 291-295, 394-426).
* Handles direct execution of native Codex flag passthrough (--help, --version, etc.)
* Handles direct execution of native Codex passthrough commands (--help, resume, etc.)
* before the main profile dispatch loop runs.
*
* dispatchProfile() collapses the 6-branch switch in main() to a single call.
@@ -29,9 +29,9 @@ export interface ProfileError extends Error {
suggestions?: string[];
}
// ========== Native Codex Flag Command Executor ==========
// ========== Native Codex Command Executor ==========
export function execNativeCodexFlagCommand(args: string[]): void {
export function execNativeCodexCommand(args: string[]): void {
const adapter = getTarget('codex');
if (!adapter) {
console.error(fail('Target adapter not found for "codex"'));