Skip to content

[Feature]: Let supervised workers authenticate with their dispatch capability alone #22653

Open

Description

@johncioni

Problem or use case

Tested on Orca 1.4.209 with Codex 0.156.1, macOS.

I run Codex workers through orca orchestration worker-start inside Codex's macOS sandbox (workspace-write). To send heartbeats, ask the coordinator a question, check mail, and report worker_done, a worker's CLI has to read orca-runtime.json, which holds the global local-RPC token. Anything that can read that token can also create terminals, create worktrees, and run automations, and the sandbox doesn't constrain any of those. A PreToolUse hook that filters command text catches the obvious cases, but it isn't an authentication boundary.

Codex can already deny reads of specific paths (permissions.filesystem.deny_read in a managed requirements.toml). I checked that it blocks the file, and also matching temp files created after the sandbox starts. But if I deny orca-runtime.json today, worker messaging breaks:

  • out/cli/runtime/metadata.js:15 rejects runtime metadata that has no authToken.
  • out/cli/runtime/transport.js:147-158 sends the global token on every request, next to the optional orchestrationCapability.
  • In the main bundle, parseAndAuth checks the global token before dispatch and never looks at the capability. Capability checks happen later, inside the lifecycle-send and ask handlers.
  • check and reply don't forward a capability, and orchestration mutations first make a status.get compatibility call without one.
  • The metadata writer's atomic temp files (orca-runtime.json.<pid>.<ts>.<rand>.tmp) also hold the token, so a read denial has to cover them as well.

Proposed solution

A restricted worker mode that works with only the per-dispatch capability:

  • Endpoint discovery that doesn't expose the global token, for example a separate descriptor file or an endpoint passed at launch, refreshed across app restarts.
  • The server authenticates a dispatch capability as its own restricted caller and derives dispatch, task, run, and sender from it, rejecting caller-supplied identities that conflict.
  • That caller may heartbeat, send worker_done and escalations, message its coordinator, ask and resume, and check, wait on, and ack its own mailbox, plus the narrow compatibility and request-recovery calls the CLI needs.
  • Everything else is refused centrally before any handler runs: terminal and worktree creation, automations, other RPC methods, other dispatches' mailboxes, and sub-dispatch, unless an explicit policy allows it. Answering asks stays coordinator-only.
  • Revocation, process-incarnation checks, retry isolation, and safe completion replay keep working, and restricted mode never falls back to the global or paired credentials.
  • The CLI passes the capability on every request it needs, and diagnostics don't print it.

A test that would show it works: launch a worker whose sandbox denies the global token files, with no command hook. Heartbeat, ask and answer, mailbox delivery, and a single worker_done all succeed. A valid orca terminal create fails for lack of authority, and no terminal appears. Direct-RPC tests reject privileged methods even with a valid capability, and cover missing or revoked capabilities, cross-dispatch identities, app restarts, and retries.

Alternatives or additional context

The workaround today is a command-text hook, which shell indirection gets around. A local broker that holds the token and forwards only worker methods would work, but it duplicates what the app should enforce itself.

Related: #12360 asks for a per-dispatch permission surface for the launched agent's flags. This request is about the worker's authority over Orca's own RPC.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions