Skip to content

実装: issue-refinement-loop structural repair が trusted human-context anchor の section source_span を consume できるようにする #2582

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "trusted direct-human-context lane が明示的・完全一致の required contract section を既存 structural repair model で fail-closed に consume できるようにする"
change_kind: workflow
dedupe_key: "issue-refinement-loop:trusted-human-context-owner-anchor-section-source-span:v1"

Parent Issue

none

Parent Goal Ref

  • Goal: preflight.run.with_human_context で明示指定された trusted human-context anchor の exact section source を、既存の structural repair と controlled transaction lane で安全に消費できるようにする。
  • Desired Destination: #2572 は main に merge 済みの本改善を用いた fresh canonical preflight から contract refinement を再開できる。

Current Validated Scope

Remaining Parent Gaps

Outcome

run_refinement_preflight.py、repair_issue_contract.py、および focused regression tests の変更を含む 1 PR により、explicit with_human_context lane の trusted OWNER anchor が持つ exact canonical required section を owner_anchor / source_span_exact として provenance 検証付きで structural repair が消費し、異常・曖昧な source は auto-apply されない状態にする。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: control-plane の静的 Python ロジックと deterministic fixture を変更するのみで、browser/runtime behavior を変更しないため。

In Scope

  • preflight.run.with_human_context が explicit human-context lane と trusted anchor binding を満たす場合だけ、anchor comment 内の exact canonical H2 required section を bounded source span として assemble する。
  • 既存 owner_anchor authority と source_span_exact / template_value_exact / derived_scalar_exact derivation model を再利用し、source repo、target Issue、comment identity、body digest/revision、heading、exact span/text を既存 provenance model で再検証する。
  • duplicate heading、empty/malformed section、unlabeled anchor、agent-report lane、association 不適合、wrong repo/Issue/comment identity、digest/revision mismatch、stale source、competing candidate を fail-closed に保つ。
  • 導入: M5 Playable Slice Hardening 実装 parent tracker #2572 相当 positive fixture と origin/provenance/ambiguity negative fixtures、および 実装: issue-refinement-loop の structural repair producer に known_scalars/source_spans の実抽出を配線する #2431 current-issue same-body regression を既存 focused test suite に追加または更新する。

Out of Scope

Acceptance Criteria

Verification Commands

AC1 / AC3 / AC4:

# AC4
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_structural_repair_known_scalars_wiring.py -q
# AC1
# AC3
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py -q

AC2 / AC5:

# AC2
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_structural_repair_action_apply_consumer.py -q
# AC5
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_command_policy_anchor.py -q
# AC5
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py -q

Repository baseline:

$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm build
$ uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py

Allowed Paths

  • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
  • .claude/skills/issue-refinement-loop/scripts/repair_issue_contract.py
  • .claude/skills/issue-refinement-loop/tests/test_structural_repair_known_scalars_wiring.py
  • .claude/skills/issue-refinement-loop/tests/test_structural_repair_action_apply_consumer.py
  • .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py
  • scripts/agent-guards/tests/test_skill_runtime_command_policy_anchor.py
  • scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py

Stop Conditions

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

Required Skills

なし。

Required Design References

Delivery Rule

  • 1 Issue = 1 PR。fresh dedicated worktreeで実装し、Draft PRを作成してfocused regressions、current-main baseline comparison、independent test/review、CI、fresh reviewを通す。
  • 導入: M5 Playable Slice Hardening 実装 parent tracker #2572 のcanonical trusted contract updateは本PRがmainにmergeされるまで実行しない。

Notes for Reviewer

Scope Delta

N/A

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Sep 8, 2026
  2. squne121 commented on Sep 8, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  3. squne121 commented on Sep 8, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-09-08)

    • PR: fix: trusted owner anchor section spans #2583
    • Worktree: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/issue-2582-trusted-anchor-section-source-span
    • Branch: worktree-issue-2582-trusted-anchor-section-source-span
    • Commit: 0141f295
    • Verification: focused 5 suites + repository baseline 5 commands PASS
    • Allowed Paths: 3 changed files, all compliant
    • 後続: Draft PR の independent review と CI を実行します。
  4. squne121 commented on Sep 9, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

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/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions