Skip to content

feat(install): pre-approve airc command prefix in Codex via [rules] block — final piece for friction-free Codex - #375

Merged
joelteply merged 1 commit into
canaryfrom
feat/codex-pre-approve-airc-commands
Apr 30, 2026
Merged

joelteply merged 1 commit into
canaryfrom
feat/codex-pre-approve-airc-commands

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Closes the per-command-approval-gate finding that Codex's deep diagnostic surfaced in tonight's QA. With this merged, every Codex Carl gets a friction-free airc surface from first install — no per-command approval prompts, no manual flag-passing.

What Codex's diagnostic uncovered

Codex's per-command approval gate also restricts network access, not just prompts. A command not in the user's "always run commands starting with X" allowlist runs in a stricter sandbox where its gh API calls are blocked silently. The pattern:

  • `airc join` had been pre-approved early in the session → its gh calls reached the network → join succeeded
  • `airc msg` hadn't been pre-approved → its gh calls hit the network sandbox → silent fail
  • After Codex prompted + user approved `airc msg` with "always" → it worked instantly
  • Same pattern for every other airc verb

The fix

Codex's `[rules]` block (per config-reference docs) lets us declare approved command prefixes statically:

```toml

AIRC-COMMAND-RULES-START — managed by install.sh; pre-approves all

airc * commands so they aren't blocked by Codex's per-command approval

gate (which also restricts network access for un-approved commands).

[rules]
prefix_rules = [
{ pattern = [{ token = "airc" }], decision = "allow" }
]

AIRC-COMMAND-RULES-END

```

install.sh writes this idempotently to `~/.codex/config.toml` whenever Codex is detected. uninstall.sh strips it. `AIRC_SKIP_CODEX_RULES=1` opts out.

Three Codex-side auto-config layers now compose

  1. `[permissions.airc.network]` (feat(install): airc skills auto-install into Codex too (same SKILL.md format) #364) — scoped network access for github.com / api.github.com / gist.github.com
  2. `[shell_environment_policy.set] GH_TOKEN` (feat(install): inject GH_TOKEN into Codex via [shell_environment_policy.set] — workaround openai/codex#10695 #368) — injects gh token at session start, bypasses keychain probe flake
  3. `[rules] prefix_rules = [{ token = "airc" }]` (this PR) — pre-approves every `airc *` verb so the network-aware sandbox doesn't gate them

User installs Codex + runs install.sh + restarts Codex → friction-free airc on first try.

Tested on this Mac

  • install.sh writes block (one line of output)
  • Codex starts clean post-write
  • Re-run idempotent (no-op, no duplicate)
  • `bash -n` syntax check on both install.sh + uninstall.sh

Joel's framing

"if we get this, we can now have codex and decent claude code airc, fairly reliable into main"

This PR is that "this." After merge, the Codex story is shippable end-to-end without the per-command friction we hit tonight.

Followup

🤖 Generated with Claude Code

…lock (closes the per-command-approval gate finding)

Codex's per-command approval gate doesn't just control prompts — it
ALSO restricts network access for un-approved commands. A command not
in the user's "always run commands starting with X" allowlist runs in
a stricter sandbox where its gh API calls are blocked silently.

Joel's Codex first-encounter QA caught this live: `airc join` had
been pre-approved earlier so its gh calls reached the network, but
`airc msg` hadn't, so its gh calls hit the network sandbox and
failed. Codex prompted the user to "always run commands that start
with airc msg" and once approved, it worked instantly. Same for
every other airc verb (status, peers, etc) until each was
approved.

That's friction. Codex docs (config-reference) document a [rules]
block with prefix_rules for declaring approved command prefixes
statically. install.sh now writes a marker-bracketed block to
~/.codex/config.toml that pre-approves ALL `airc *` verbs at once:

  [rules]
  prefix_rules = [
    { pattern = [{ token = "airc" }], decision = "allow" }
  ]

Net: user installs Codex + runs install.sh + restarts Codex → every
airc verb works without per-command approval prompts, even on first
encounter.

Idempotent: grep guard on AIRC-COMMAND-RULES-START marker, no
duplicate writes.

uninstall.sh: matching cleanup strips the marker-bracketed block
when airc is removed (paired with the GH_TOKEN block strip already
in place).

Honors AIRC_SKIP_CODEX_RULES=1 if user wants to manage approvals
interactively (matches AIRC_SKIP_CODEX_TOKEN / _CONFIG patterns).

README: full section explaining what the gate is, why it bites,
how the [rules] block solves it, and how the three Codex-side
auto-config layers (network permission profile + GH_TOKEN
injection + command-rule pre-approval) compose into a friction-free
Codex airc surface.

Tested on this Mac:
  - install.sh wrote the block once + Codex starts clean
  - re-run no-op (idempotent)
  - bash -n syntax check passes for both install.sh + uninstall.sh

Joel's framing: "if we get this, we can now have codex and decent
claude code airc, fairly reliable into main." This PR is that "this."

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@joelteply
joelteply merged commit dfc8ad2 into canary Apr 30, 2026
6 checks passed
@joelteply
joelteply deleted the feat/codex-pre-approve-airc-commands branch April 30, 2026 04:19
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