mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-08 07:17:39 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user