fix(codex): honor yolo for MCP elicitation (#655)

Route Codex app-server MCP elicitation decisions through the live session permission mode. HAPI bridge elicitation remains accepted, non-HAPI elicitation stays cancelled in non-yolo modes, and yolo accepts future non-HAPI prompts after mode changes.\n\nAdds adapter and launcher seam tests covering default -> yolo -> default behavior.\n\nTests:\n- bunx vitest run src/codex/utils/appServerPermissionAdapter.test.ts src/codex/codexRemoteLauncher.test.ts\n- bun run typecheck
This commit is contained in:
CoColate
2026-05-21 17:09:10 +08:00
committed by GitHub
parent 8e3bba9303
commit 611c4eec49
4 changed files with 162 additions and 7 deletions
+5 -2
View File
@@ -505,12 +505,14 @@ class CodexRemoteLauncher extends RemoteLauncherBase {
return `${match[1]}.${match[2]}`;
};
const permissionHandler = new CodexPermissionHandler(session.client, () => {
const getCurrentCodexPermissionMode = () => {
const mode = session.getPermissionMode();
return mode === 'default' || mode === 'read-only' || mode === 'safe-yolo' || mode === 'yolo'
? mode
: undefined;
}, {
};
const permissionHandler = new CodexPermissionHandler(session.client, getCurrentCodexPermissionMode, {
onRequest: ({ id, toolName, input }) => {
if (toolName === 'request_user_input') {
session.sendAgentMessage({
@@ -2443,6 +2445,7 @@ class CodexRemoteLauncher extends RemoteLauncherBase {
registerAppServerPermissionHandlers({
client: appServerClient,
permissionHandler,
getPermissionMode: getCurrentCodexPermissionMode,
onUserInputRequest: async ({ id, input }) => {
try {
const answers = await permissionHandler.handleUserInputRequest(id, input);