mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-18 03:27:08 +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
@@ -65,7 +65,6 @@ export type PingPeerSessionSummary = {
|
||||
lifecycleState?: string | null
|
||||
piSessionId?: string
|
||||
summary?: { text?: string } | null
|
||||
capabilities?: { concurrentClients?: boolean } | null
|
||||
} | null
|
||||
}
|
||||
|
||||
@@ -811,9 +810,7 @@ export async function setPeerPermissionMode(options: SetPeerPermissionModeOption
|
||||
const live = await getSession(apiUrl, jwt, matched.id, http)
|
||||
// Hub treats a missing flavor as claude; mirror it so the allowed list matches.
|
||||
const flavor = live.metadata?.flavor ?? matched.metadata?.flavor ?? 'claude'
|
||||
// Shared (concurrentClients) sessions cannot launch with Safe Yolo; same filter as the web picker.
|
||||
const shared = Boolean(live.metadata?.capabilities?.concurrentClients)
|
||||
const allowed: readonly string[] = getPermissionModesForFlavor(flavor).filter((m) => !shared || m !== 'safe-yolo')
|
||||
const allowed: readonly string[] = getPermissionModesForFlavor(flavor)
|
||||
if (allowed.length === 0) {
|
||||
throw new PingPeerError('bad_args', `${flavor} sessions do not support permission modes`)
|
||||
}
|
||||
|
||||
@@ -60,12 +60,12 @@ describe('setPeerPermissionMode', () => {
|
||||
|
||||
expect(error).toBeInstanceOf(PingPeerError)
|
||||
expect((error as PingPeerError).code).toBe('bad_args')
|
||||
expect((error as PingPeerError).message).toContain('allowed: default, read-only, safe-yolo, autoReview, yolo')
|
||||
expect((error as PingPeerError).message).toContain('allowed: default, read-only, autoReview, yolo')
|
||||
expect(http.post).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('rejects Safe Yolo for a shared session without calling the hub', async () => {
|
||||
const http = createHttpMock({ flavor: 'codex', active: false, shared: true })
|
||||
it('rejects Safe Yolo for Codex without calling the hub', async () => {
|
||||
const http = createHttpMock({ flavor: 'codex', active: false })
|
||||
|
||||
await expect(setPeerPermissionMode({ ...base, sessionIdPrefix: sessionId, mode: 'safe-yolo', http: http as never }))
|
||||
.rejects.toMatchObject({ code: 'bad_args', message: "invalid mode 'safe-yolo' for codex; allowed: default, read-only, autoReview, yolo" })
|
||||
|
||||
Reference in New Issue
Block a user