agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

feat(chat): expose preventive read-only permission mode for Chat workers

Open kou-keirei opened this issue 3 months ago • 2 comments

Summary

AO's structured Chat workers currently do not expose a permission mode that allows a worker to inspect a repository while preventively blocking filesystem writes.

For Codex Chat sessions, the current permission mapping is effectively:

default / bypass-permissions → approvalPolicy = never → sandbox = danger-full-access

accept-edits / auto → approvalPolicy = on-request → sandbox = workspace-write

This leaves no way for a machine caller to request:

approvalPolicy = never sandbox = read-only

Codex app-server supports this sandbox profile, and AO already uses enforced read-only Codex execution in its reviewer path.

It would be useful for normal worker / chat / codex sessions to expose an equivalent preventive read-only permission mode.

Use case

A control plane or other automated caller may need to create a Chat worker that can:

inspect repository files; inspect Git state; reason about the codebase; return a structured result;

while being technically unable to modify the workspace.

Prompt instructions such as "do not modify files" and post-run diff checks are useful defense-in-depth, but they are not substitutes for preventive enforcement.

Today a caller that requires a true read-only execution contract has to reject the Chat worker as unsupported even though the underlying Codex sandbox can provide the required isolation.

Suggested behavior

Add a permission profile such as:

read-only

with the Codex Chat mapping:

approvalPolicy = never sandbox = read-only

The exact public name/API shape is of course up to AO.

Ideally the permission should be represented through AO's normal typed permission/configuration surface rather than as a Codex-specific escape hatch, so callers can capability-check it before creating or delivering work to a session.

Expected behavior

For a Chat worker created with preventive read-only permissions:

the provider cannot modify workspace files; no approval prompt is required merely to preserve read-only execution; the mode survives the normal Chat start/resume lifecycle; unsupported harnesses fail explicitly rather than silently receiving broader permissions; callers can distinguish supported read-only enforcement from advisory/read-only-by-prompt behavior. Why this seems to fit AO's existing model

AO already has the relevant pieces:

structured Codex Chat via codex app-server; typed per-agent permission modes; preventive Codex read-only execution in the reviewer path.

The missing piece appears to be exposing the equivalent permission profile to ordinary Chat workers.

Related #3360 — structured Chat/TUI session architecture #3745 — read-only hardening for reviewer harnesses

This request is specifically about normal structured Chat worker sessions, not reviewer execution.

kou-keirei avatar Aug 10 '26 16:08 kou-keirei

Did a read-only implementation reconnaissance against current main at cfbefa4cdbd5e8c8e020177e53d105f10e5f44ee. A few findings that may help bound this if someone picks it up.

The Codex Chat side looks fairly concentrated:

  • ChatStartConfig.Permissions, ChatResumeConfig.Permissions, and ChatTurnSettings.Approval already carry AO's typed permission mode through start, resume, and per-turn dispatch.
  • codexappserver.approvalSettings() is the central mapping used by start/resume and per-turn settings.
  • turnSandboxPolicy() already has a "read-only" -> {"type":"readOnly"} mapping for turn/start.

So the Codex mapping itself appears to be roughly the missing read-only -> approvalPolicy=never, sandbox=read-only case plus lifecycle/regression coverage.

The main cross-harness seam seems to be support detection rather than Codex itself. PermissionMode is global AO vocabulary, and several adapters currently normalize or fall through unhandled modes to their normal/provider default. Once read-only becomes a valid AO value, an unsupported driver therefore needs to reject it explicitly rather than silently treating it as default. That seems especially important here because the Chat controller already documents the invariant that permission choices must never be silently downgraded.

AO's existing ChatCapabilities surface may be a natural place to advertise preventive read-only support, although the exact capability/profile shape is of course a maintainer decision. That would also satisfy the original use case of allowing an automated caller to distinguish technically enforced read-only from advisory behavior before dispatch.

A couple of secondary surfaces I found:

  • the HTTP/OpenAPI approval enum, desktop Chat picker/types, mobile Chat picker/types, and project settings currently hardcode the four existing permission modes;
  • Chat spawn currently resolves permissions from the project's/role's AgentConfig; POST /sessions does not currently expose a per-spawn permission override. If callers should be able to request read-only for one specific worker without changing project config, that looks like the one API/product decision beyond the Codex mapping itself.

Tests that seem useful regardless of the final public shape:

start with read-only -> approvalPolicy=never, sandbox=read-only

resume preserves the same posture

per-turn read-only -> approvalPolicy=never, sandboxPolicy={type:"readOnly"}

unsupported harness/profile -> explicit failure, never fallback/default

existing default / accept-edits / auto / bypass behavior remains unchanged

Hope this saves whoever picks it up a bit of archaeology.

kou-keirei avatar Aug 11 '26 09:08 kou-keirei

Thanks for contributing to Agent Orchestrator.

This issue is being picked up by the current external contributor on-call pair:

  • @neversettle17-101
  • @illegalcall

If someone is already working on this, please continue as usual. The on-call pair is added for visibility, tracking, and support, not to take over the work. If you need help with review, direction, reproduction, or next steps, please tag @neversettle17-101 and @illegalcall here.

For faster context or live questions, you can also join the AO Discord.

Join the session here: https://discord.gg/H6ZDcUXmq

Come by if you want to see what is being built, ask questions, or just hang around with the community.

somewherelostt avatar Aug 11 '26 15:08 somewherelostt