feat: a Codex seat keeps its own permission envelope and profile across launches #2048
All Vouch review confidence checks passed
Residual risk 0.32 = Change Risk (0.75) × (1 − Review Confidence (0.58)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.75 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.075
Real PR Conversation Timeline
1 comments
"Review active on #2048"
general
weight: 0.35
openrig-review
What a person gets
Change an existing Codex member's intended permissions once, without recreating the seat or rebuilding launch flags after every resume. Two values, each with one current record, set through the existing audited
rig seat set-permissions:--codex-permissions <file>, spec keycodex_permissions): sandbox (workspace-writeorread-only), approval (never,on-requestoruntrusted) and, for workspace-write,network_access,writable_roots,exclude_tmpdir_env_varandexclude_slash_tmp. It is emitted as explicit flags with the existingcodexEnvelopeArgson every managed launch and resume.--codex-profile <name|inherit>): the existingcodex_config_profile, now settable on an existing member. A profile doesn't replace a retained conversation's approval; an envelope does.Seats without either launch exactly as before.
Behaviour
--mode(includinginherit) replaces an envelope the same way; the result and the event name both. Full access stays thefull_bypassmode; the envelope refusesdanger-full-access.OPENRIG_YOLO; status says which it replaces. A named profile still supplies the settings the envelope doesn't state. Team and kernel launch defaults don't apply to a seat with an envelope.CODEX_HOME), restore, in-place restart and handover. In a rebuild handover the seat's envelope wins over the observed predecessor policy.--permission-modereplaces it, as a mode setter does: the successor launches with that mode, the plan lists the envelope as cleared, and the commit clears it and names it in theseat.runtime_changedevent. A switch that doesn't commit leaves the envelope and the seat's choice as they were.rig up <spec>starts from the spec, as other seat settings do. Fork copies the source's current envelope; export round-trips it.CODEX_HOMEwhen itsenv:declares one, else the daemon's explicitCODEX_HOME, which managed Codex launches reassert. An absent file is reported (Codex loads it as an empty layer, so base config applies), not refused. A file whose bytes changed since the last recorded check is reported. A profile the native loader rejects is refused and the previous profile kept, with the existing remedy: recording it would make the seat's next managed launch or resume, possibly an unattended restart, fail at the existing launch preflight until someone repaired it. This refuses nothing that launches today. When neither sets aCODEX_HOME, a pane keeps its own, so the setter reports the profile as unverified rather than checking a different home. Every launch still runs the native preflight.Tests
codex-member-permissions.test.ts): validation and normalization,danger-full-accessrefused, unreadable and both-presentrecords refuse with a repair message, live reads (a cleared profile stays cleared), the setter's atomic mode/envelope replacement with
both in the audit, legacy flat specs (validate, normalize, export, round-trip; other runtimes refused), and the profile check: a FIFO,
a directory and an unreadable file give a reason instead of blocking or failing, a loading profile with unreadable bytes stays
accepted, a check that can't run is reported as not run, and the route answers instead of a 500.
codex-runtime-adapter.test.ts(two seats in one folder get their own flags, the envelope wins over ambientYOLO and a policy posture and keeps a named profile, pod-aware resume) and
codex-resume.test.ts(legacy resume adds no network orteam grants).
restore-orchestrator.test.ts,seat-handover-service.test.ts,agent-image-fork-route.test.ts,cli/test/s03-permissions-cli.test.ts.launch falls back to the posture decision) and the rest pass.
Storage: one migration,
137_node_codex_permissions(nodes.codex_permissions_json). Main has 136, 138 and 139, and themigrator applies migrations by name.
Proof
All runs are in a Linux container, as root, with
--maxWorkers=2. Earlier rounds were reviewed atbf225f3b, on #1914's branch.This head is that work rebased onto main after #1914 merged, plus test fixes.
80fc3b3f, the daemon files this touches (codex-,native-permission,permission-,restore-orchestrator,seat-handover,seat-lifecycle,seat-runtime-switch,rigspec-,rig-expansion,successor-session,agent-image,migrat,claude-permission,member-): 2308 pass, 4 skipped.d9b79c85, the same set: 2344 pass, 5 skipped, 0 fail.- The CLI permission and seat tests pass 152 of 152.
-
test:repopasses 325 of 325.- The build passes.
65ed907d, before the two test fixes, 2 failed. After the rebase, the legacy resume takes the seat's ownCODEX_HOME12thand the envelope 13th, and restore pads its tail with
undefined, as main does. Those two tests still passed the old positions andexpected the old explicit
falsedefaults.c7c7a277(adds the runtime-switch test): the build passes, andcodex-member-permissions,native-permissionandseat-runtime-switchpass 105, with 1 skipped. A later rerun at this head: lint passes, and the same affected daemon set passes2345, with 5 skipped.
c7c7a277..8a7c63be):- the runtime switch passes the envelope to its Codex successor;
- the profile check uses the seat's own home;
- an explicit switch mode replaces the envelope.
d35411c6: build and lint pass,test:repopasses 325 of 325, and the affected daemon set passes 2347 with 2 failing and 5skipped. Both failures were test expectations, fixed in
8a7c63be:- the setter test expected the profile check's old two arguments;
- the replacement test checked for an absent
codexPermissionskey that the launcher writes asundefined.8a7c63be: build and lint pass, andseat-runtime-switch-service,codex-member-permissions,native-permissionandseat-lifecyclepass 170, with 2 skipped.ee4215937d's code andd35411c6's tests, the two explicit-replacement tests fail (storeand switch), and the inherit and failed-switch cases pass. The third failure there is the setter test's two-argument expectation
above. With
c7c7a277's code and8a7c63be's tests, exactly five fail and 60 pass:- the inherit switch carrying the envelope;
- the seat-home profile check;
- the setter passing the seat's node id;
- both explicit-replacement tests.
The failed-switch case passes there too, since the old refusal also left the envelope in place.
98fb3fe8(clearing an envelope rolls back on any read error except a schema without the column):- build and lint pass;
- the same four files pass 172, with 2 skipped;
- with
8a7c63be's code, exactly the two new tests fail: the helper's read-error case, and a switch whose commit hits that error andmust roll back whole.
Limits
rig psshow the profile but not the envelope, as they already omit modes.🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Added per-seat Codex sandbox and approval settings, including workspace-write options such as network access and writable paths.
Added support for selecting and checking Codex profiles, with permission changes recorded for review.
Codex permissions now carry through launches, resumes, restores, forks, and RigSpec export and import.
Documentation
* Documented how Codex permissions interact with profiles, defaults, and older OpenRig versions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->