Skip to content

ADR-DOE-AGENTS-008: unify readiness physics into single homes - #552

Merged
proboscis merged 2 commits into
mainfrom
adr/008-ready-physics-single-home
Jul 26, 2026
Merged

ADR-DOE-AGENTS-008: unify readiness physics into single homes#552
proboscis merged 2 commits into
mainfrom
adr/008-ready-physics-single-home

Conversation

@proboscis

Copy link
Copy Markdown
Owner

概要

A-1(ready 判定物理の一本化)。ADR-DOE-AGENTS-004 の受理済み law protocol-physics-has-one-home に対する readiness 物理の違反状態を解消し、executable ADR ADR-DOE-AGENTS-008 として法・反例・テスト・semgrep・実装を一括出荷する。

何が散在していたか(実測)

事実 旧・家 1 旧・家 2
claude readiness adapters/claude.py CLAUDE_READY_PATTERN(screen-reader mode footer) markers.hy has-idle-prompt(通常 mode )— 起動 argv 自体も fork
codex readiness adapters/codex.py CODEX_READY_PATTERN(regex 形式) markers.hy 述語群(同一 mode・別形式 — 無音 drift 可能)
repl-idle 予算 120s launch.hy literal(退役 Rust を「oracle 定数」と呼ぶコメント付き) effects.hy MonitorKnobs 既定値 literal
screen-reader trust prompt session.py _screen_reader_trust_prompt_visible (markers.hy の R9 trust の sibling が孤立)

決定(ADR-008)

  • R1: gate 形式の物理(pattern 文字列・trust prompt 述語)の家 = sessionhost/impls/ready_physics.hy(doeff-free leaf — package root の「命令型 transport は doeff VM 非依存」性質を保つため markers.hy と分離)。observation 形式の家 = markers.hy。消費者は import のみ。
  • R2: 予算 120s の literal の家 = effects.hy(knob 語彙)。launch.hy / host.hy は import。
  • R3: codex の regex⟺述語 parity を verbatim fixture で機械執行。
  • R4: 触った物理帯から退役 Rust の「oracle」文言を除去(ADR-004 R7/U1 の履行)。gemini は重複なし(単一の家)のため移動しない。

一本化が可視化した既存 divergence(本 PR では登記のみ・物理は不変更)

  1. codex trust-dialog frame: gate regex は拒否 / has-idle-prompt› 1. 選択 marker を受理 — sessionhost の skip_trust_setup 経路に fail-closed guard が無い潜在穴 → follow-up issue。
  2. claude screen-reader trust first-paint: verbatim capture に「Please answer y or n.」が無く、現行述語は初回描画に match しない(実運用は generic onboarding pattern が dismissal を担っていた)→ follow-up issue。

Verification(1:1 対応表)

検証項目 テスト
adapters の pattern は家の定数オブジェクトそのもの packages/doeff-agents/tests/test_ready_physics_single_home.py::test_claude_ready_pattern_is_the_physics_home_constant / ::test_codex_ready_pattern_is_the_physics_home_constant
adapters に pattern literal の再定義なし ::test_adapters_do_not_define_ready_pattern_literals + semgrep doeff-agents-ready-pattern-literal-outside-physics-home(red 相で claude.py:20 / codex.py:23 に fire 確認済み)
leaf は doeff-free ::test_physics_leaf_is_doeff_free
trust prompt 述語の家移動 ::test_screen_reader_trust_prompt_predicate_matches_reprompt_frame / ::test_session_py_does_not_redefine_trust_prompt_physics
codex regex⟺述語 parity(4 frame) ::test_codex_gate_regex_and_predicates_agree[...]
予算 literal 一本化 ::test_repl_idle_budget_is_not_redefined_in_launch_hy / ::test_host_hy_takes_budget_from_effects_not_launch / ::test_repl_idle_budget_values_cohere + semgrep doeff-agents-repl-idle-budget-literal-single-home(red 相で launch.hy:81 に fire 確認済み)
ADR-008 enforcement 実行可能 docs/adr/defadr_doeff_agents_008_ready_physics_single_home.hy(pytest -k 008 → 5 passed)
semgrep rule の 2 モード実射 tests/semgrep/test_vm_failfast_semgrep_rules.py::test_ready_physics_single_home_rules_detect_redefinitions + repo-root モード手動確認
既存 ready gate 回帰網 packages/doeff-agents/tests/test_ready_gate.py(48/48 green、変更なしで通過)

実行した検証コマンド

  • uv run pytest packages/doeff-agents/tests/test_ready_physics_single_home.py packages/doeff-agents/tests/test_ready_gate.py -q48 passed
  • uv run pytest packages/doeff-agents/tests packages/doeff-agents/conformance -q1711 passed / 36 failed — 36 件全件を基線照合済み(下記 deviations)
  • uv run pytest docs/adr -q -k 0085 passed
  • uv run pytest tests/semgrep/test_vm_failfast_semgrep_rules.py -q -k ready_physics1 passed
  • make lint-semgrep192 rules / 0 findings
  • uv run ruff check <touched files> → All checks passed(基線 96 件は PR Fix issue #530 CliRunner stderr capture + clean ruff baseline to zero #551 で 0 化済み)
  • 正典 hy gate conformance(CONFORMANCE_AGENTD_BIN=doeff-sessionhost): S10 まで green を確認

Verification deviations(全件明示)

fail 36 件の内訳と基線照合:

  1. conformance 27 件 = 既定 gate(cargo build した退役 Rust)への既知 red。S20/S21/S23-S27 等は conformance README が「P(hy gate のみ)」と明記する検定で、退役 Rust では構造的に fail する(A-1 と無関係 — 変更を含まない並行 branch でも同一集合で fail)。
  2. 正典 hy gate の全量実走は環境要因でブロック: 未改変 main(27dacb7)+ main の venv でも S11b(test_s11b_claude_without_config_dir_warns_only)で client readline hang を再現 — 7/21 以降のローカル環境ドリフト(herdr protocol 変更が濃厚)。別 issue で追跡。
  3. substrate_herdr 5 件 = 同環境ドリフト(main 基線でも fail — 並行 branch で基線照合済み)。
  4. test_cli_agentd 1 件 = issue test_ps_warns_about_unparseable_agentd_rows fails on main: #528 pinned click to 8.1.8, CliRunner no longer captures stderr separately #530(PR Fix issue #530 CliRunner stderr capture + clean ruff baseline to zero #551 で修正済み — 本 branch は Fix issue #530 CliRunner stderr capture + clean ruff baseline to zero #551 以前の base)。
  5. 実 CLI e2e 3 件 = 機体条件(codex/claude の router wrapper・残骸 tmux session mcp-live-e2etest_agentd_deterministic_result_failure_is_not_retried は main 基線でも fail を実測)。
  6. make lint 全体: lint-doeff は環境未導入(基線と同条件)。pyright は doeff-agents package を include していない(pyrightconfig.json — 本 PR 以前からの repo 状態。hy module import は shell.py と同型)。

A-1 の差分起因の新規 fail はゼロ(全 fail が基線 or 並行 branch で再現)。

Follow-ups(issue 起票)

  • codex trust-frame の fail-closed 化(sessionhost skip_trust_setup 経路)
  • legacy 命令型 stack の退役 / claude 起動 mode 統一 / 残余 oracle 文言一掃 / screen-reader trust first-paint gap

🤖 Generated with Claude Code

proboscis and others added 2 commits July 25, 2026 18:05
…-DOE-AGENTS-008 red)

TDD red phase for A-1 (ready 判定物理の一本化):
- tests/test_ready_physics_single_home.py: identity/source/parity/budget
  assertions — red because sessionhost/impls/ready_physics.hy does not
  exist yet and literals still live in adapters/launch.hy
- .semgrep.yaml: doeff-agents-ready-pattern-literal-outside-physics-home +
  doeff-agents-repl-idle-budget-literal-single-home — both verified firing
  on live code (claude.py:20 / codex.py:23 / launch.hy:81) and on the new
  hit fixtures in both scan modes
- docs/adr/defadr_doeff_agents_008_ready_physics_single_home.hy: executable
  ADR (laws + deftest/defsemgrep enforcement)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Implements A-1 (ready 判定物理の一本化) — resolves the readiness instance
of ADR-DOE-AGENTS-004's protocol-physics-has-one-home law:

- NEW sessionhost/impls/ready_physics.hy: doeff-free leaf owning gate-form
  text physics (CLAUDE_SCREEN_READER_READY_PATTERN, CODEX_READY_PATTERN,
  has_claude_screen_reader_trust_prompt). Leaf keeps the package root's
  documented property intact: the imperative transport imports no doeff VM.
- adapters/claude.py, codex.py: pattern literals removed; import the home
  constants (semgrep-guarded against re-definition)
- session.py: _screen_reader_trust_prompt_visible physics moved to the home
- effects.hy: REPL-IDLE-MAX-WAIT-SECONDS literal single home (MonitorKnobs
  vocabulary); launch.hy and host.hy now import it
- markers.hy header: declares the observation-form home + retired-Rust
  provenance language per ADR-004 R7/U1 (main.rs is not an oracle)

Verified: test_ready_physics_single_home.py + test_ready_gate.py 48/48,
docs/adr -k 008 5 passed, make lint-semgrep 192 rules 0 findings, ruff
clean on touched files.

Registered (not fixed here) divergences discovered by unification:
codex trust-dialog frame accepted by has-idle-prompt but rejected by the
gate regex (skip_trust_setup fail-closed hole); claude screen-reader trust
predicate does not match the first-paint frame (generic onboarding pattern
was doing the real dismissal). Both routed to follow-up issues.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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