Skip to content

実装: secret-free Claude runtime diagnostic を literal-path helper として提供する #2471

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#2456"
goal_ref: "#2456 の調査結果に基づき、secret-free の固定 enum runtime diagnostic を literal-path helper として提供し、worktree verifier の complex shell limitation を回避する。"
change_kind: mixed
dedupe_key: "claude-runtime-diag:literal-helper:v1"

Parent Issue

#2456

Parent Goal Ref

Current Validated Scope

  • scripts/agent-ops/claude_runtime_diag.py に fixed probe ID 専用の診断 helper を追加する。
  • scripts/agent-ops/tests/test_claude_runtime_diag.py に test-owned subprocess env と synthetic PreToolUse guard input だけを使う focused test を追加する。
  • docs/dev/agent-runtime-ops.md に canonical invocation と secret-free 安全境界を記録する。

Remaining Parent Gaps

Outcome

scripts/agent-ops/claude_runtime_diag.py が、固定 probe ID の literal invocation に対して raw env 値・raw path・secret を出力せず固定 enum classification を返し、focused test、baseline quality gates、および isolated Claude Code structured runtime smoke が PASS する状態。

Runtime Verification Applicability

decision: immediate
reason: >-
  worktree verifier と PreToolUse guard を通る literal helper invocation は実 runtime でのみ確認できる。
applicable_acs: [AC8, AC9]
execution_environment: >-
  isolated Claude Code linked worktree; the existing worktree runtime skill supplies the runner and is not changed by this Issue.
skip_conditions: >-
  auth/capability insufficiency (including exit 77), runner unavailability, or any condition that prevents the hygiene procedure.
fallback_policy: >-
  Do not upgrade a skip or failure to PASS; stop, retain no GitHub evidence, and report only generic blocked status.
artifact_requirements: >-
  A newly-created private temp prompt and new untracked worktree-local runner output directory; review only sanitized summary.md and never commit or post it.
evidence_policy: >-
  controller は newly-created private temp prompt に static Japanese instruction と三つの literal helper invocation だけを書き、
  新規の untracked worktree-local artifact output directory を runner に渡す。review 対象は runner の summary.md だけとし、
  summary.md は fixed enum/boolean output だけを含まなければならない。prompt、raw stdout/stderr、transcript、raw env value、
  raw path は commit または GitHub 投稿しない。raw egress 又は sanitized summary.md 不在は FAIL とし、verification を停止し、
  GitHub evidence を残さず generic blocked status だけを報告する。
skip_policy: >-
  auth/capability 不足などで structured runtime smoke が exit 77 の場合は PASS に昇格させず、
  runtime verification policy の SKIP 証跡と Stop Conditions に従う。

In Scope

  • 次の three fixed probe IDs だけを受理する Python helper を実装する。helper は environment から exactly CLAUDE_GPT_HOME と HOME だけを読み、一つの positional probe ID だけを受理する。OS/filesystem access、os.path.realpath、Path.resolve、symlink resolution、file read は禁止する。
Probe ID 固定 output 決定論的 lexical rule
claude-gpt-root-state `runtime_root=present absent`
claude-gpt-home-class `home_class=isolated nested
claude-gpt-root-relation `root_relation=same nested

raw string は nonempty かつ / で始まる場合だけ valid_absolute であり、missing、empty、relative は valid_absolute ではない。expansion、normalization、resolution は行わず、raw input は success/error のいずれの path でも echo しない。

Fixture CLAUDE_GPT_HOME HOME root-state home-class root-relation
isolated /synthetic/root /synthetic/root/claude-home present isolated other
nested /synthetic/home/.claude-gpt /synthetic/home present nested nested
same /synthetic/same /synthetic/same present unexpected same
absent missing /synthetic/home absent unexpected other
empty `` /synthetic/home absent unexpected other
relative/malformed relative-root /synthetic/home present unexpected other
unrelated absolute /synthetic/root-a /synthetic/root-b present unexpected other
  • CLAUDE_GPT_HOME と HOME は classification 内部でのみ読み、stdout/stderr には fixed enum output だけを出す。all other args(unknown probe ID と extra args を含む)は exactly error=invalid_arguments と nonzero で reject する。
  • fixture table の isolated、nested、same、absent、empty、relative/malformed、unrelated absolute の全 row を test-owned subprocess env mapping(only synthetic values)で実行し、expected enum を検証する。actual host HOME は読まず、利用しない。
  • arbitrary variable / path / expression を引数で指定する generic interface を提供しない。
  • synthetic PreToolUse guard input で exact helper invocation は allow され、inline Python、env dump、sensitive path は block のままであることを確認する。
  • linked worktree の isolated Claude Code structured smoke を一度行い、三つの literal invocation が safe fixed output を返し、worktree verifier の refusal がないことを確認する。既存の worktree runtime skill が runner を提供し、runner/skill の変更は本 Issue の対象外である。
  • canonical invocation と「分類以外の env/path egress をしない」安全境界を docs に記録する。

Out of Scope

Acceptance Criteria

  • AC1: helper は environment から exactly CLAUDE_GPT_HOME と HOME だけを読み、one positional fixed probe ID だけを受理する。各 successful call は expected fixed enum の exactly one-line stdout と empty stderr を返す。

  • AC2: fixture table の isolated、nested、same、absent、empty、relative/malformed、unrelated absolute の全 row について、test-owned subprocess env mapping(only synthetic values)で三 probe を実行し、表の root-state、home-class、root-relation enum と一致する。actual host HOME は使用しない。

  • AC3: unknown probe ID、extra args、または positional probe ID 以外の invocation は exactly error=invalid_arguments を出力し nonzero で終了する。

  • AC4: lexical classification は raw string の nonempty / prefix と fixture table の exact string comparison だけに従い、missing、empty、relative/malformed を valid_absolute と扱わない。OS/filesystem access、os.path.realpath、Path.resolve、symlink resolution、file read、expansion、normalization、resolution を行わない。

  • AC5: 全 fixture row と invalid-argument path で stdout/stderr に raw test sentinel、raw env value、raw path が現れない。successful call は stderr empty である。

  • AC6: arbitrary variable/path/expression を指定する interface は存在せず、unknown ID と extra args を含む任意の追加 argv は AC3 の fixed error と nonzero で reject する。

  • AC7: synthetic guard input は exact helper invocation を allow し、inline Python、env dump、sensitive path を引き続き block する。

  • AC8: controller は newly-created private temp prompt を作り、static Japanese instruction と次の three literal helper invocations だけを入れる。three literal helper invocations 以外の変数名、値、path を prompt に追加しない。既存の worktree runtime skill が提供する runner を用い、新規の untracked worktree-local artifact output directory で structured runtime smoke を実行する。runner/skill の変更は本 Issue の対象外である。

    以下の三つのコマンドをそのまま実行し、各結果の固定 enum/boolean 一行だけを summary.md に記録してください。
    python3 scripts/agent-ops/claude_runtime_diag.py claude-gpt-root-state
    python3 scripts/agent-ops/claude_runtime_diag.py claude-gpt-home-class
    python3 scripts/agent-ops/claude_runtime_diag.py claude-gpt-root-relation
    
  • AC9: controller が review するのは runner summary.md だけであり、同 file は fixed enum/boolean output だけを含む。raw prompt、raw stdout/stderr、transcript、raw env value、raw path は commit または GitHub 投稿しない。raw egress 又は sanitized summary.md 不在は FAIL とし、verification を停止し、GitHub evidence を一切残さず generic blocked status だけを報告する。

  • AC10: focused pytest と pnpm typecheck、pnpm lint、pnpm test、pnpm build、Gemini routing test が PASS する。

  • AC12: PR 本文は日本語中心とし、この Issue を Closes #<this-issue-number>、調査: worktree isolation / secret boundary guard が secret-free診断まで過剰拒否する #2456 を Related #2456 と記載する。調査: worktree isolation / secret boundary guard が secret-free診断まで過剰拒否する #2456 を close しない。

Verification Commands

# AC1
$ uv run pytest scripts/agent-ops/tests/test_claude_runtime_diag.py -k fixed_probe_ids
# AC2
$ uv run pytest scripts/agent-ops/tests/test_claude_runtime_diag.py -k subprocess
# AC3
$ uv run pytest scripts/agent-ops/tests/test_claude_runtime_diag.py -k invalid_arguments
# AC4
$ uv run pytest scripts/agent-ops/tests/test_claude_runtime_diag.py -k lexical
# AC5
$ uv run pytest scripts/agent-ops/tests/test_claude_runtime_diag.py -k no_raw_egress
# AC6
$ uv run pytest scripts/agent-ops/tests/test_claude_runtime_diag.py -k arbitrary
# AC7
$ uv run pytest scripts/agent-ops/tests/test_claude_runtime_diag.py -k guard
# AC8
$ uv run --locked python3 scripts/agent-ops/run_worktree_agent_runtime_smoke.py --runtime claude --mode structured --worktree "$PWD" --prompt-file /tmp/claude-runtime-diag-smoke.md --output-dir artifacts/runtime-smoke/claude-runtime-diag --timeout-seconds 180 --require-clean-postcondition
# AC9
$ uv run pytest scripts/agent-ops/tests/test_claude_runtime_diag.py -k evidence_hygiene
# AC10
$ uv run pytest scripts/agent-ops/tests/test_claude_runtime_diag.py
# AC12
$ gh pr view "$PR_NUMBER" --repo squne121/loop-protocol --json body

Allowed Paths

  • scripts/agent-ops/claude_runtime_diag.py
  • scripts/agent-ops/tests/test_claude_runtime_diag.py
  • docs/dev/agent-runtime-ops.md

Scope Collision Note

Overlap preflight is advisory and found only declared-path overlap, not a duplicate outcome. #2456 is the completed research source; #2437 and #1499 have unrelated docs/dev/agent-runtime-ops.md edit intents; broad historical scripts / docs/dev declarations are false-positive containers. This Issue owns only the new helper, its dedicated test, and the helper-specific documentation paragraph. If any of #2437 or #1499 remains unmerged when implementation starts, rebase and resolve the documentation hunk serially; do not expand scope or modify their Issue bodies/comments.

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合。
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合。
  • nested SubAgent delegation が必要になった場合。
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Runtime Block Disposition

actual literal helper が block された場合、controller は producer を sanitized static reason だけで classify し、guard/settings を編集しない。変更の前に amended Allowed Paths を含む separate Issue を作成し、本 Issue は open/blocked のままにする。この disposition は pytest が prove するものではない。raw block evidence は publish せず、AC8-AC9 の hygiene procedure に従い generic blocked status だけを報告する。

  • runtime smoke が exit 77 または nonzero の場合、PASS に代替せず runtime verification policy に従って停止・証跡化する。

Required Skills

なし

Required Design References

Scope Delta(任意)

N/A

Delivery Rule

  • 1 Issue = 1 PR。linked worktree で実装し、Draft PR を既定とする。
  • PR は日本語中心で記述し、Closes #<this-issue-number> と Related #2456 を含める。Closes #2456 は禁止する。

Activity

  1. added
    enhancement
    phase/implementation
    agent/implementer
    kind/implementation
    area/ai-ops
    test
    documentation
    follow-up
    on Sep 1, 2026
  2. squne121 commented on Sep 1, 2026

    @squne121
    OwnerAuthor

    Runtime Verification Evidence(current head)

    • tested_head: a3ae5d331524016f01420f43f0d5412284e0490a
    • literal_command_set_sha256: sha256:8ee3b8108fefd0a4af83c54f473dd608fec1e664488efcf8aa951d7bbc534657
    • 実行経路: linked worktree の isolated Claude Code structured runtime smoke。
    • 結果: exit 0、clean postcondition、fixed enum-only summary。
    • 境界確認: worktree command-shape refusal、permission denial、unexpected change、raw egress は観測されませんでした。
    • 証跡衛生: untracked local artifact の sanitized summary だけを確認し、prompt、transcript、raw environment value、raw path、credential、token、config content は Issue・PR・GitHub comment に保存していません。

    このコメントは #2471 の immediate runtime verification の sanitized completion record です。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerarea/ai-opsdocumentationenhancementfollow-upkind/implementationphase/implementationtest

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions