Skip to content

feat(skills): share root directory through symlink - #1972

Merged
squne121 merged 13 commits into
mainfrom
worktree-issue-1926-codex-skill-surface-root-directory-symli
Aug 2, 2026
Merged

squne121 merged 13 commits into
mainfrom
worktree-issue-1926-codex-skill-surface-root-directory-symli

Conversation

@squne121

@squne121 squne121 commented Aug 2, 2026 •

Copy link
Copy Markdown
Owner

概要

  • .agents/skills を Git mode 120000、link text ../.claude/skills の tracked root skill-directory symlink として扱い、旧 thin wrapper 群を廃止しました。
  • fixture copy、Python/JavaScript validator、bridge contract、runtime smoke、inventory と CI test selection を root symlink topology の fail-closed 契約に合わせました。
  • canonical package 本文、.codex/agents/**、runtime permission policy、CI workflow/generator は変更していません。

検証結果

  • PASS: uv run --locked pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke.py tests/codex/test_codex_permission_profile_config.py tests/test_agent_ops_inventory.py(146 passed)
  • PASS: uv run --locked pytest tests/test_codex_agent_bridge_contract.py(25 passed)
  • PASS: Python/JavaScript validator parity、regular directory・broken・absolute・repository外 target の fail-closed rejection、CI test-selection plan/lane validation。
  • PASS: current head 6338bdfa12cb8dadd52cb6414ed19ac5e3d30888 の GitHub required CI はすべて成功。
  • Full suite: 868f0f8906ca98f933cdf9d293e0be1116088ebb で 3765 passed, 4 skipped, 1 deselected。2 failures は main でも再現する変更範囲外の既知失敗です。current head では required CI が成功しています。

受入条件別の根拠

  • AC1〜AC4、AC6、AC7: static validator、bridge contract、関連 test、CI選択検証で確認済みです。
  • AC5: current head で Codex direct structured smoke と Claude isolated Herdr interactive smoke の双方を実行しました。.agents/skills -> ../.claude/skills、canonical package の指定4ファイルの readback、inventory の重複なしを確認しています。
  • Allowed Paths: live Issue 実装: Codex skill surface を root directory symlink に置換する #1926 の .agents/skills/** を含む許可一覧に対し、current head の25変更パスで gate は ok です。

runtime 証跡

  • Codex: artifacts/runtime-smoke/codex-1926/summary.md
  • Claude: .claude/artifacts/issue-refinement-loop/1926/runtime-20260802-claude-interactive-current/summary.md
  • Claude は isolated named Herdr session 内で read-only 操作のみを対話的に実行し、final state done、RUNTIME_SMOKE_1926_CLAUDE_OK、session cleanup 完了を確認しました。

関連Issueを終了対象に設定します: Closes #1926

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Preview URL

✅ verified live assets: https://squne121.github.io/loop-protocol/pr-1972/

The preview will be removed when this PR is closed.

@squne121

squne121 commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

リポジトリの正式な impl-review-loop は、実装・検証・独立PRレビューを別 SubAgent に委譲し、APPROVE と live mergeability が揃った時点で人間のマージ判断へ引き渡す契約です。
gpt-5.3-codex-spark を使う spark-skim・spark-deep・spark-worker は manual invocation 専用なので、正規ロールを置換せず、調査・デバッグ・限定編集の補助として優先利用する構成にしています。

あなたは squne121/loop-protocol の既存実装セッションを引き継ぐメイン control-plane です。

以下を対象に、リポジトリ正本の impl-review-loop を途中状態から再開してください。

target:
  repository: squne121/loop-protocol
  issue: 1926
  pull_request: 1972
  pr_url: https://github.com/squne121/loop-protocol/pull/1972
  existing_branch: worktree-issue-1926-codex-skill-surface-root-directory-symli

execution:
  mode: autonomous_until_immediately_before_merge
  max_iterations: 6
  human_approval_between_iterations: false
  merge: prohibited
  auto_merge: prohibited

最終目標

PR #1972 を対象に、実装、検証、独立レビュー、修正、push、CI再確認を反復し、次をすべて満たす状態まで人間の承認を求めず進める。

  • Issue 実装: Codex skill surface を root directory symlink に置換する #1926 の live contract と最新 OWNER 決定を満たす
  • Allowed Paths gate が ok
  • current head に対する独立 pr-reviewer 判定が APPROVE
  • reviewer の blockers が空
  • required CI がすべて成功
  • unresolved review thread がゼロ
  • PR head が最新レビュー対象 SHA と一致
  • live mergeability が CLEAN または HAS_HOOKS
  • PR本文に変更内容、検証結果、Closes #1926 が正しく反映されている
  • マージ操作だけが残っている

PR の merge、auto-merge 有効化、Issue の手動 close、branch 削除は行わない。

モデル・SubAgent方針

SubAgent を必ず利用する。メインセッション自身だけで実装とレビューを完結させない。

Spark優先ルーティング

補助 SubAgent は次の順で明示起動する。

  1. spark-skim

    • PR、Issue、CI、差分、関連テストの read-only inventory
    • 軽量な検索と影響範囲抽出
  2. spark-deep

    • root symlink、fixture copy、validator parity の複雑な原因分析
    • Allowed Paths 内の複数ファイル修正が必要なデバッグ
  3. spark-worker

    • 根拠が確定した後の小規模で限定的な編集

これらの agent は設定済みの gpt-5.3-codex-spark を使う。

正規の impl-review-loop ロールである以下も必ず分離する。

  • implementation-worker
  • test-runner
  • pr-reviewer

正規ロールの起動APIがモデルoverrideを許す場合は、gpt-5.3-codex-spark を第一候補として指定する。override不能またはモデル利用不能の場合に限り、そのロールの既定モデルへfallbackし、理由を最終報告に記録する。モデル変更のためだけに .codex/agents/** を編集してはならない。

Spark agent は implementation-worker や pr-reviewer の代替にしない。特に Spark agent に最終レビュー判定、GitHub publish、commit、push、loop orchestrationを行わせない。

再開時の最初の処理

以下を並行可能な read-only SubAgent に委譲し、最新状態を再取得する。

  1. PR feat(skills): share root directory through symlink #1972 の現在の head branch、head SHA、base SHA、Draft状態、mergeability
  2. Issue 実装: Codex skill surface を root directory symlink に置換する #1926 の live本文、最新 OWNER コメント、最新 contract review
  3. PRの全コメント、review submission、inline thread、resolved状態
  4. current head の全 workflow/check結果
  5. PR差分、変更ファイル、既存worktree、dirty state
  6. mainとの差分と、並行PRによる実競合の有無

確認時点の既知情報は次のとおりだが、必ず live state を優先する。

observed_head_sha: c95a695705bff7cbad94c7033bf1e84c113628bb
observed_state:
  draft: true
  mergeable: true
  unresolved_review_threads: 0
  submitted_reviews: 0
observed_failed_workflow:
  run_id: 30738036232
  failed_job: python-test-core

既存 branch と worktree を再利用する。重複PRや不要な新規branchを作成しない。remote headが進んでいる場合は、現在のremote headを正本として再調査する。

契約上の正本

次の順序で解釈する。

  1. live Issue 実装: Codex skill surface を root directory symlink に置換する #1926 本文
  2. 最新の明示 OWNER 決定
  3. live PR差分とcurrent-head CI
  4. contract snapshot
    5.過去コメントや過去SHAの結果

最新 OWNER 決定として、少なくとも次を確認する。

  • .agents/skills を tracked root skill-directory symlink にする
  • link target は ../.claude/skills
  • Codex CLI は .agents/skills 経由で同じpackage群を参照する
  • manifest/shared directory方式へ戻さない
  • per-skill thin wrapper方式へ戻さない

過去の manifest dual mount 案や per-skill symlink案を、最新決定より優先してはならない。

現在判明しているCI修正対象

まず以下の二件を再現し、実装由来の失敗として修正する。

1. thin-wrapper前提が残っているテスト

scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke.py
::test_given_repo_when_thin_wrapper_checked_then_points_to_canonical_body

現在は .agents/skills/worktree-agent-runtime-smoke/SKILL.md がroot symlink経由でcanonical本文そのものを参照するため、旧thin wrapperの文字列 derived/non-canonical を要求するassertionは無効である。

テストをroot symlink契約へ更新する。

検証対象には少なくとも以下を含める。

  • .agents/skills 自体がsymlink
  • readlink .agents/skills が正確に ../.claude/skills
  • Git index modeが 120000
  • .agents/skills/<skill>/SKILL.md がcanonical packageへ到達する
  • canonical本文を変更せず、Codex surfaceから同じ内容が読める
  • 旧thin-wrapper markerを要求しない

2. fixtureがregular directoryを作っているテスト

tests/codex/test_codex_permission_profile_config.py
::test_baseline_repo_passes_both_validators_without_mutation

fixture生成時に .agents/skills がregular directoryになり、JS validatorから次のエラーを受けている。

FAIL .agents/skills: must be a root skill-directory symlink, not a regular directory

fixture copy処理を更新し、root symlinkをdereferenceせずsymlinkとして保持または再構築する。

次も維持する。

  • regular directoryを拒否するnegative test
  • broken symlinkを拒否するnegative test
  • absolute targetを拒否するnegative test
  • repository外へescapeするtargetを拒否するnegative test
  • Python validatorとJavaScript validatorの判定parity
  • fixtureが実リポジトリのtopologyを正確に再現すること

単にvalidatorを緩めてテストを通してはならない。

実装ループ

リポジトリの以下を読み、その契約どおり実行する。

.claude/skills/impl-review-loop/SKILL.md
.claude/skills/impl-review-loop/steps/preparation.md
.claude/skills/impl-review-loop/steps/step-1-implementation.md
.claude/skills/impl-review-loop/steps/step-2-verification.md
.claude/skills/impl-review-loop/steps/step-4-pr-review.md
.claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md
.claude/skills/impl-review-loop/steps/step-5-mergeability-handling.md

各iterationは必ず次の順で行う。

  1. implementation-worker

    • reviewer blockers、CI failures、live contractを入力する
    • Allowed Paths内だけを編集する
    • targeted testを追加または更新する
    • commit可能な状態にする
  2. test-runner

    • targeted tests
    • Issue記載Verification Commands
    • Python/JS validator parity
    • 関連test file全体
    • full CI相当
      の順で検証する
  3. commit / push

    • 既存PR branchへcommitしてpushする
    • 同じpathへの並行writeや並行commitを行わない
    • push後にcurrent head SHAを再取得する
  4. pr-reviewer

    • 実装担当とは別コンテキストでcurrent headをレビューする
      -古いSHAをレビューしない
    • verdict、reviewed_head_sha、blockers、warnings の正規形式を返す
  5. control-plane判定

    • route_loop_verdict_v2.py とlive mergeabilityで判定する
    • REQUEST_CHANGES は次iterationのfix deltaへ渡す
    • stale headならcurrent headで再レビューする
    • BEHINDなら正規update-branch経路を実行後、検証とレビューをやり直す
    • BLOCKED、UNSTABLE、DRAFT、一時的なUNKNOWNだけを理由に人間へ停止しない

レビュー観点

pr-reviewer には少なくとも以下を敵対的に確認させる。

  • Git上で .agents/skills がmode 120000として保存されるか
  • fresh checkout、linked worktree、fixture copy後もsymlinkが保持されるか
  • Python validatorとJS validatorの判定が一致するか
  • regular directoryや危険なtargetを誤って許容していないか
  • root symlink移行後もthin-wrapper前提のテストや文書が残っていないか
  • .claude/skills 配下のpackageがCodex surfaceから読めるか
  • rename/delete provenanceをAllowed Paths gateが正しく評価するか
  • Windows側ではなくWSL/Linux Git checkoutを前提とする箇所が文書化されているか
  • nested SKILL.md や重複skill discoveryに対する既知制約が誤記されていないか
  • unrelatedな .codex/agents/** やruntime permission設定を変更していないか
  • Issue 実装: Codex skill surface を root directory symlink に置換する #1926 の最新OWNER決定を勝手に再解釈していないか

architecture選択そのものはOWNER決定済みである。新しい具体的な破壊的欠陥がない限り、過去のmanifest案を理由に実装を差し戻さない。

検証

最低限、live Issueに記載されたVerification Commandsをすべて実行する。

加えて、現在失敗している二件に対して以下を実行する。

uv run --locked pytest \
  scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke.py \
  tests/codex/test_codex_permission_profile_config.py

uv run --locked pytest tests/test_codex_agent_bridge_contract.py

validatorはリポジトリ既定の正規環境変数、wrapper、実行方法に従って実行する。CIを通すためにfail-open用環境変数をproduction検証へ常用してはならない。

targeted tests成功後、full Python suiteおよびCI相当を実行する。push後はGitHub Actionsのcurrent-head checksを取得し、失敗が残る限りループを継続する。

flakyと断定する前に、同じcurrent headで再現性とmain比較を確認する。

Allowed Paths

Allowed Pathsの正本は常にlive Issue本文とする。

contract snapshotのstale、digest差異、artifact欠落はadvisory warningとして扱い、それだけで停止しない。一方、実際のAllowed Paths違反を無視またはbypassしてはならない。

新しい修正pathが必要になった場合は、次の順で処理する。

  1. live Issueに既に許可されているか確認
  2. rename/delete provenanceとして許可されるか確認
  3. リポジトリの正規contract repair経路で決定論的に補正可能か確認
  4. 補正後にcontract reviewとAllowed Paths gateを再実行

単なる実装派生テスト修正について、途中承認を求めない。明示OWNER決定と衝突するscope変更だけをhuman escalation対象とする。

GitHub上の処理

各push後に以下を再取得する。

  • PR head SHA
  • required checks
  • PR comments
  • submitted reviews
  • unresolved threads
  • mergeability
  • base branchとの差分

具体的なreview指摘が追加された場合は、内容を検証して妥当なら修正し、テスト結果を添えて返信し、修正済みthreadをresolveする。承認を求めず次iterationへ進む。

PR本文は実装の最終状態と一致させる。古いtest count、古いSHA、既に解消したblockerを残さない。

人間へ停止してよい条件

次の場合だけ停止する。

  • 実際のGit conflict:mergeable == CONFLICTING または merge_state_status == DIRTY
  • live OWNERコメントによる明示的な停止指示
  • 相互に両立しない複数の最新OWNER決定
  • 必要な認証またはrepository権限がない
  • secret取得、外部課金、権限昇格が必要
  • Allowed Pathsを越える破壊的変更が不可避で、正規repair経路でも解決不能
  • merge操作を実行する段階に到達した

次は停止理由にしない。

  • SubAgentの単なる human_review_required: true
  • advisory artifact不足
  • stale contract snapshot
    -一時的なmergeability UNKNOWN
  • 通常のテスト失敗
  • 通常のreview指摘
  • commitやpush前の確認
  • Draft状態そのもの

完了処理

全条件が収束したら、リポジトリの通常方針が許す範囲でPRをReady for Reviewへ移行する。正本の impl-review-loop がDraft維持を要求する場合はその契約を優先し、draft_pr_ready として停止する。

merge、auto-merge有効化、Issue close、branch削除は行わない。

最後に次の形式で報告する。

IMPL_REVIEW_LOOP_RESUME_RESULT_V1:
  status: merge_ready | draft_pr_ready | blocked
  issue: 1926
  pull_request: 1972
  final_head_sha: "<sha>"
  iterations: <int>
  model_routing:
    preferred: gpt-5.3-codex-spark
    spark_subagents_used: []
    canonical_role_fallbacks: []
  fixes:
    - path: "<path>"
      summary: "<summary>"
  verification:
    targeted_tests: []
    issue_verification_commands: []
    full_suite: "<result>"
    required_ci: "<result>"
  review:
    verdict: APPROVE | REQUEST_CHANGES | HUMAN_REVIEW_REQUIRED
    reviewed_head_sha: "<sha>"
    blockers: []
    warnings: []
    unresolved_threads: 0
  mergeability:
    mergeable: "<value>"
    merge_state_status: "<value>"
  remaining_human_action:
    - "PR #1972をマージする"
  stopped_without_merge: true

ここから調査だけで終了せず、既存branch上の実装、テスト修正、commit、push、CI再確認、独立レビューの反復を直ちに開始してください。

Codex CLI の既存メインセッションへ、そのまま貼り付けて実行できます。

@squne121
squne121 marked this pull request as ready for review August 2, 2026 14:38
@squne121
squne121 merged commit 5b8763b into main Aug 2, 2026
37 of 38 checks passed
@squne121
squne121 deleted the worktree-issue-1926-codex-skill-surface-root-directory-symli branch August 2, 2026 14:38
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.

実装: Codex skill surface を root directory symlink に置換する

1 participant