Skip to content

docs: split codex runtime ops from github ops (#349) - #363

Merged
squne121 merged 2 commits into
mainfrom
worktree-issue-349-codex-runtime-ops-split
May 24, 2026
Merged

squne121 merged 2 commits into
mainfrom
worktree-issue-349-codex-runtime-ops-split

Conversation

@squne121

@squne121 squne121 commented May 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • docs/dev/agent-runtime-ops.md を新設し、Codex local runtime の位置づけ、WSL2 / standalone install の self-binary ENOENT 復旧、approval load reduction、permission / rules / instruction surface を集約
  • docs/dev/github-ops.md から Codex local runtime 詳細を外し、agent-runtime-ops.md 参照と GitHub trust boundary / body-file guidance の窓口に整理
  • review feedback に合わせて、Codex session での rtk gh 統一、/usr/local/bin/codex 再コピー時の version drift 確認、Official References、rtk gh trust boundary smoke check を追加
  • Issue 調査: Codex 0.133.0 sandbox の self-binary bind 不全を追跡し AC6 を再検証する #350 で確定した workaround を、GitHub 操作ルールから分離して再利用可能な docs 構成に揃えた

受け入れ条件の達成状況

  • AC1 agent-runtime-ops.md に WSL2 / standalone install の self-binary ENOENT 復旧手順を追加
  • AC2 agent-runtime-ops.md に Codex CLI が optional runtime であり、Claude Code / SSOT / workflow を置き換えない位置づけを追加
  • AC3 agent-runtime-ops.md に approval_policy = "on-request" を既定にし、approval_policy = "never" / danger-full-access を既定にしない理由と、rtk gh / rtk git / rtk pnpm と direct gh / direct pnpm / mutating git の境界を追加
  • AC4 agent-runtime-ops.md に permission profile と legacy sandbox_mode / --sandbox の競合、trusted project、AGENTS.md、rules / instruction surface の確認手順、および Official References を追加
  • AC5 github-ops.md に agent-runtime-ops.md 参照を残し、Codex session では rtk gh を入口にする説明と最小 smoke check を残した
  • AC6 github-ops.md に GitHub trust boundary と body-file guidance を残した

検証コマンド結果

  • rg -nF "self-binary ENOENT" docs/dev/agent-runtime-ops.md: PASS
  • rg -nE "optional runtime|Claude Code|SSOT|workflow" docs/dev/agent-runtime-ops.md: PASS
  • rg -nE "approval machine|approval_policy|on-request|never|danger-full-access|rtk gh|rtk git|rtk pnpm|direct gh|direct pnpm|mutating git" docs/dev/agent-runtime-ops.md: PASS
  • rg -nE "default_permissions|sandbox_mode|--sandbox|trusted project|AGENTS.md|rules|instruction surface|codex status|execpolicy check|developers.openai.com/codex" docs/dev/agent-runtime-ops.md: PASS
  • rg -nF "agent-runtime-ops.md" docs/dev/github-ops.md: PASS
  • rg -nE "rtk gh issue edit|rtk gh issue comment|rtk gh --help|codex execpolicy check" docs/dev/github-ops.md: PASS
  • rg -nE "WSL2|standalone install|self-binary ENOENT|PATH 優先化|approval_policy|default_permissions|AGENTS.md" docs/dev/github-ops.md: 0 matches
  • rg -nE "Body File Guidance|GitHub Ops|trust boundary|rtk gh issue edit|rtk gh issue comment" docs/dev/github-ops.md: PASS
  • pnpm typecheck: PASS
  • pnpm test: PASS
  • pnpm build: PASS
  • pnpm lint: PASS at repo root
    • worktree-local rtk pnpm lint only initially hit node_modules/.pnpm/.../eslint/bin/eslint.js から ../package.json を解決できない環境依存エラー。差分は docs-only で、repo root での pnpm lint は通過

Allowed Paths 遵守

  • 変更ファイルは docs/dev/agent-runtime-ops.md と docs/dev/github-ops.md のみ
  • Issue の Allowed Paths 外の repo-tracked file は変更していない

Schema Change Applicability

  • decision: not_schema_change
  • reason: docs-only 変更であり、producer-consumer 境界をまたぐ machine-readable contract は変更していない

Schema Consumer Inventory

N/A - schema 変更なし

Compatibility Decision

  • change_type: N/A
  • compatibility: N/A
  • migration_required: N/A
  • migration_or_followup: N/A
  • reason: docs-only 変更

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
Codex local runtime の既知 workaround と GitHub ops を別文書へ分離し、GitHub trust boundary の窓口を github-ops.md に限定した yes Issue VC 7件の通過、docs/dev/agent-runtime-ops.md 新設、docs/dev/github-ops.md 差分 N/A

Notes

@squne121
squne121 force-pushed the worktree-issue-349-codex-runtime-ops-split branch from 9a6c457 to 6e698fc Compare May 24, 2026 08:57
@squne121
squne121 marked this pull request as ready for review May 24, 2026 08:57

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, mergeStateStatus=CLEAN

Evidence Check

  • AC coverage: ○。PR 本文の ## 受け入れ条件の達成状況 で AC1-AC6 をすべて [x] と根拠付きで記録
  • Allowed Paths: 遵守。diff は docs/dev/agent-runtime-ops.md と docs/dev/github-ops.md のみ
  • CI Verification: typecheck / lint / test / build / python-test がすべて pass
  • 検証コマンド結果: Issue VC 7件の結果と repo standard gate の結果が PR 本文に記録済み

Blockers

  • なし

Non-blockers

  • pnpm lint は repo root で pass、worktree-local 実行では一度だけ node_modules/.pnpm/.../eslint/bin/eslint.js から ../package.json を解決できない環境依存エラーが出た。差分の妥当性自体は CI pass で確認済み

LOOP_VERDICT

verdict: APPROVE
blockers: []
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: 6e698fce5a914db35383a450b662d2a65bc23452
follow_up_issue_requests: []

@squne121

Copy link
Copy Markdown
Owner Author

結論: REQUEST_CHANGES

PR #363 は Issue #349 の表面的ACは概ね満たしています。agent-runtime-ops.md 新設、github-ops.md から runtime 詳細を剥がす方向も妥当です。PR本文上も AC1〜AC6 を満たしたと主張し、変更対象は docs/dev/agent-runtime-ops.md と docs/dev/github-ops.md の2ファイルです。

ただし、敵対的に見ると 「安全な恒久運用ドキュメント」としてはまだ危うい です。主な問題は、github-ops.md 側に direct gh を再導入する表現が残っていること、/usr/local/bin/codex への実体コピーが更新ライフサイクルを壊すこと、公式仕様リンク・検証観点が分離先に移植されていないことです。


Blocking 1: github-ops.md が rtk gh 統一方針と direct gh body-file guidance を混在させている

github-ops.md の新しい GitHub Trust Boundary は「Codex session での GitHub 操作は rtk gh を入口にそろえる」と書いた直後に、「長文更新は gh issue edit / gh pr edit / gh issue comment を body-file 経由で行う」と書いています。

これは PR #345 / Issue #343 で作った境界と衝突します。PR #345 では direct gh を forbidden、rtk gh を入口にする設計を入れ、direct gh forbidden の policy check もPR本文に記録しています。

修正要求:

- 長文更新は Body File Guidance を使い、Codex session では `rtk gh issue edit --body-file ...` / `rtk gh pr edit --body-file ...` / `rtk gh issue comment --body-file ...` を使う。
- `gh ...` と書く場合は「GitHub CLI の概念説明」であり、Codex session から直接実行してよいという意味ではない。

また、VC も gh issue edit|gh issue comment ではなく、rtk gh issue edit|rtk gh issue comment を検出する形に変えるべきです。


Blocking 2: /usr/local/bin/codex 実体コピーの更新ライフサイクルが未定義

agent-runtime-ops.md は、standalone install の ~/.codex/.../bin/codex を /usr/local/bin/codex に sudo install する手順を推奨しています。

この workaround 自体は、Issue #350 の実体験からは合理的です。Issue #350 は WSL2 / standalone install で codex sandbox linux の self-binary ENOENT を切り分け、danger-full-access や --sandbox workspace-write を成功条件にしないことを明示しています。

しかし、/usr/local/bin/codex にコピーすると、その後 codex update や standalone current symlink が更新されても /usr/local/bin/codex は古いまま残ります。openai/codex 側でも、install方式や visible path / resolved path の混在が混乱を生む不具合報告があります。([GitHub]1)

修正要求:

agent-runtime-ops.md に以下を追加してください。

### 更新時の注意

`/usr/local/bin/codex` は `~/.codex/packages/standalone/current` とは独立した実体コピーである。
Codex を更新した後は、必ず以下を確認する。

```bash
which codex
readlink -f "$(which codex)"
/usr/local/bin/codex --version
~/.codex/packages/standalone/current/bin/codex --version
codex sandbox linux -- pwd

バージョンがずれている場合は、再度 sudo install で /usr/local/bin/codex を更新する。


さらに、例の `0.133.0-x86_64-unknown-linux-musl` 直書きは避けるべきです。現在の例は将来確実に陳腐化します。Codex README は install script、npm、Homebrew、release binary など複数の導入経路を案内しており、release binary も versioned artifact として更新されます。:contentReference[oaicite:6]{index=6}

推奨例はこうです。

```bash
src="$(readlink -f "$HOME/.codex/packages/standalone/current/bin/codex")"
test -x "$src"
sudo install -m 0755 "$src" /usr/local/bin/codex

Major 1: 分離先に公式仕様リンクが移植されていない

PR #345 の github-ops.md には、Config basics / Permissions / Rules / AGENTS.md への公式リンクがありました。PR #363 では runtime 知識を agent-runtime-ops.md に移したのに、分離先に公式リンクがありません。

この種の運用ドキュメントでは、2026年時点の Codex CLI 仕様に依存する記述が多いので、一次情報への導線は必須です。特に、permission profiles と旧 sandbox_mode は合成されず、sandbox_mode や --sandbox が active config layer にある場合は旧 sandbox 設定が使われる、という公式仕様はこのPRの中核です。([OpenAI 開発者]2)

修正要求:

agent-runtime-ops.md に「Official References」節を追加。

## Official References

- Codex permissions: ...
- Codex rules: ...
- Codex AGENTS.md: ...
- Codex sandboxing / approval policy: ...

Major 2: trusted project の説明が AGENTS.md まで過剰に巻き込んでいる

agent-runtime-ops.md は「trusted project でないと .codex/config.toml / .codex/rules/*.rules / AGENTS.md が期待通り効かない」と読める書き方です。

公式 Rules ドキュメントでは、project-local rules under <repo>/.codex/rules/ は project .codex/ layer が trusted の場合に load される、と説明されています。([OpenAI 開発者]3) 一方、AGENTS.md は project root から current directory まで探索して instruction chain に入る、と説明されており、rules と同じ trusted gate で説明されているわけではありません。([OpenAI 開発者]4)

修正要求:

以下のように分けるべきです。

- `.codex/config.toml` / `.codex/rules/*.rules` は project-local config layer の trust state に依存する。
- `AGENTS.md` は Codex の instruction discovery 対象だが、読み込み確認は別途 `codex status` / instruction summary で行う。

Major 3: rtk gh trust boundary の検証手順を削りすぎている

PR #345 では、rtk gh が arbitrary shell passthrough でないこと、GitHub write operations が human approval / project policy に従うこと、direct gh が forbidden であることを確認対象にしていました。

PR #363 の github-ops.md は「変わったら見直す」とだけ残しており、確認方法が消えています。 これは「入口文書」に戻すとしても削りすぎです。GitHub write 操作は事故時の影響が大きいため、少なくとも smoke check は残すべきです。

修正要求:

github-ops.md に最小の検証を残してください。

rtk gh --help
codex execpolicy check --pretty --rules .codex/rules/default.rules -- rtk gh issue view 1
codex execpolicy check --pretty --rules .codex/rules/default.rules -- gh issue view 1

Codex Rules は allow / prompt / forbidden の prefix rule を持ち、複数マッチ時はより制限的な decision が適用されます。codex execpolicy check で rule file の判定を検証できるため、この確認はドキュメントに残す価値があります。([OpenAI 開発者]3) ([OpenAI 開発者]3)


Major 4: danger-full-access 非推奨の説明は正しいが、理由が薄い

agent-runtime-ops.md は danger-full-access を恒久運用の既定にしない、と書いています。 方向は正しいです。

ただし、なぜ危険なのかが弱い。公式には danger-full-access は filesystem / network boundaries を取り除くモードで、workspace-write + on-request が低リスクな local automation preset と説明されています。([OpenAI 開発者]5)

修正要求:

`danger-full-access` は filesystem / network boundary を外すため、self-binary ENOENT の恒久解として採用しない。
切り分け目的で使った場合も、成功証跡としては `codex sandbox linux --permissions-profile ...` を別途要求する。

Minor: agent-runtime-ops.md の「補助 SSOT」は Issue #349 の Outcome と少しズレる

Issue #349 は docs/dev/agent-runtime-ops.md を Codex local runtime knowledge の主文書にし、github-ops.md を GitHub trust boundary / body-file guidance の参照窓口に戻す、という契約です。

しかし新規ファイル冒頭は「補助 SSOT」となっています。 些細ですが、責務分離を明確にするなら次がよいです。

Codex local runtime 運用の主文書。
ただし repo 全体の実装 workflow / product requirements / Claude Code 運用は既存 SSOT に従う。

望ましい追記パッチ方針

このPRは方針自体は良いので、追加修正は小さくて済みます。

  1. github-ops.md の direct gh 表記を rtk gh ... --body-file に変更する。
  2. agent-runtime-ops.md の install 例を version直書きから readlink -f .../current/bin/codex ベースに変える。
  3. /usr/local/bin/codex の更新時再コピー・version drift 確認を追加する。
  4. Official References を agent-runtime-ops.md に移す。
  5. trusted project / AGENTS.md / rules の効き方を分けて記述する。
  6. rtk gh trust boundary の最低限の検証コマンドを github-ops.md に戻す。

最終判定

verdict: REQUEST_CHANGES
merge_blockers:
  - github-ops.md が rtk gh 統一方針と direct gh body-file guidance を混在させている
  - /usr/local/bin/codex 実体コピーの更新ライフサイクルと version drift が未定義
major_findings:
  - 公式仕様リンクが分離先 agent-runtime-ops.md に移植されていない
  - trusted project の説明が rules/config と AGENTS.md を混同している
  - rtk gh trust boundary の検証手順を削りすぎている
minor_findings:
  - agent-runtime-ops.md 冒頭の「補助 SSOT」が Issue #349 の主文書化と少しズレる
recommended_action: 追加コミットで docs 修正後に再レビュー

@squne121

Copy link
Copy Markdown
Owner Author

指摘ありがとうございます。以下を追加修正しました。

  • github-ops.md

    • Codex session では direct gh ではなく rtk gh issue edit --body-file ... / rtk gh pr edit --body-file ... / rtk gh issue comment --body-file ... を使うと明記
    • gh ... 表記は概念説明であり direct gh 許可を意味しないと明記
    • rtk gh --help / codex execpolicy check ... -- rtk gh issue view 1 / ... -- gh issue view 1 の最小 smoke check を復帰
  • agent-runtime-ops.md

    • 冒頭を「補助 SSOT」から「Codex local runtime 運用の主文書」に修正
    • /usr/local/bin/codex 例を version 直書きから readlink -f "$HOME/.codex/packages/standalone/current/bin/codex" ベースへ変更
    • /usr/local/bin/codex は実体コピーであり、更新後に version drift を確認して再コピーする手順を追加
    • Official References 節を追加して、permissions / rules / AGENTS.md / sandboxing の一次情報リンクを移植
    • trusted project と .codex/config.toml / .codex/rules/*.rules の関係、AGENTS.md の instruction discovery を分離して記述
    • danger-full-access を恒久解にしない理由を filesystem / network boundary の観点で補強
  • Issue / PR surface

追加コミット:

  • docs: tighten codex runtime guidance for review (#349)

再チェックが回るのを待ってから、必要なら最終 self-review verdict を更新します。

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, mergeStateStatus=CLEAN

Evidence Check

  • AC coverage: ○。PR 本文の ## 受け入れ条件の達成状況 で AC1-AC6 をすべて [x] と根拠付きで記録
  • Allowed Paths: 遵守。diff は docs/dev/agent-runtime-ops.md と docs/dev/github-ops.md のみ
  • CI Verification: typecheck / lint / test / build / python-test がすべて pass
  • 検証コマンド結果: review feedback を反映した Issue VC と repo 標準ゲートの結果が PR 本文に更新済み

Blockers

  • なし

Non-blockers

  • なし

LOOP_VERDICT

verdict: APPROVE
blockers: []
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: 15fa7fe304667bbac51ab880cd00cc569401723c
follow_up_issue_requests: []

@squne121
squne121 merged commit 21f5df8 into main May 24, 2026
5 checks passed
@squne121
squne121 deleted the worktree-issue-349-codex-runtime-ops-split branch May 24, 2026 09:09
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