mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-08 01:43:07 +00:00
fix(codex): drop safe-yolo from Codex permission modes (#2183)
* fix(codex): drop safe-yolo from Codex permission modes Every Codex session runs on the native shared runtime (runCodex is runSharedCodex), which rejects safe-yolo. The mode stayed in CODEX_PERMISSION_MODES and six filters hid it again in the web picker, composer, hub permission-mode route, hapi set-mode and both native apps. API callers that validate against the flavor catalog (e.g. a spawn with permissionMode: 'safe-yolo') still passed it through and only failed inside the runner. Remove it from the Codex catalog (shared, iOS, Android, fixture) and delete the filters. autoReview is the native replacement. Safe Yolo stays for Gemini, Kimi and Copilot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(ios): Codex option list now has four modes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fe2fbb881d
commit
ffd950a220
@@ -45,7 +45,6 @@ describe('shared launch configuration', () => {
|
||||
it('does not interpret flags after -- as configuration', () => {
|
||||
expect(sharedLaunchConfig({ codexArgs: ['--', '--profile=explain'] }, '/tmp').tuiArgs).toEqual(['--', '--profile=explain']);
|
||||
expect(sharedLaunchConfig({ codexArgs: ['--', '-C', 'literal'] }, '/tmp').tuiArgs).toEqual(['--', '-C', 'literal']);
|
||||
expect(() => sharedLaunchConfig({ permissionMode: 'safe-yolo' }, '/tmp')).toThrow('not a native shared');
|
||||
});
|
||||
it('maps HAPI autoReview to native auto-review in the workspace-write sandbox', () => {
|
||||
const result = sharedLaunchConfig({ permissionMode: 'autoReview', codexArgs: ['--yolo'] }, '/tmp');
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { CodexAppServerClient } from '../codexAppServerClient';
|
||||
export const SharedLaunchSchema = z.object({
|
||||
startedBy: z.enum(['runner', 'terminal']).optional(),
|
||||
codexArgs: z.array(z.string()).optional(),
|
||||
permissionMode: z.enum(['default', 'read-only', 'safe-yolo', 'autoReview', 'yolo']).optional(),
|
||||
permissionMode: z.enum(['default', 'read-only', 'autoReview', 'yolo']).optional(),
|
||||
resumeSessionId: z.string().optional(), resumeLast: z.boolean().optional(), resumeAll: z.boolean().optional(),
|
||||
existingSessionId: z.string().optional(),
|
||||
/** Hub-preallocated stub — create/adopt, not reopen. */
|
||||
@@ -46,7 +46,6 @@ export function resolveSharedCodex(): CodexCommand {
|
||||
export function sharedLaunchConfig(options: SharedLaunchOptions, cwd: string): {
|
||||
cwd: string; serverArgs: string[]; tuiArgs: string[]; threadParams: Record<string, unknown>;
|
||||
} {
|
||||
if (options.permissionMode === 'safe-yolo') throw new Error('safe-yolo is not a native shared permission mode. Choose default, read-only, autoReview, or yolo.');
|
||||
const args = options.codexArgs ?? [];
|
||||
const serverArgs: string[] = [];
|
||||
let tuiArgs: string[] = [];
|
||||
|
||||
@@ -32,7 +32,7 @@ export type RootHost = {
|
||||
end(root: SharedCodexRoot, nativeArchive?: boolean): Promise<void>;
|
||||
};
|
||||
const SettingsSchema = z.object({
|
||||
permissionMode: z.enum(['default', 'read-only', 'safe-yolo', 'autoReview', 'yolo']).optional(),
|
||||
permissionMode: z.enum(['default', 'read-only', 'autoReview', 'yolo']).optional(),
|
||||
model: z.string().min(1).optional(), modelReasoningEffort: z.string().nullable().optional(),
|
||||
collaborationMode: z.enum(['default', 'plan']).optional(),
|
||||
serviceTier: z.enum(['fast', 'standard']).nullable().optional(),
|
||||
@@ -407,7 +407,6 @@ export class SharedCodexRoot {
|
||||
}
|
||||
async applySettings(raw: unknown): Promise<{ applied: RuntimeSettings }> {
|
||||
const config = SettingsSchema.parse(raw);
|
||||
if (config.permissionMode === 'safe-yolo') throw new Error('safe-yolo is not a native shared permission mode; choose default, read-only, autoReview, or yolo');
|
||||
if (Object.keys(config).length === 0) return { applied: this.settings };
|
||||
if (typeof config.modelReasoningEffort === 'string') config.modelReasoningEffort = parseReasoningEffortValue(config.modelReasoningEffort);
|
||||
if (config.modelReasoningEffort === null) {
|
||||
|
||||
Reference in New Issue
Block a user