Skip to content

feat(computer-use): #500 S5-c-2 PR-5 Windows の preflight と dispatch で interlock の拒否を有効化する - #819

Merged
yusei531642 merged 6 commits into
mainfrom
feat/500-s5c2-5-enable-refusal
Oct 17, 2026
Merged

yusei531642 merged 6 commits into
mainfrom
feat/500-s5c2-5-enable-refusal

Conversation

@yusei531642

Copy link
Copy Markdown
Collaborator

概要

#500 S5-c-2 の最後の PR(PR-5)です。Windows の preflight と dispatch で、同期入口(interlock)の拒否を有効にします。前提の PR-1(#816)、PR-2(#817)、PR-4(#815)は merge 済みです。PR-3(#818、Explorer の実ファイル名の取得)はレビュー中で、この PR は PR-3 のコードに依存しません。

変更(native)

  • kWindowsInterlockRuleset を追加しました。Windows には承認経路がないので、download_open と file_manager_open はどちらも false です。
  • WindowsInterlockRefusal(session, metadata, kind) を追加しました。評価に加えて、判定なしになった理由ごとの件数を OutputDebugStringA に出します(出すのは enum だけです)。
  • HandleWindowsPreflight: ValidateWindowsDispatchBinding の後、slot.Issue の前で評価します。
    • 拒否なら ticket を出さず、blocked または takeover の受領書を返します。
    • 受領書は送る前に NativePreflightRefusalAllowed を通します。通らない組は denied / native_preflight_invalid にします。
    • shadow は issued=false で呼びます。
    • 判定なしなら、今までどおり V1 の ordinary ticket を出します。
  • DispatchWindowsAction: binding の検証の直後、入力 API(input_api_attempts、SetCursorPos、SendInput、semantic action)より前で、もう一度評価します。
    • 拒否なら DispatchCode()(shell_surface_blocked / execution_trigger_blocked / approval_not_enabled)と accepted:false を返し、入力は 1 回も送りません。
    • V1 の guard は同じ順で残しています。
  • 同期入口は評価のたびに WindowsClickOpens() を読み直すので、preflight から dispatch までの間の入力も再評価で反映されます。
  • DispatchCode() を足しました。理由と 1 対 1 で対応し、判定なしのときは空です。

変更(Main)

  • classifyComputerUseNativeDispatchFailure は、上の 3 つのコードを NATIVE_PREFLIGHT_REFUSALS の同じ行の result に写します。execution trigger は paused、それ以外は rejected です(オーナー判断どおり)。
  • V1 の既存のコードは rejected のままです。パーサ、表、controller は変えていません。

変えていないもの(INV-3)

  • eligibility.json、各版、attest、list_targets の適格性は変えていません。source 契約で固定しました。

V1 で新しく拒否される語

オーナー判断で、受け入れることになっている語です。

  • 実効で増えるのは 6 語です(xterm、run script、ターミナル、コンソール、コマンドプロンプト、スクリプトを実行)。全角表記も同じ扱いです。
  • この一覧は computer-use-windows-interlock-vocabulary.test.ts で固定しました。
  • harness の journey では、fixture の全コントロール、安全ダイアログ、旧・新のメモ帳の木を、すべての action と en / ja の題名の組み合わせに通しています。拒否されるのは、V1 の語があるときと、上の受け入れた語があるときだけです。

テスト(RED の確認付き)

  • ticket seam: 3 つの拒否それぞれの受領書と ticket の有無、shadow が issued=false で 1 回呼ばれること、判定なしでは ordinary ticket が出ること、表に無い組は denied になることを確かめます。binding の失敗、replay、session がない、不正な action のときは、評価を呼ばないことも確かめます。
  • dispatch seam(新規 computer-use-windows-dispatch-interlock-seam.test.ts): 拒否のときは理由コードと accepted:false を返し、呼ばれる順が [validate, interlock] で入力が 0 回であることを確かめます。判定なしなら V1 に進むことも確かめます。
  • source 契約: 評価を呼ぶのはちょうど 2 か所で、置き場所の順序、ruleset、受領書の表チェックが計画どおりであることを確かめます。
  • harness: DispatchCode() の対応と、上の V1 の journey を確かめます。
  • Main: 3 つのコードの写し方、表との整合、V1 のコードが rejected のままであることを確かめます。
  • 結果: harness は全件 PASS、vitest(computer-use-windows / computer-use-native)は 344 件が通り、tsc と prettier も通りました。host のビルドも成功しています。

留意点

  • fixture の journey(1001〜1010、1201〜1202)による外部受入の E2E は、署名済みのパッケージが要るので、この PC では実行していません。CI の Windows ジョブで確かめます。preflight と dispatch の遅延も、実機ではまだ測っていません。
  • 「人の入力と重なった可能性」を拒否の理由に出す案は、受領書の表に行を足すことになるので見送りました。ADR の既知の限界に書いています。
  • macOS の dispatchApproved は、同じ分類関数を共有しています。macOS の host が今回の 3 つのコードを返す経路があるかどうかは、レビューで確かめます。

Refs #500

🤖 Generated with Claude Code

… interlock の拒否を有効化する

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sprintreviewer

sprintreviewer Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

🗺️ PR Walkthrough

Note

Windows の preflight と dispatch で interlock 拒否を有効化し、危険な操作には ticket を発行せず、dispatch 時にも入力送信前に再評価します。拒否理由は受領書と Main の結果に対応づけ、判定できない場合は既存の V1 処理へ進みます。

Changed files (14)
File Summary
apps/desktop/computer-use-native/computer_use_windows_host.cc Windows の規則セットと同期評価入口を追加。preflight は拒否時に ticket を出さず受領書を返し、dispatch は入力 API より前に再評価して拒否する。
apps/desktop/computer-use-native/computer_use_native_interlock.h interlock の拒否理由から dispatch 用コードへの対応を追加。
apps/desktop/src/main/computer-use-native-host.ts 3 種類の native dispatch 拒否コードを受領書テーブルの結果へ写し、実行トリガは paused、それ以外は rejected とする。
apps/desktop/computer-use-native/computer_use_protocol_fuzz.cc 拒否コードの対応と Windows の代表的な UI journey を harness で確認するケースを追加。
apps/desktop/src/main/computer-use-windows-dispatch-interlock-seam.test.ts dispatch の拒否順序、入力前の停止、判定なし時の V1 継続を検証する seam を追加。
apps/desktop/src/main/computer-use-windows-ticket-seam.test.ts preflight 拒否の受領書、ticket 不発行、shadow の状態、判定なし時の ordinary ticket を検証する。
apps/desktop/src/main/computer-use-windows-interlock-capture.test.ts 評価の呼び出し位置、ruleset、受領書の表チェック、適格性とバージョン契約を固定する。
apps/desktop/src/main/computer-use-native-host.test.ts native 拒否コードの Main 側マッピングと既存 V1 コードの結果を確認する。
apps/desktop/src/main/computer-use-windows-click-rule.test.ts 評価後に入力が割り込んだクリックを送信前に止める規則を確認する。
apps/desktop/src/main/computer-use-windows-interlock-journeys.test.ts harness の fixture UIA ツリーが実 fixture のコントロールと一致することを照合する。
apps/desktop/src/main/computer-use-windows-interlock-vocabulary.test.ts V1 との差分として新たに拒否される語と installer 語を固定する。
apps/desktop/src/main/computer-use-windows-interlock-live-seam.test.ts live seam にクリック時刻情報のスタブを追加する。
apps/desktop/src/main/computer-use-windows-shadow-wiring.test.ts interlock 拒否経路を含む shadow 呼び出しと受領書生成の件数期待を更新する。
tasks/designs/adr-computer-use-agent-driven-v2.md PR-5 の配線、拒否・判定なしの挙動、既知の遅延や語彙差分を設計記録へ追記する。

Reviewed by vibe-editor-reviewer — head ebf3056

@sprintreviewer sprintreviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Code review

Tip

LGTM — actionable issues were not found.

確認内容

  • ✅ 変更箇所と関連するコード経路を確認
  • ✅ 独立した差分レビュー(Claude)を確認
  • ✅ リードが指定した重点ファイルの精査(Claude)を確認

レビュー所感

固定 HEAD を照合し、Windows の拒否判定、ticket・取消し境界、入力前の既存ガード、Main の結果分類を確認しました。対象差分に起因する重大な不具合は確認できませんでした。実行環境がないため、検証は静的確認に限ります。

🛡️ blockingな指摘はありません。bot側の安全設定により、merge-relevantなAPPROVEではなくCOMMENTとして投稿します。

Review coverage & tooling
  • Files: 12 reviewed (+867 / -18)
  • Full file bodies included: 0 / 12
  • Reviewer roles: numeric_consistency (deterministic), codex_deep (gpt-6.1-sol), claude_peer (claude-opus-5-5, fixed-diff only, partial), claude_specialist (claude-opus-5-5, fixed-diff only, partial)

Reviewed by vibe-editor-reviewer — head 5929a99

yusei531642 and others added 2 commits October 17, 2026 11:34
…止める、インストーラー語の凍結、fixture の木の照合、INV-3 の本体固定

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…live で固定する

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@sprintreviewer sprintreviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Code review

Tip

LGTM — actionable issues were not found.

確認内容

  • ✅ 変更箇所と関連するコード経路を確認
  • ✅ 独立した差分レビュー(Claude)を確認
  • ✅ リードが指定した重点ファイルの精査(Claude)を確認

レビュー所感

固定HEADと全対象差分を確認し、拒否時のticket無効化、入力前の再評価、取消し・入力競合、Main側の結果分類を追跡しました。重大な退行を裏付ける具体的な欠陥は確認されませんでした。実行検証は行っていません。

🛡️ blockingな指摘はありません。bot側の安全設定により、merge-relevantなAPPROVEではなくCOMMENTとして投稿します。

Review coverage & tooling
  • Files: 14 reviewed (+1389 / -23)
  • Full file bodies included: 0 / 14
  • Reviewer roles: numeric_consistency (deterministic), codex_deep (gpt-6.1-sol), claude_peer (claude-opus-5-5, fixed-diff only, partial), claude_specialist (claude-opus-5-5, fixed-diff only, partial)

Reviewed by vibe-editor-reviewer — head 3d1c565

yusei531642 and others added 2 commits October 17, 2026 11:45
…tCursorPos の対照を足す

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@sprintreviewer sprintreviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Code review

Tip

LGTM — actionable issues were not found.

確認内容

  • ✅ 変更箇所と関連するコード経路を確認
  • ✅ 独立した差分レビュー(Claude)を確認
  • ✅ リードが指定した重点ファイルの精査(Claude)を確認

レビュー所感

全5差分チャンクを確認し、拒否時の ticket 無効化、入力前の再評価、取消し・フォーカス変化、Main の結果分類を追跡しました。既存ガードと受領書の契約は維持されており、今回導入された重大な不具合は確認できませんでした。実行検証は行っていません。

🛡️ blockingな指摘はありません。bot側の安全設定により、merge-relevantなAPPROVEではなくCOMMENTとして投稿します。

Review coverage & tooling
  • Files: 14 reviewed (+1465 / -23)
  • Full file bodies included: 0 / 14
  • Reviewer roles: numeric_consistency (deterministic), codex_deep (gpt-6.1-sol), claude_peer (claude-opus-5-5, fixed-diff only, partial), claude_specialist (claude-opus-5-5, fixed-diff only, partial)

Reviewed by vibe-editor-reviewer — head e30cd63

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@sprintreviewer sprintreviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Code review

Tip

LGTM — actionable issues were not found.

確認内容

  • ✅ 変更箇所と関連するコード経路を確認
  • ✅ 独立した差分レビュー(Claude)を確認
  • ✅ リードが指定した重点ファイルの精査(Claude)を確認

レビュー所感

全差分と関連コードを確認し、ticket の失効、入力前の拒否、取消し・フォーカス変更、Main の結果分類を重点的に追跡しました。本PRで導入された重大な不具合は確認できませんでした。実行検証は利用できないため、判断は静的解析とテスト内容の確認に基づきます。

🛡️ blockingな指摘はありません。bot側の安全設定により、merge-relevantなAPPROVEではなくCOMMENTとして投稿します。

Review coverage & tooling
  • Files: 14 reviewed (+1496 / -23)
  • Full file bodies included: 0 / 14
  • Reviewer roles: numeric_consistency (deterministic), codex_deep (gpt-6-astra), claude_peer (claude-opus-5-5, fixed-diff only, partial), claude_specialist (claude-opus-5-5, fixed-diff only, partial)

Reviewed by vibe-editor-reviewer — head ebf3056

@yusei531642

Copy link
Copy Markdown
Collaborator Author

マージ前の確認(PR-5 の E2E と遅延)

fixture の journey(1001〜1010、1201〜1202)

この PC でも CI でも流せないことを確かめました。

  • docs/computer-use-simple-acceptance.md §3 の規定どおり、fixture に full_access_app の権限を与えるには、helper の Authenticode 署名者が必要です。
  • 署名なしの受入ビルドでは fixture を昇格できないため、journey は「not attempted」として扱う決まりです。
  • 自己署名で代用するには信頼ストアの変更が必要で、これはしていません。
  • CI の Windows focused smoke はこの構成では skip されるので、CI でも journey は流れていません。

そのため、PR-5 のビルドと PR-5 より前のビルドを journey で比べる作業は、署名済みのパッケージを使った人の受入(S9a)に引き継ぎます。

代わりに測ったもの(実物の窓での評価時間)

  • 測定のしかた: 本番の EvaluateWindowsInterlockOnLane(MTA ワーカー、250 ms の UIA、実際の reader と gate)をそのままコンパイルしました。自分で起動したメモ帳と電卓を対象に、click の評価を 50 回ずつ行い、レーンを保持した時間を測りました。
対象 中央値 p90 最大 結果
メモ帳 17.2 ms 20.2 ms 26.0 ms 50 回とも評価が完了し、拒否なし
電卓 25.9 ms 28.7 ms 30.6 ms 50 回とも評価が完了し、拒否なし
  • 1 回の評価は、レーン保持の上限 500 ms に対して十分小さい値でした。
  • 1 回の操作では preflight と dispatch で評価が 2 回走るので、増えるのは 30〜60 ms 程度の見込みです。
  • 通常の窓では、拒否も budget(判定なし)も 0 回でした。

macOS への影響

新しい 3 つのコード(shell_surface_blocked / execution_trigger_blocked / approval_not_enabled)は、macOS の host(.mm)からは返されません。そのため、Main の写し方を変えても macOS の挙動は変わりません。

🤖 Generated with Claude Code

@yusei531642
yusei531642 merged commit 35bd0f5 into main Oct 17, 2026
39 checks passed
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