Repository navigation
Open
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "Issue #1356 の Decision Record(conditional_adopt)に基づき、skill_runtime_exec.py に Linux-only optional strict_strace attribution mode を追加する"
change_kind: code
Parent Issue
none
Parent Goal Ref
- Goal: N/A(単独 implementation issue。Decision Record の出典は Issue 調査: volatile peer-session root への child プロセス自己書き込みの strict attribution を検討する #1356)
- Desired Destination: N/A
Current Validated Scope
- scripts/agent-guards/skill_runtime_exec.py に
strict_straceattribution mode(Linux-only, 明示 opt-in, default 無効)を追加 - scripts/agent-guards/tests/test_skill_runtime_exec_strict_attribution.py に新規テストを追加
- 既存の
race_tolerant_stdlibmode は default のまま変更しない
Remaining Parent Gaps
- なし(本 Issue で Issue 調査: volatile peer-session root への child プロセス自己書き込みの strict attribution を検討する #1356 AC3/AC7 の implementation issue 起票要件を充足する)
Outcome
scripts/agent-guards/skill_runtime_exec.py が race_tolerant_stdlib(default)と strict_strace(Linux-only, opt-in)の 2 mode を持ち、strict_strace mode では volatile peer-session root(.claude/worktrees/** 等)への child process 由来の allowed_write_roots 外 write を fail-close で検出できる状態になり、対応する pytest が全て green である状態。
In Scope
skill_runtime_exec.pyにattribution_mode設定(race_tolerant_stdlib/strict_strace)を追加し、default はrace_tolerant_stdlibのまま維持するstrict_stracemode の実装:strace -f -e trace=%file相当の呼び出しで child process tree の path syscall(open/openat/openat2/creat/mkdir/mkdirat/rename/renameat/renameat2/unlink/unlinkat/symlink/symlinkat/link/linkat/truncate/chmod/chown/utimensat)と fd syscall(write/pwrite64/writev/pwritev/pwritev2/ftruncate/copy_file_range/sendfile)を追跡し、fd table(dup/dup2/dup3/close/fcntl(F_DUPFD*)、fork/clone 経由の fd 継承)を介した write attribution を行うstrace不在 / smoke test 失敗時はstrict_stracemode をunavailableとし、reason_codestrict_attribution_unavailableで fail-closed にする(default mode には影響しない)- trace parse failure は strict mode では fail-closed にする
- secret-safe artifact handling: raw trace を stdout/stderr/PR artifact/issue comment に出さない。
--read/--writedump は使わない。parser 出力は normalized repo-relative path・syscall_class・access_mode・decision のみに縮約する。raw trace は tmp private dir に置き parse 後に削除する。debug opt-in 時のみ保存し、保存時もGH_TOKEN/HOME/absolute temp path/user name を redact する - 既存コードコメントを mode-aware に修正する(
race_tolerant_stdlibでは volatile root を除外、strict_straceでは child 由来と証明できた volatile root write を fail-close する)
- 新規テストファイル
test_skill_runtime_exec_strict_attribution.pyに以下を追加:- parser unit tests(fixture trace で常時 green)
- live strace smoke test(Linux + strace available のときのみ実行)
- strict mode required test(strace unavailable / parse failure は fail-closed)
- secret safety test(raw trace が stdout/stderr/artifact projection に出ないことを確認)
Out of Scope
race_tolerant_stdlibmode のデフォルト動作変更- macOS/Windows での
strict_straceサポート実装(unsupported のまま。silent pass にしない) .claude/skills/issue-refinement-loop/scripts/command_registry.pyのallowed_write_roots定義自体の変更- inotify/fanotify ベースの代替実装
Acceptance Criteria
- AC1:
skill_runtime_exec.pyにattribution_mode設定が追加され、default がrace_tolerant_stdlibである - AC2:
strict_stracemode で、.claude/worktrees/**への child process 由来のallowed_write_roots外 write を fail-close で検出する統合テストが green である - AC3:
straceunavailable 時にstrict_stracemode が reason_codestrict_attribution_unavailableで fail-closed になるテストが green である - AC4: trace parse failure 時に
strict_stracemode が fail-closed になるテストが green である - AC5: raw trace が stdout/stderr/artifact に出力されないことを確認する secret safety test が green である
- AC6: 既存の
race_tolerant_stdlibmode の既存 6 テストが regression なく green のままである - AC7: macOS/Windows では
strict_stracemode がunsupportedとして明示的に扱われ、silent pass しないことを確認するテストが green である
Verification Commands
# AC1
$ pnpm typecheck
# AC2
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_exec_strict_attribution.py -v
# AC3
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_exec_strict_attribution.py -v
# AC4
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_exec_strict_attribution.py -v
# AC5
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_exec_strict_attribution.py -v
# AC6
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py -v
# AC7
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_exec_strict_attribution.py -v
Allowed Paths
- scripts/agent-guards/skill_runtime_exec.py
- scripts/agent-guards/tests/test_skill_runtime_exec_strict_attribution.py
- docs/dev/agent-skill-boundaries.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Required Design References
- docs/dev/agent-skill-boundaries.md#Parallel Agent Runtime Safety
- Issue 実装: 契約実行ラッパーの unauthorized_write_path 誤検知を修正する #1343 AC3/AC5
- PR fix: 契約実行ラッパーの unauthorized_write_path 誤検知を修正する #1349 Safety Claim Matrix
- Issue 調査: volatile peer-session root への child プロセス自己書き込みの strict attribution を検討する #1356(Decision Record 全文の出典)
Scope Delta(任意)
N/A
Notes for Reviewer
- 本 Issue は Issue 調査: volatile peer-session root への child プロセス自己書き込みの strict attribution を検討する #1356(research, APPROVE 済み, Decision Record 記載済み)の follow-up implementation issue。
- Relates to 調査: volatile peer-session root への child プロセス自己書き込みの strict attribution を検討する #1356(Closes ではない。調査: volatile peer-session root への child プロセス自己書き込みの strict attribution を検討する #1356 は research issue として close 可能な状態)。
- severity: optional_follow_up。Linux-only optional strict mode の prototype であり、既存 default 挙動には影響しない。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
fix: session-manifest hook 専用 subtree を race-tolerant 除外に追加する (#1426)
実装: SubAgent 起動 ledger の更新を runtime guard の誤検知から除外する (#1552)