Skip to content

daemon: add Codex ask-mode permission backend#8

Open
MKV21 wants to merge 4 commits into
open-vide:mainfrom
MKV21:codex-ask-permission-backend
Open

daemon: add Codex ask-mode permission backend#8
MKV21 wants to merge 4 commits into
open-vide:mainfrom
MKV21:codex-ask-permission-backend

Conversation

@MKV21
Copy link
Copy Markdown

@MKV21 MKV21 commented Apr 19, 2026

Summary

Adds an opt-in Codex Ask Mode to the daemon so Codex app-server permission requests can pause a session, surface a structured pending permission, and resume after an explicit user decision. Auto mode remains the default-compatible path.

Ask Mode is selected with permissionMode: "ask" or the CLI flag session create --permission-mode ask. In Ask Mode, Codex sessions use the app-server backend with approval support instead of silently falling back to the CLI auto path.

Changes

  • apps/daemon/src/types.ts — adds permissionMode, awaiting_approval, and pendingPermission session state.
  • apps/daemon/src/sessionManager.ts — routes Codex Ask Mode through the app-server backend, stores pending permission requests, handles permission responses, and keeps abort/cancel state stable.
  • apps/daemon/src/codexAppServerRunner.ts — handles server-initiated Codex JSON-RPC approval requests, normalizes them into daemon permission requests, and maps user decisions back to Codex responses.
  • apps/daemon/src/nativeHistory/index.ts — preserves pending permission state when daemon sessions are exposed through the workspace/session catalog.
  • apps/daemon/src/ipc.ts — adds session.permission.respond and validates permission-mode session creation input.
  • apps/daemon/src/cli.ts — adds --permission-mode <auto|ask> for session creation and session permission --decision <approve_once|reject|abort_run>.
  • apps/daemon/src/scheduleManager.ts and apps/daemon/src/teamManager.ts — update createSession calls for the new optional permission-mode parameter.
  • apps/daemon/test/session-permissions.test.mjs — adds deterministic backend tests using a fake Codex app-server runner, including pending permission preservation in discovered sessions.
  • apps/daemon/package.json — adds the daemon test script.

Test plan

  • npm test --workspace @openvide/daemon
  • ./node_modules/.bin/tsc -p apps/daemon/tsconfig.json
  • Manual: smoke test on a VPS with Codex app-server Ask Mode; permission request surfaced as awaiting_approval, approve_once resumed the turn, and the requested command completed.
  • Manual: confirm pending permission state is available through the session catalog so UI clients can restore approval state after reload/import.

Notes

  • This PR is daemon/CLI backend only. It does not add G2 or app UI surfaces.
  • Auto mode remains unchanged and remains the default.
  • Ask Mode intentionally refuses a silent CLI auto fallback when Codex app-server approval support is unavailable.
  • approve_once maps to the closest available Codex app-server decision. For broader permissions requests, Codex may apply the accepted permission for the current turn.
  • The daemon test seam is intentionally narrow and only swaps the Codex app-server turn spawner for deterministic backend tests.

AI disclosure

Parts of this change were drafted by Codex (AI coder) and reviewed by Claude Code (AI reviewer). A human (@MKV21) reviewed, tested, and approved the final result before submission.

@MKV21 MKV21 mentioned this pull request Apr 19, 2026
11 tasks
@MKV21 MKV21 marked this pull request as ready for review April 19, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant