phronomy 0.30.0 → 0.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46b13a1255f5821e321de0e3817f9fc2335ae2eba81dc7142a01295ffffcdd05
4
- data.tar.gz: c268bfd441361880ce4c6c6a84f03e7e0530b5e1ca8736e87bfba78756a69c89
3
+ metadata.gz: 077db55116aa3b2b1deeeabef69b46b5481c72f1636aa4c623ad8b843d20ef38
4
+ data.tar.gz: 07bbf1214b2aaaf6df1403c69ff8e9f7a7bc4bc8dac63ec4a7a1b11955c0a014
5
5
  SHA512:
6
- metadata.gz: 9f53504e27f5cefedb2370ed495387c17cf98ae850b847497090b17fe1971545a565bfe4533368f47646c5953352aebc4f29801afdb3a2691a54927f60ec1df4
7
- data.tar.gz: 4f9dace274b6a09ad4096569cd8a459dc74df63263c8d4fdc1455d6628e70c93464490a971c638a24aea844d09eb85f9f4ceafa64e9c9e39f5345daa6b83fffb
6
+ metadata.gz: a28ae543ff3826e964cd235580a01175446187546f5f2c94ed34bf12cfd967337df9673654b3029d9173f99479cc32ef966f5bac71db2918cd0265402860e124
7
+ data.tar.gz: ca6dbea79bc432cb1802dbec83cae8b427011b6782f11cfce02fa30ec5b5003439e6b4e6fedd48b6a589ba6b9374075491ae796549dabe41746f20c43f2ee143
data/CHANGELOG.md CHANGED
@@ -12,6 +12,17 @@ Release history for 0.14.0 and earlier is archived in
12
12
 
13
13
  ## [Unreleased]
14
14
 
15
+ ## [0.30.1] - 2026-10-24
16
+
17
+ ### Documentation
18
+
19
+ - Translate historical r8 unit 1/2 architecture notes and durable semantic
20
+ coordination records into English, preserving API names, executable commands,
21
+ requirement IDs, dates and the original validation limits.
22
+ - Repair ADR-029's link to the recovery-contract document and its English heading.
23
+
24
+ Runtime behavior, public APIs and dependency requirements match 0.30.0.
25
+
15
26
  ## [0.30.0] - 2026-10-24
16
27
 
17
28
  ### Added
@@ -1,4 +1,4 @@
1
- # r8第1適用版:Context/ToolとExecutionの共通基盤
1
+ # r8 unit 1: Shared Context, Tool, and Execution foundations
2
2
 
3
3
  > Current boundary: r8 unit 6 supersedes the historical Chat/SDK ownership and
4
4
  > adapter extension SPI below. Agent uses LLMAdapter values; the backend owns SDK
@@ -6,99 +6,99 @@
6
6
  > `docs/architecture/r8-unit6.md` and `docs/migrations/r8-unit6.md`.
7
7
 
8
8
 
9
- 対象は2026-09-30に確認したmain `653e255a34fe4062d4beca47530e084fdd3a6ba9`。設計基準は同日更新のr8修正仕様・directory配置資料である。本変更はその第1適用単位であり、r8全体、S1全項目、S2/S3全受入条件の完了を意味しない。互換alias・転送だけの旧APIは残さない。
9
+ The baseline is main `653e255a34fe4062d4beca47530e084fdd3a6ba9`, checked on 2026-09-30. The design references are the revised r8 specification and directory layout documents updated that day. This change is the first implementation unit; it does not mean that all of r8, every S1 item, or every S2/S3 acceptance condition is complete. Compatibility aliases and old APIs that only forward calls are not retained.
10
10
 
11
- ## 実装した責務と操作
11
+ ## Implemented responsibilities and operations
12
12
 
13
- | 所有者 | 共通基盤が実行すること | 利用側に残すこと |
13
+ | Owner | What the shared foundation does | What remains with the caller |
14
14
  |---|---|---|
15
- | `Context::Assembly` | Policyを一度呼びPlanを検証する。内容を正規化し、最終予算を検査してManifestを保存する | Agentはsnapshotを取得し、保存直前のwatermark再確認とAgent実行記録更新を行う |
16
- | `Tool::DefinitionSet` | Tool定義の正規化、名前重複と保存済み定義の整合性を検証する | Agentは自身のTool alias・decorator・runtime実体を準備する |
17
- | `Tool::Authorization` | 不変の引数・認可contextでfacts→requirement→policy→decisionを評価する | Agentは対象実行の照合、承認状態、受付結果、supervisionを管理する |
18
- | `Tool::ToolExecutor` | cooperative/offloadedの実行規則と結果を扱う | Engineのpool選択はExecutionの機構接続へ委ねる |
19
- | `LLMAdapter::Base` / `RubyLLM` | 同期生成とchat構築・設定・message/tool-call構築。RubyLLM実装がSDK失敗を変換する | Agentは自身の保存データ・Tool定義を検証してadapterへ渡す |
20
- | `Execution` | submitの入口、fan-out/fan-in、結果合成、取消・期限・待機規則 | Engineはpool・timer・RuntimeとFSMの機構を実装する |
21
- | `Tracing::Observation` | 明示的な観測とPII秘匿。実際の返り値は変えない | Runnableはinvoke/stream/batchの実行契約を持つ |
15
+ | `Context::Assembly` | Calls the Policy once and validates the Plan; normalizes content, checks the final budget, and stores the Manifest | Agent obtains the snapshot, rechecks the watermark immediately before persistence, and updates the Agent execution record |
16
+ | `Tool::DefinitionSet` | Normalizes Tool definitions and validates name uniqueness and consistency with persisted definitions | Agent prepares its own Tool aliases, decorators, and runtime instances |
17
+ | `Tool::Authorization` | Evaluates facts -> requirement -> policy -> decision using immutable arguments and authorization context | Agent manages execution matching, approval state, admission results, and supervision |
18
+ | `Tool::ToolExecutor` | Handles cooperative/offloaded execution rules and results | Pool selection in Engine is delegated to the Execution mechanism binding |
19
+ | `LLMAdapter::Base` / `RubyLLM` | Handles synchronous generation and chat construction/configuration, message construction, and tool-call construction; the RubyLLM implementation translates SDK failures | Agent validates its persisted data and Tool definitions before passing them to the adapter |
20
+ | `Execution` | Owns the submit entry point, fan-out/fan-in, result composition, and cancellation/deadline/waiting rules | Engine implements pools, timers, Runtime, and FSM mechanisms |
21
+ | `Tracing::Observation` | Provides explicit observation and PII redaction without changing the actual return value | Runnable owns the invoke/stream/batch execution contract |
22
22
 
23
- ContextとToolはAgentの薄い型定義の置場ではなく、実際の共通手順を所有する。ただし、Contextの現在の入力にはAgent由来の識別情報や由来情報が残る。完全に汎用の新domainモデルまで設計し直したものではない。ToolのDSL基底は引き続きRubyLLM::Toolを使用する。
23
+ Context and Tool own real shared procedures, rather than merely housing thin Agent type definitions. However, current Context inputs still contain Agent-derived identifiers and provenance. This is not a redesign into a fully generic domain model. The Tool DSL base continues to use RubyLLM::Tool.
24
24
 
25
- `Context::Assembly#prepare(input:, policy:, adapter_identity:)` は保存transaction外でPolicyを呼ぶ。`#store(prepared, contents:)` は呼出側が渡す同じtransactionのcontents repositoryだけを使い、自分では独立transactionを開始しない。初回とfollow-upのAgent commitは既存transaction内でManifestとAgentExecutionの参照を保存する。後続書込に失敗したときManifestもrollbackされ、Policyは再実行されない。live projectionをcommit後に適用する既存順序を維持する。これはP02のAgent/Context部分の検証であり、任意domainの外側transaction参加を完成させたものではない。
25
+ `Context::Assembly#prepare(input:, policy:, adapter_identity:)` calls the Policy outside the persistence transaction. `#store(prepared, contents:)` uses only the contents repository supplied by the caller from the same transaction; it does not start an independent transaction. Initial and follow-up Agent commits store the Manifest and the AgentExecution reference within the existing transaction. If a later write fails, the Manifest is rolled back too, and the Policy is not executed again. The existing ordering, which applies the live projection after commit, is preserved. This validates the Agent/Context part of P02; it does not complete participation in outer transactions for arbitrary domains.
26
26
 
27
- Executionは`_ExecutionBackend`の操作に依存する。構成処理が遅延providerを設定し、Engineの`ExecutionBinding`がsubmit/afterを実装する。settled TaskResultの生成・map/flat_map/all_settled・待機制約の確認ではEngineを読み込まない。Runtime取得は実際のsubmit/タイマー登録時に行う。単なる名義移管に留めず、機構参照をここへ集約した。
27
+ Execution depends on the operations of `_ExecutionBackend`. Composition configures a deferred provider, and Engine's `ExecutionBinding` implements submit/after. Creating settled TaskResults, using map/flat_map/all_settled, and checking waiting constraints do not load Engine. Runtime is obtained only when work is actually submitted or a timer is registered. Mechanism references are consolidated here, rather than merely being renamed or nominally reassigned.
28
28
 
29
- WorkflowのFINISHと終了値は`Workflow::Completion`が所有し、WorkflowRunnerがFSM側へ変換する。FSMSession専用のEvent/FSMProtocol/TerminalDecisionはEngineに置く。Agent・MultiAgentのFSM専用接続の全面分離は残っている。
29
+ `Workflow::Completion` owns Workflow FINISH and completion values, and WorkflowRunner translates them into the FSM representation. Event/FSMProtocol/TerminalDecision, which are specific to FSMSession, live in Engine. Full separation of Agent and MultiAgent FSM-specific bindings remains outstanding.
30
30
 
31
- ## 公開名・配置の変更
31
+ ## Public names and layout changes
32
32
 
33
- | 旧配置・API | 新配置・API | 判断 |
33
+ | Previous location/API | New location/API | Rationale |
34
34
  |---|---|---|
35
- | `agent/context_contract/` と `Agent::ContextPolicy` 等 | `context/`、`Context::ContextPolicy` 等 | Policy・Plan・Manifest・検証を共通操作と同じ所有者へ統合 |
36
- | `agent/context_policies/default.rb` | `context/default_policy.rb`、`Context::DefaultPolicy` | 具体Policyも同domainに配置 |
37
- | `Agent::Context::Instruction::PromptTemplate` | `Context::PromptTemplate` | Agent内の旧公開名を削除 |
38
- | `Agent::Selection::{Candidate,Constraint}` | `Context::{Candidate,Constraint}` | 薄いSelection下位区分を削除 |
39
- | `Agent::LLMInputPatch` / `LLMInputBuildContext` | `Context::LLMInputPatch` / `LLMInputBuildContext` | hook入力・返却値の所有を統一 |
40
- | `ContextBudgetExceededError` | `Context::BudgetExceededError` | LLMのprovider失敗ではなくContext予算失敗 |
41
- | `agent/context_assembly/` | `context/assembly.rb` とAgent直下の準備・状態・入力処理 | Context共通手順、Agent snapshot/state、LLM SDK処理を分離 |
42
- | `Agent::Context::Capability::Base` | 実装本体の `Tool::Base` | 旧名とaliasを削除 |
43
- | `agent/tool_execution/tool_definition_set.rb` | `tool/definition_set.rb` | 共通定義処理を移管。Agent固有生成はAgent内 |
44
- | `execution_contract/` と `execution_services/` | `execution/` と必要な `execution/concurrency/` | 操作・値・共通規則を統合。`execution_result`等の薄い別分割を追加しない |
45
- | `WorkerSubmission` | `Execution.submit` | 転送専用moduleを削除 |
46
- | `Runnable#trace` | `Tracing::Observation.trace` | 実行基盤から観測への依存を除去 |
47
- | `tool/contract`、`filter/contract`、`output_parser/contract`、`agent/lifecycle_contract` | 各所有domain配下の例外ファイル | 例外だけのdirectoryを削除。既存の意味を持つ例外定数名は実体として保持 |
48
-
49
- 独自LLM adapterはcomplete/streamだけでなく、`build_chat`、`configure_chat`、`message`、`tool_call`を実装する。`identity`には基底の既定値、`input_budget`にはnilの既定値がある。正確なkeywordと返却契約は`sig/phronomy/llm_adapter/base.rbs`を参照する。SDK固有例外はadapter操作の境界でLLM失敗へ変換し、元のcauseを保持する。アプリ例外・取消は無関係なprovider失敗へ変換しない。
50
-
51
- 既存設定APIの`tool_result_max_size`/loggerはアプリ構成から中立RuntimeSettingsへ供給する。Toolから構成factoryへの参照を除き、default・nil・scoped copyの意味を維持する。RBSは`sig/`と`sig/_private/`に置き、実装定数・宣言所有者に基づいて依存を解析する。
52
-
53
- ## r8項目別の到達点
54
-
55
- | 項目 | この適用版 | 未完了部分 |
35
+ | `agent/context_contract/` and APIs such as `Agent::ContextPolicy` | `context/` and APIs such as `Context::ContextPolicy` | Consolidate Policy, Plan, Manifest, and validation under the owner of the shared operations |
36
+ | `agent/context_policies/default.rb` | `context/default_policy.rb`, `Context::DefaultPolicy` | Keep the concrete Policy in the same domain |
37
+ | `Agent::Context::Instruction::PromptTemplate` | `Context::PromptTemplate` | Remove the old public name under Agent |
38
+ | `Agent::Selection::{Candidate,Constraint}` | `Context::{Candidate,Constraint}` | Remove the thin Selection subdivision |
39
+ | `Agent::LLMInputPatch` / `LLMInputBuildContext` | `Context::LLMInputPatch` / `LLMInputBuildContext` | Unify ownership of hook inputs and return values |
40
+ | `ContextBudgetExceededError` | `Context::BudgetExceededError` | Represent a Context budget failure, not an LLM provider failure |
41
+ | `agent/context_assembly/` | `context/assembly.rb` plus preparation, state, and input handling directly under Agent | Separate shared Context procedures, Agent snapshot/state handling, and LLM SDK handling |
42
+ | `Agent::Context::Capability::Base` | The actual implementation, `Tool::Base` | Remove the old name and alias |
43
+ | `agent/tool_execution/tool_definition_set.rb` | `tool/definition_set.rb` | Transfer shared definition handling; keep Agent-specific construction in Agent |
44
+ | `execution_contract/` and `execution_services/` | `execution/` and the necessary `execution/concurrency/` | Consolidate operations, values, and shared rules; do not add thin subdivisions such as `execution_result` |
45
+ | `WorkerSubmission` | `Execution.submit` | Remove the forwarding-only module |
46
+ | `Runnable#trace` | `Tracing::Observation.trace` | Remove the execution foundation's dependency on observation |
47
+ | `tool/contract`, `filter/contract`, `output_parser/contract`, `agent/lifecycle_contract` | Exception files under their owning domains | Remove exception-only directories; retain existing meaningful exception constant names as actual definitions |
48
+
49
+ Custom LLM adapters implement `build_chat`, `configure_chat`, `message`, and `tool_call` in addition to complete/stream. The base class supplies a default `identity` and a nil default for `input_budget`. See `sig/phronomy/llm_adapter/base.rbs` for exact keywords and return contracts. Translate SDK-specific exceptions into LLM failures at adapter operation boundaries, preserving the original cause. Do not translate application exceptions or cancellation into unrelated provider failures.
50
+
51
+ The existing `tool_result_max_size` configuration API and logger are supplied by application composition to neutral RuntimeSettings. Remove references from Tool to the composition factory while preserving default, nil, and scoped-copy semantics. Place RBS in `sig/` and `sig/_private/`, and analyze dependencies based on implementation constants and declaration ownership.
52
+
53
+ ## Progress by r8 item
54
+
55
+ | Item | This implementation unit | Outstanding work |
56
56
  |---|---|---|
57
- | DP01 Context集約 | 主対象を実装 | より広いdomain入力・公開操作レビューは残る |
58
- | DP02 Tool共通基盤 | 定義・認可評価・呼出しの共通部分を実装 | Agent側FSM接続と全親子認可の整理はDP12/P04 |
59
- | DP03 Execution統合 | 実装 | domain全体のFSM利用整理を完了としない |
60
- | DP04 Persistence | 未着手 | facade除去、共通transaction/参加/成否照合API |
61
- | DP05 domain保存schema | 未着手 | MultiAgent/Workflowのstorage_contract統合 |
62
- | DP06 LLM集約 | 前提部分のみ | llm_contractとllm_adapterの全面統合 |
63
- | DP07 薄い失敗directory統合 | 実装 | domainごとの失敗語彙全体の再設計ではない |
64
- | DP08 composition集約 | 接続追加のみ | runtime/persistence/agent構成の物理統合 |
65
- | DP09 Embeddings独立 | 未着手 | vector_storeからの独立配置 |
66
- | DP10 Documents | 未着手 | loader/splitter再配置 |
67
- | DP11 assembly/concerns分解 | 主対象を実装 | Agent固有処理はAgent直下に保持 |
68
- | DP12 domain実行接続 | Workflow終了境界など一部 | Agent/ToolInvocation/Teamのdomain判断とFSM接続の全面分離 |
69
- | DP13 Recovery/Handoff | 未着手 | domain復旧・Persistence成否照合・親子操作の所有整理 |
70
- | P02保存参加 | Agent/Contextの既存transactionで検証 | 外側scope、savepoint、複数domainの公開参加API |
71
- | P01/P03〜P06保存・親子連携 | 未着手 | 下記の原子性条件を確定する必要がある |
72
- | 155組・393件の三角形レビュー | 再判定未完了 | 図の再解析は判定完了の代わりにはならない |
57
+ | DP01 Context consolidation | Main scope implemented | Broader domain inputs and public operations still require review |
58
+ | DP02 Shared Tool foundation | Shared definition, authorization evaluation, and invocation implemented | Agent FSM bindings and all parent/child authorization rules remain under DP12/P04 |
59
+ | DP03 Execution consolidation | Implemented | This does not complete the review of FSM use across all domains |
60
+ | DP04 Persistence | Not started | Facade removal and shared transaction/participation/outcome-reconciliation APIs |
61
+ | DP05 Domain persistence schemas | Not started | Consolidation of MultiAgent/Workflow storage_contract |
62
+ | DP06 LLM consolidation | Prerequisites only | Full consolidation of llm_contract and llm_adapter |
63
+ | DP07 Consolidation of thin failure directories | Implemented | This is not a redesign of every domain's failure vocabulary |
64
+ | DP08 Composition consolidation | Bindings added only | Physical consolidation of runtime/persistence/agent composition |
65
+ | DP09 Independent Embeddings domain | Not started | Placement independent of vector_store |
66
+ | DP10 Documents | Not started | Loader/splitter relocation |
67
+ | DP11 Decomposition of assembly/concerns | Main scope implemented | Agent-specific processing remains directly under Agent |
68
+ | DP12 Domain execution bindings | Partial, including the Workflow completion boundary | Full separation of Agent/ToolInvocation/Team domain decisions from FSM bindings |
69
+ | DP13 Recovery/Handoff | Not started | Ownership of domain recovery, Persistence outcome reconciliation, and parent/child operations |
70
+ | P02 Persistence participation | Validated in the existing Agent/Context transaction | Outer scopes, savepoints, and public participation APIs across multiple domains |
71
+ | P01/P03-P06 Persistence and parent/child coordination | Not started | The atomicity conditions below must be established |
72
+ | Triangle review: 155 pairs, 393 cases | Reassessment incomplete | Regenerating the diagrams does not substitute for completing the assessment |
73
73
 
74
- NC/F/RMの全項目を「対応済み」とする資料は作成していない。受入可否はこの表の実装単位と同梱テスト証拠に限定する。
74
+ No document claims that every NC/F/RM item has been addressed. Acceptance claims are limited to the implementation units in this table and the accompanying test evidence.
75
75
 
76
- ## Persistenceをこの適用単位から外した理由
76
+ ## Why Persistence is outside this implementation unit
77
77
 
78
- 現在のAgent初回受付は保存transaction内でTeam予約を読む。AgentからTeam内部への参照は最終設計では解消すべきだが、検証を単純に先行呼出へ移すと次の競合が生じる。
78
+ Initial Agent admission currently reads the Team reservation inside the persistence transaction. The final design should eliminate Agent's reference to Team internals, but simply moving validation to an earlier call creates this race:
79
79
 
80
- 1. 親側が予約の有効性を確認する。
81
- 2. 別の処理が予約を取り消す。
82
- 3. Agentが新しいtransactionで受付記録を保存し、取消済みの子を開始してしまう。
80
+ 1. The parent checks that the reservation is valid.
81
+ 2. Another operation cancels the reservation.
82
+ 3. Agent saves its admission record in a new transaction and starts the cancelled child.
83
83
 
84
- 次の適用単位では、親が所有する予約確認とAgent受付記録を同一scopeで行う参加APIが必要である。親は予約規則、Agentは受付規則、Persistenceは参加とcommit境界を所有する。Agentが親kindをswitchしてTeamを選ぶ現在の逆依存を、新しいcallbackの裏へ隠すだけでは解決にならない。
84
+ The next implementation unit needs a participation API that performs the parent-owned reservation check and records Agent admission within the same scope. The parent owns reservation rules, Agent owns admission rules, and Persistence owns participation and commit boundaries. Merely hiding the current reverse dependency, where Agent switches on parent kind to select Team, behind a new callback would not resolve it.
85
85
 
86
- 具体的に未確定なのは、参加操作の公開keyword/返却値、取消との競合条件、commit後のRuntime admission、停止後の同じ子IDによる照会・再開である。Workflowのhalt/finish snapshotだけで任意action内の子実行が耐障害化されるとは扱わない。Workflow→Agent/Teamの具体経路、checkpoint、結果取込一回性をP05で定める。成否不明は単一record一致だけで成功にせず、複数domainの証拠をP06で定める。
86
+ The unresolved details are public participation keywords/return values, races with cancellation, post-commit Runtime admission, and querying/resuming with the same child ID after interruption. Workflow halt/finish snapshots alone do not make child execution inside arbitrary actions durable. P05 must define the concrete Workflow-to-Agent/Team paths, checkpoints, and one-time result incorporation. Unknown outcomes must not be treated as success based on a single matching record; P06 must define evidence across multiple domains.
87
87
 
88
- そのため既存Persistence facade、Team受付検証、予約・子記録のtransaction境界を本変更では改変しない。保証を弱めた仮実装を入れず、次の仕様・実装単位として残す。
88
+ Therefore this change does not alter the existing Persistence facade, Team admission validation, or transaction boundaries for reservations and child records. These remain for the next specification and implementation unit, rather than introducing provisional code with weaker guarantees.
89
89
 
90
- ## 解析図の読み方
90
+ ## Reading the analysis diagrams
91
91
 
92
- 実ソースとRBSから再生成する。従来の水平帯・グループ色・個別module枠を維持し、文字の背景は透過。M33/M41/M44への矢印は表示のみ省略し、JSON・行列・境界判定にはすべて残す。旧IDは再利用せず退役させる。
92
+ Regenerate the diagrams from actual source and RBS. Preserve the existing horizontal bands, group colors, individual module boxes, and transparent text backgrounds. Arrows to M33/M41/M44 are omitted only from the display; retain them in JSON, matrices, and boundary assessments. Retire old IDs instead of reusing them.
93
93
 
94
- これは修正版candidateの実測図であり、全r8完了時の構想図ではない。残る循環・逆依存もそのまま出力する。静的解析で見えない注入先・動的dispatchはRBSだけで完全に証明できない。Engine機構接続とdomain保存の実行テストを併用する。
94
+ These are measured diagrams of the revised candidate, not conceptual diagrams of a completed r8. Include remaining cycles and reverse dependencies. RBS alone cannot fully prove injected targets or dynamic dispatch that static analysis cannot observe. Combine it with execution tests for Engine mechanism bindings and domain persistence.
95
95
 
96
96
  ```bash
97
97
  bundle exec rbs -I sig validate
98
98
  python -m pip install -r tools/architecture/tools/requirements.txt
99
99
  python -m unittest discover -s tools/architecture/tests -v
100
- # lib/sigをcommitした後、未公開candidateでは次の指定を用いる
100
+ # After committing lib/sig, use this option for an unpublished candidate.
101
101
  python tools/architecture/refresh_diagram.py . tmp/architecture-r8-unit1 --candidate
102
102
  ```
103
103
 
104
- 同梱SVGのSHAは作成用のローカルcandidateを示す。利用者が適用してcommitしたSHAとは異なるため、適用後の図はそのcheckoutで再生成する。Rubyの検証環境、件数、skip理由、未検証環境と適用手順は配布パッケージの検証報告を参照する。
104
+ The SHA in the supplied SVG identifies the local candidate used to generate it. It differs from the SHA created when the user applies and commits the changes, so regenerate the post-application diagrams from that checkout. See the distribution package's verification report for the Ruby environment, test counts, skip reasons, unverified environments, and application procedure.
@@ -1,55 +1,55 @@
1
- # r8 unit 2:親の予約確認とAgent受付
1
+ # r8 unit 2: Parent reservation checks and Agent admission
2
2
 
3
- この単位はP02/P03の受付境界を実装する。基準はcore `16e6fcb2dd49836735598525114abfc256d0773e`。r8全体やPersistenceの全面整理の完了ではない。
3
+ This unit implements the P02/P03 admission boundary. The core baseline is `16e6fcb2dd49836735598525114abfc256d0773e`. It does not complete all of r8 or the entire Persistence reorganization.
4
4
 
5
- ## 責務と操作
5
+ ## Responsibilities and operations
6
6
 
7
- | 担当 | 公開操作・共通規則 | 依存と内部実装 |
7
+ | Owner | Public operations and shared rules | Dependencies and internal implementation |
8
8
  |---|---|---|
9
- | 共通Persistence | `atomic`、`Transaction#participate`、`committed?`。同じPersistence、同期thread、有効scope、savepoint、commit応答を検証 | Storageの公開transaction・scope規則を利用。Agent/Team/Workflowや構成担当を選ばない |
10
- | Agent | `Admission#accept_in`。入力記録・実行ID・Agentの受付とrevision更新を同一scopeへ保存 | Agentの保存担当を使用。親のkind・Team割当・subagent snapshot・Handoff予約を解釈しない |
11
- | MultiAgent | `ReservedChildAdmission#admit`。親の取消・slot・子IDを検証し、Agent受付を同じscopeへ参加させる | 自分の保存担当が予約の根拠を読み、必要なguardを取得する |
12
- | 保存担当 | `Agent::Persistence::Admission`、`MultiAgent::Persistence::Reservation` | raw Storage viewはこの境界で使用。ドメイン操作へraw viewを渡さない |
9
+ | Shared Persistence | `atomic`, `Transaction#participate`, and `committed?`; validates the same Persistence instance, synchronous thread, active scope, savepoints, and commit acknowledgements | Uses Storage's public transaction/scope rules; does not select Agent, Team, Workflow, or composition components |
10
+ | Agent | `Admission#accept_in`; persists input records, execution identity, Agent admission, and revision updates in the same scope | Uses Agent's persistence component; does not interpret parent kind, Team assignments, subagent snapshots, or Handoff reservations |
11
+ | MultiAgent | `ReservedChildAdmission#admit`; validates parent cancellation, slot, and child ID, and has Agent admission participate in the same scope | Its own persistence component reads the reservation evidence and acquires the required guards |
12
+ | Persistence components | `Agent::Persistence::Admission`, `MultiAgent::Persistence::Reservation` | Uses raw Storage views at this boundary; does not pass raw views to domain operations |
13
13
 
14
- AgentのRuntime admission取得、FSM開始、live状態の反映は既存のExecutionCoordinatorが引き続き所有する。新しいAdmissionはその短い保存フェーズだけであり、Agent実行全体を親のDB transactionへ入れない。通常のアプリは新しい参加クラスを実装・生成する必要がない。
14
+ The existing ExecutionCoordinator continues to own acquiring Agent Runtime admission, starting the FSM, and applying live state. The new Admission covers only the short persistence phase; it does not place the entire Agent execution inside the parent's database transaction. Ordinary applications do not need to implement or instantiate the new participation classes.
15
15
 
16
- `phronomy_admission` は内部の現在の配線であり、Procやオブジェクトを保存しない。永続化するのは従来の相関情報と親子IDだけ。Team/subagent/Handoffの開始・再開担当が現在の参加者を渡す。保存済み実行への再接続はExactExecutionの同一ID照合と復旧規則を維持する。
16
+ `phronomy_admission` is current internal wiring; no Proc or object is persisted. Only the existing correlation information and parent/child IDs are stored. The Team/subagent/Handoff start and resume components supply the current participant. Reconnecting to a persisted execution preserves ExactExecution's same-ID matching and recovery rules.
17
17
 
18
- ## 保存順序と失敗
18
+ ## Persistence ordering and failures
19
19
 
20
- 1. Agentが既存のRuntime受付を取得し、同期workerで保存操作を開始する。
21
- 2. MultiAgentが短い`atomic` scopeを開き、親のguardを取得してから予約を読み直す。
22
- 3. 親の取消・割当・子の識別子を検証する。Agentは同じscopeで入力内容・AgentExecution・AgentRootを保存する。
23
- 4. commit応答が成功した後に、Agent実行担当だけが受付結果を取得し、準備・FSM・live反映を進める。
20
+ 1. Agent acquires the existing Runtime admission and begins the persistence operation on a synchronous worker.
21
+ 2. MultiAgent opens a short `atomic` scope, acquires the parent guard, and then rereads the reservation.
22
+ 3. It validates parent cancellation, assignment, and child identity. Agent stores the input content, AgentExecution, and AgentRoot in the same scope.
23
+ 4. Only after a successful commit acknowledgement does the Agent execution component obtain the admission result and continue preparation, FSM execution, and live-state updates.
24
24
 
25
- 参加操作の戻り値はcommit成功を意味しない。`accept_in`はnilを返し、Agent内部の`result`は外側のcommitまで利用できない。二重参加、別Persistence、別thread、終了後scopeは拒否する。同じbackendを包む別Persistenceも同一scopeと扱わない。raw backend transactionの中から新しくcommit所有者を名乗ることも拒否する。
25
+ A participation operation's return value does not mean that commit succeeded. `accept_in` returns nil, and the Agent-internal `result` is unavailable until the outer commit. Duplicate participation, a different Persistence instance, a different thread, or an expired scope is rejected. Separate Persistence instances wrapping the same backend are not treated as the same scope. Code inside a raw backend transaction cannot claim to be a new commit owner.
26
26
 
27
- 明示的な入れ子はsavepointとして動く。内側が成功しても外側がrollbackした場合は未成立。参加処理中の例外を内側で捕捉しても、失敗したscopeの先行変更をcommitできない。LLM、Tool、scheduler、外部callback、非同期待機を参加処理へ入れない。
27
+ Explicit nesting uses savepoints. Inner success is not committed if the outer transaction rolls back. Even if an exception during participation is caught inside the scope, earlier changes in that failed scope cannot be committed. Do not perform LLM calls, Tool calls, scheduling, external callbacks, or asynchronous waits inside participation operations.
28
28
 
29
- Storageのscope違反は`Persistence::TransactionError`へcause・backtraceを保持して変換する。この名前の変更は、保存成否が既知であるとの宣言ではない。IOError等の成否不明な保存失敗は変換・自動retryせず、既存のAgent復旧規則へ渡す。今回、一般化した保存成否照合APIは追加していない。
29
+ Storage scope violations are translated into `Persistence::TransactionError`, preserving cause and backtrace. This naming change does not assert that the persistence outcome is known. Persistence failures with unknown outcomes, such as IOError, are neither translated nor automatically retried; they pass to existing Agent recovery rules. This unit does not add a generalized persistence-outcome reconciliation API.
30
30
 
31
- ## 取消との競合
31
+ ## Races with cancellation
32
32
 
33
- TeamはTeamRoot、subagentは親AgentRoot、Handoffはrouting recordをguardとする。PostgreSQLではそのguardの行ロックと既存の条件付き更新によって、取消・変更と子受付を順序付ける。子受付側の通常readだけでは、この保証は成立しなかった。
33
+ Team uses TeamRoot as its guard, subagents use the parent AgentRoot, and Handoff uses the routing record. On PostgreSQL, row locks on the guard and existing conditional updates order cancellation/changes against child admission. Ordinary reads on the child admission path alone did not provide this guarantee.
34
34
 
35
- Handoff取消側は最初に子の状態を観測し、未完了/不在ならroutingをロックして**子の状態を再取得**する。待機中に子受付がcommitした場合、古い「不在」の判断を捨て、受付済みの子へ公開取消を送る。既に終端の実行への取消は従来どおり結果参照として扱う。
35
+ The Handoff cancellation path first observes the child state. If the child is incomplete or absent, it locks routing and **reads the child state again**. If child admission committed while it was waiting, it discards the stale absence observation and sends public cancellation to the admitted child. Cancellation of an already terminal execution continues to act as result access.
36
36
 
37
- InMemoryは共有Monitor、SQLiteはtransactionと書込競合検出、PostgreSQLは行ロックを使用する。SQLiteで競合したtransactionは成功とみなさず、backendの失敗を扱う。分散leaseや外部副作用のexactly-onceは追加しない。実PostgreSQLでの待機順序はexamplesの新しい3件の並行テストで確認する対象であり、InMemory/SQLiteの成功から推定して済ませない。
37
+ InMemory uses a shared Monitor, SQLite uses transactions and write-conflict detection, and PostgreSQL uses row locks. A conflicting SQLite transaction is not considered successful; its backend failure is handled. No distributed lease or exactly-once guarantee for external effects is added. Actual PostgreSQL waiting order is to be checked by the three new concurrency tests in examples; it must not be inferred from successful InMemory/SQLite tests.
38
38
 
39
- ## API・ファイル変更
39
+ ## API and file changes
40
40
 
41
- - Agent::InitialPreparationの`build_admitted_execution`と3種の親検証・kind分岐を削除。Agent自身の受付共通処理とMultiAgentの予約判断へ分離した。
42
- - 共通の参加frameworkを`persistence/transaction.rb`、Agent受付を`agent/admission.rb`、保存接続を既存の各domainの`persistence/`へ置いた。新しいディレクトリや独立Contractは増やしていない。
43
- - Storage SPIに同期contextの`transaction_open?`を追加。Storage::Backendの継承実装には共通実装が提供される。継承しない独自SPI実装はこの操作も提供する必要がある。RBS・SPI snapshot・duck-typed backendの検証を更新した。
44
- - Persistenceの既知scope失敗の公開型を`Persistence::TransactionError`へ統一し、旧Storage例外のaliasは設けない。Storageを直接使う処理では従来のStorage例外を使用する。
45
- - RBSはsigに配置し、参加者factory、Agent受付、MultiAgentの依存を宣言する。動的な`phronomy_admission`注入も本書と利用箇所で追跡する。
46
- - 依存解析のExecution境界規則を図のrevision表示名から分離した。unit名の更新で同期backendからExecutionへの禁止規則が解除されないことを回帰テストする。
47
- - 保存recordの形式、ID、revision規則は変更していない。データ移行は不要。
41
+ - Remove Agent::InitialPreparation's `build_admitted_execution`, its three kinds of parent validation, and its parent-kind branches. Separate shared Agent admission handling from MultiAgent reservation decisions.
42
+ - Place the shared participation framework in `persistence/transaction.rb`, Agent admission in `agent/admission.rb`, and persistence bindings in each domain's existing `persistence/`. No new directory or independent Contract is added.
43
+ - Add synchronous-context `transaction_open?` to the Storage SPI. Implementations inheriting Storage::Backend receive a shared implementation. Custom SPI implementations that do not inherit it must also provide this operation. Update RBS, the SPI snapshot, and duck-typed backend validation.
44
+ - Unify the public type for known Persistence scope failures as `Persistence::TransactionError`; do not add an alias for the old Storage exception. Code using Storage directly continues to use the existing Storage exception.
45
+ - Place RBS in sig and declare participant factories, Agent admission, and MultiAgent dependencies. Track dynamic `phronomy_admission` injection in this document and at its use sites.
46
+ - Separate dependency analysis rules for the Execution boundary from the diagram's revision display name. Add a regression test ensuring that changing the unit name does not disable the prohibition on synchronous-backend dependencies on Execution.
47
+ - Preserve persisted record formats, IDs, and revision rules. No data migration is required.
48
48
 
49
- ## 残る課題
49
+ ## Outstanding work
50
50
 
51
- `Persistence#transaction`とdomain repositoryの一括窓口は現行利用箇所が残るため、この単位では全面削除していない。互換維持のために新しい旧名aliasを追加したものではないが、P01/DP04の完了条件は未達である。次にdomain照会・保存構成を移し、不要な窓口を利用側と同時に削除する。
51
+ `Persistence#transaction` and the combined domain-repository facade still have callers and are not fully removed in this unit. This does not add new aliases for old names to preserve compatibility, but the P01/DP04 completion conditions remain unmet. Next, move domain queries and persistence composition, then remove unnecessary entry points together with their callers.
52
52
 
53
- MultiAgentの保存担当にはAgentのexecution/Handoff repositoryへの参照が残る。予約検証の所有者は整理したが、親子の公開投影・認可照会・結果取込まで隠蔽したとは扱わない。P04/F02/F03の残課題として、Agentが公開する操作と、MultiAgentが所有すべき保存形式を確定する。一般的なmetadata getterを足すだけの解決にはしない。
53
+ MultiAgent's persistence component still references Agent execution/Handoff repositories. Ownership of reservation validation has been clarified, but this does not mean that public parent/child projections, authorization queries, and result incorporation have all been encapsulated. Under the remaining P04/F02/F03 work, establish the operations Agent should expose and the persistence formats MultiAgent should own. Adding a generic metadata getter alone is not a solution.
54
54
 
55
- Agent/TeamのFSM接続、Workflowのdurableな子連携(P05)、複数記録の保存成否照合(P06)、残りの配置整理、155組・393件の意味的再判定も残る。今回のSVGは実装候補を描き、全体の循環解消を示す構想図にはしない。
55
+ Agent/Team FSM bindings, durable Workflow child coordination (P05), reconciliation of persistence outcomes across multiple records (P06), the remaining layout reorganization, and semantic reassessment of 155 pairs/393 cases also remain outstanding. The SVG for this unit depicts the implementation candidate, not a conceptual graph claiming that all cycles have been eliminated.
@@ -153,7 +153,7 @@ request deduplication or unambiguous correlation. Existing retention applies.
153
153
 
154
154
  Reuse existing APIs where they meet this contract; map missing capabilities only
155
155
  after baseline inspection. Do not invent a framework outbox or request registry.
156
- See [RC-01](RECOVERY_CONTRACT_CLARIFICATIONS.md#1-rc-01--確定結果の参照と実行の発見).
156
+ See [RC-01](../design/durable-semantic-coordination/RECOVERY_CONTRACT_CLARIFICATIONS.md#1-rc-01-accessing-final-results-and-discovering-executions).
157
157
 
158
158
  ### 9. Unknown commit outcome and cancellation
159
159
 
@@ -1,33 +1,33 @@
1
- # V2 revision 2 — 改訂内容
1
+ # V2 revision 2 - Changes
2
2
 
3
- 更新日: 2026-09-06 / 状態: Accepted
3
+ Updated: 2026-09-06 / Status: Accepted
4
4
 
5
- ## 合意反映
5
+ ## Accepted decisions reflected in this revision
6
6
 
7
- | 項目 | 今回の修正 |
7
+ | Item | Change in this revision |
8
8
  |---|---|
9
- | RC-01 結果参照 | exact実行IDで状態・結果を読み取る契約と、ID受領前の停止に備えたownerからの候補発見を追加 |
10
- | RC-02 保存成否不明 | 正常な不存在、read障害、CAS競合、commit成否不明を区別。同じ予約済みidentityで照合 |
11
- | RC-03 wiring互換性 | 定義id/version・slot・graph・Persistence境界の最低照合と、確定済みfactの優先を明記 |
12
- | RC-04 cancellation | 観測終了/shutdownとsemantic cancelを区別。子の状態別処理、競合、restart後の再発見を明記 |
13
- | RC-05 保証表現 | 確定outcome再利用・同一identity復旧・外部成否不明は既存Recovery、に統一 |
9
+ | RC-01 Result access | Add contracts for reading status/results by exact execution ID and discovering candidates from the owner if execution is interrupted before the caller receives the ID |
10
+ | RC-02 Unknown persistence outcomes | Distinguish confirmed absence, read failure, CAS conflict, and unknown commit outcome; reconcile using the same reserved identity |
11
+ | RC-03 Wiring compatibility | Specify minimum checks for definition id/version, slot, graph, and Persistence boundary, and give precedence to committed facts |
12
+ | RC-04 Cancellation | Distinguish ending observation/shutdown from semantic cancellation; specify handling by child state, races, and rediscovery after restart |
13
+ | RC-05 Guarantee wording | Use consistent wording: reuse committed outcomes, recover with the same identity, and resolve uncertain external outcomes through existing Recovery |
14
14
 
15
- ADR-029/030/031、実装設計、責務境界レビュー、READMEへ対応する規範的記述を反映した。
16
- 詳細契約と検証条件はRECOVERY_CONTRACT_CLARIFICATIONS.mdにまとめ、資料間で参照する。
17
- 承認前のProposed表記をAcceptedへ更新した。新機能の再承認を要求しない。
15
+ The corresponding normative statements have been incorporated into ADR-029/030/031, the implementation design, the responsibility boundary review, and the README.
16
+ Detailed contracts and validation conditions are collected in RECOVERY_CONTRACT_CLARIFICATIONS.md and referenced across the documents.
17
+ The pre-approval Proposed status has been changed to Accepted. This does not request renewed approval of the new functionality.
18
18
 
19
- ## 実装状態の訂正
19
+ ## Correction of implementation status
20
20
 
21
- 引き継ぎ文書の旧実装件数・静的検証成功は、前セッションの報告として残す。
22
- この分岐先で実装を再検証した事実にはしない。現在取得できたのは設計資料と引き継ぎ文書であり、
23
- 旧overlay/apply.py/APPLY.sh/VERIFY.shは未取得。再開手順も実ファイルの回収から始める形に更新した。
21
+ Earlier implementation counts and successful static checks in the handoff document remain reports from the previous session.
22
+ They are not evidence that implementation was revalidated in this continuation. Only the design documents and handoff document are currently available;
23
+ the old overlay/apply.py/APPLY.sh/VERIFY.sh have not been recovered. The resumption procedure has also been updated to begin by recovering the actual files.
24
24
 
25
- ## 今回実施した確認
25
+ ## Checks performed for this revision
26
26
 
27
- - 対象資料の承認状態、baseline、相互参照の整合確認。
28
- - 旧い「未承認のため実装停止」表現と、外部効果のexactly-onceに読める保証表現の修正。
29
- - RC-01〜05のADR・実装設計・検証条件への対応確認。
30
- - ZIP構成、全文書のSHA256SUMS、ZIP/引き継ぎ文書の外部SHA256の検証。
27
+ - Check consistency of approval status, baseline, and cross-references in the affected documents.
28
+ - Correct obsolete statements that implementation was stopped pending approval and guarantee wording that could imply exactly-once external effects.
29
+ - Check the mapping of RC-01 through RC-05 to ADRs, implementation design, and validation conditions.
30
+ - Verify the ZIP layout, SHA256SUMS for all documents, and external SHA256 values for the ZIP and handoff document.
31
31
 
32
- 対象repositoryのコード変更・RSpec実行は行っていない。
33
- API名や例外名は未確認のものを作らず、baselineへの対応付けを実装前の必須作業とした。
32
+ No code changes or RSpec runs were performed in the target repository.
33
+ Unverified API or exception names were not invented; mapping the requirements to the baseline was made mandatory before implementation.
@@ -6,107 +6,107 @@
6
6
  > [ADR-034](../../decisions/034-handoff-runner-coordination-ownership.md).
7
7
  > Handoff and HandoffPolicy remain in Agent at this stage.
8
8
 
9
- 作成日: 2026-09-07。設計承認日: 2026-09-06。
10
- 対象baseline: `5472116cd99a63ec27875024c955ea82be612d6b`。
11
- 承認済みADR-029/030/031とRC-01〜05に対する新規実装です。
12
- 旧Complete Durability overlay、既存の作業ZIP、synthetic fan-out executionは使用しません。
9
+ Created: 2026-09-07. Design approved: 2026-09-06.
10
+ Baseline: `5472116cd99a63ec27875024c955ea82be612d6b`.
11
+ This is a new implementation of the approved ADR-029/030/031 and RC-01 through RC-05.
12
+ It does not use the old Complete Durability overlay, existing work ZIPs, or synthetic fan-out executions.
13
13
 
14
- ## 実装範囲
14
+ ## Implementation scope
15
15
 
16
- | 対象 | 実装した動作 |
16
+ | Area | Implemented behavior |
17
17
  |---|---|
18
- | Persistence | root/transaction viewともに8 repository。新しい3 recordはcurrent format `0.1`。Backendはopaque DurableRecordと明示的なidentity/revision/index metadataを扱う |
19
- | Handoff | Agent-domain APIへ移設。Source terminal・Context・exact Target予約・責務移転を同じtransactionで保存。Target terminalとrouting安定化も同一transaction |
20
- | Orchestrator | 既存parent AgentExecutionのstatic subagent Toolにchild ID/input/knowledge/config/outcomeを保存。直接の`dispatch_parallel`/`fan_out`にはsynthetic parentを作らない |
21
- | Team | TeamRoot/TeamExecution、task、worker slot、exact assignment/outcomeをCASで保存。coordinator/workerは既存Agent engineを使用。スケジューリングは既存の逐次方式 |
22
- | Team内部操作 | 保存済みのauthorized Tool batchをProvider順に適用。各`tool_invocation_id`の結果を保持し、`enqueue_task`/`finalize`を自動照合 |
23
- | Aggregate | pure/replay-safeな計算。canonical JSON結果またはエラーをterminal commit。保存前のクラッシュでは再計算可能、保存済みterminalでは再計算しない |
24
- | Runtime | Teamのprocess-local所有・admission・drainを追加。新しいTeam FSM/Workflow engineは追加しない |
25
- | Recovery | framework-owned操作はexact factから再開。外部Toolと混在したbatchでは外部の事実だけを既存Recovery APIで解決する |
26
- | 終了・削除 | exact子のcancel/reconciliation情報を保持。idle main Agentの`purge!`はHandoff anchorも同時削除。未完了turnのanchor削除は拒否 |
27
-
28
- Handoff graphは同じPersistence **instance**を使います。元main Agent IDがrouting anchorです。
29
- 保存済みContextを新しいpolicyで再投影せず、保存済みworker割当を現在のschedulerで選び直しません。
30
- RuntimeのClass/Proc、listener、Task、CancellationTokenは永続化しません。
31
-
32
- ## 公開経路
33
-
34
- | 目的 | API / 返却値 |
18
+ | Persistence | Eight repositories in both root and transaction views; the three new records use current format `0.1`. Backend handles opaque DurableRecords and explicit identity/revision/index metadata |
19
+ | Handoff | Moved to the Agent-domain API. Source terminal state, Context, exact Target reservation, and responsibility transfer are persisted in one transaction. Target terminal state and routing stabilization also share one transaction |
20
+ | Orchestrator | Stores child ID/input/knowledge/config/outcome for static subagent Tools in the existing parent AgentExecution. Direct `dispatch_parallel`/`fan_out` calls do not create synthetic parents |
21
+ | Team | Persists TeamRoot/TeamExecution, tasks, worker slots, and exact assignments/outcomes using CAS. Coordinators/workers use the existing Agent engine. Scheduling retains the existing sequential approach |
22
+ | Internal Team operations | Applies persisted authorized Tool batches in Provider order. Retains the result of each `tool_invocation_id` and automatically reconciles `enqueue_task`/`finalize` |
23
+ | Aggregate | Pure/replay-safe computation. Commits canonical JSON results or errors as terminal outcomes. Recalculation is possible after a crash before persistence, but not for a persisted terminal outcome |
24
+ | Runtime | Adds process-local Team ownership, admission, and draining. Does not add a new Team FSM/Workflow engine |
25
+ | Recovery | Resumes framework-owned operations from exact facts. In batches mixed with external Tools, only external facts are resolved through the existing Recovery API |
26
+ | Termination and deletion | Retains cancellation/reconciliation information for exact children. `purge!` on an idle main Agent also deletes the Handoff anchor; deleting an anchor for an incomplete turn is rejected |
27
+
28
+ A Handoff graph uses the same Persistence **instance**. The original main Agent ID is the routing anchor.
29
+ Persisted Context is not reprojected using a new policy, and persisted worker assignments are not reselected using the current scheduler.
30
+ Runtime Classes/Procs, listeners, Tasks, and CancellationTokens are not persisted.
31
+
32
+ ## Public entry points
33
+
34
+ | Purpose | API / return value |
35
35
  |---|---|
36
- | Agent結果参照 | `store.execution_result(execution_id)`。owner、status、phase、result/errorと参照IDの凍結Hash |
37
- | Handoff結果参照 | `store.handoff_result(source_execution_id)`。そのturnのexact Targetまで辿る。graph/Agent hydration不要 |
38
- | Agent実行発見 | `store.list_executions(agent_id, after: nil, limit: 100)`。immutable execution records。active/terminal双方 |
39
- | Team結果参照 | `store.team_execution_result(run_id)` または `team.result(run_id)` |
40
- | Team実行発見 | `store.list_team_executions(team_id, after: nil, limit: 100)` または `team.executions(...)` |
41
- | Handoffの実行/復旧 | `Agent::HandoffRunner.new(main_agent:, handoffs:).invoke(input, config: {})`。未完了turnがあれば保存済み予約・入力を使用 |
42
- | static childの復旧 | `Orchestrator#resume(execution_id, config: {})` |
43
- | Teamの作成/復旧 | `team_definition id:, version:`、`create(team_id:, persistence:)`、`load(team_id, persistence:, on_event:)`、`resume(run_id)` |
44
- | 明示cancel | `team.cancel(run_id)` / `handoff_runner.cancel(execution_id)`。Orchestratorを含むAgentの既存操作は`config[:cancellation_token]` |
45
-
46
- 一覧順はsemantic IDの辞書順、`after`は排他的ID cursor、`limit`は正の整数です。
47
- 時刻順やリクエスト一意対応を意味しません。Applicationは候補を自身の相関情報と照合します。
48
-
49
- Agentの結果statusは既存Symbol、Teamの結果statusはcanonical Stringです。
50
- Teamのdefault aggregate結果もcanonical JSONのためHash keyはString、errorは例外オブジェクトではなく
51
- `class`/`message`等のデータです。aggregateに渡すassignmentのトップレベルとtask keyはSymbolです。
52
-
53
- Handoffの未開始Target予約は`status: :active, phase: :target_pending, reserved: true`で識別します。
54
- 明示cancelした未開始Targetは予約IDを保持し、過去turnの結果に後続turnを代用しません。
55
- 不存在は`Persistence::NotFoundError`、読み取り/復号失敗はそのエラーを返します。
56
- 削除された結果を復元する機能や無期限retentionは追加していません。
57
-
58
- `Team.load`はTeam factsのhydrationのみです。子の実行/復旧は`resume`で開始します。
59
- Agentの`load`は既存Recovery契約を維持します。結果だけが必要なら上記Persistence参照APIを使います。
60
- Teamの`on_event`はhidden Agentsへ渡し、必要なRecovery/approval eventを受け取ります。
61
- `Team.stream`はcommit済みassignmentのRuntime通知です。新しい通知配送保証はありません。
62
-
63
- ## RC対応表
64
-
65
- パスはリポジトリroot相対です。共通の追加障害specは
66
- `spec/phronomy/multi_agent/durable_coordination_spec.rb`です。
67
-
68
- | 要件 | 主な実装 | 検証根拠 |
36
+ | Agent result access | `store.execution_result(execution_id)`; a frozen Hash containing owner, status, phase, result/error, and reference IDs |
37
+ | Handoff result access | `store.handoff_result(source_execution_id)`; follows the exact Target of that turn. No graph/Agent hydration is required |
38
+ | Agent execution discovery | `store.list_executions(agent_id, after: nil, limit: 100)`; immutable execution records, both active and terminal |
39
+ | Team result access | `store.team_execution_result(run_id)` or `team.result(run_id)` |
40
+ | Team execution discovery | `store.list_team_executions(team_id, after: nil, limit: 100)` or `team.executions(...)` |
41
+ | Handoff execution/recovery | `Agent::HandoffRunner.new(main_agent:, handoffs:).invoke(input, config: {})`; uses the persisted reservation and input if an incomplete turn exists |
42
+ | Static child recovery | `Orchestrator#resume(execution_id, config: {})` |
43
+ | Team creation/recovery | `team_definition id:, version:`, `create(team_id:, persistence:)`, `load(team_id, persistence:, on_event:)`, `resume(run_id)` |
44
+ | Explicit cancellation | `team.cancel(run_id)` / `handoff_runner.cancel(execution_id)`; existing Agent operations, including Orchestrator, use `config[:cancellation_token]` |
45
+
46
+ Lists are ordered lexicographically by semantic ID; `after` is an exclusive ID cursor, and `limit` is a positive integer.
47
+ This does not imply chronological ordering or unique correspondence to a request. Applications match candidates against their own correlation information.
48
+
49
+ Agent result status uses existing Symbols; Team result status uses canonical Strings.
50
+ The default Team aggregate result is also canonical JSON: Hash keys are Strings, and errors are data such as
51
+ `class`/`message`, not exception objects. Top-level assignment keys and task keys passed to aggregate are Symbols.
52
+
53
+ An unstarted Handoff Target reservation is identified by `status: :active, phase: :target_pending, reserved: true`.
54
+ Explicit cancellation of an unstarted Target preserves its reserved ID; a later turn never substitutes for the result of an earlier turn.
55
+ Absence produces `Persistence::NotFoundError`; read/decode failures produce their actual errors.
56
+ No facility to restore deleted results or retain them indefinitely has been added.
57
+
58
+ `Team.load` hydrates Team facts only. Child execution/recovery starts through `resume`.
59
+ Agent `load` retains its existing Recovery contract. Use the Persistence access APIs above when only results are needed.
60
+ Team's `on_event` is passed to hidden Agents to receive required Recovery/approval events.
61
+ `Team.stream` provides Runtime notifications of committed assignments; it adds no notification-delivery guarantee.
62
+
63
+ ## RC mapping
64
+
65
+ Paths are relative to the repository root. The shared additional fault specs are in
66
+ `spec/phronomy/multi_agent/durable_coordination_spec.rb`.
67
+
68
+ | Requirement | Main implementation | Validation evidence |
69
69
  |---|---|---|
70
- | RC-01-A/B | `Persistence#execution_result` / `list_executions`、Team対応API | owner未loadの再構築環境でactive/terminal候補・ページング・結果を読み、Provider/所有登録を増やさない |
71
- | RC-01-C | `Persistence#handoff_result`、読み取り専用materialization | graph/ownerなしの予約参照、read障害、purge済み結果のNotFound。callback政策は既存`stream_callback_error_policy_spec.rb`でも検証 |
72
- | RC-02-A | Agent準備の既存F1 readback、`reconcile_terminal_error`、Team `admit`/`update` | Teamの各revision commit直後の応答喪失、Source移転の応答喪失、確定worker/child outcomeの再利用 |
73
- | RC-02-B/C | exact予約照合・atomic admission/CAS・bounded readback | read失敗と不存在を区別。Team admission後のreadback失敗ではdispatchなし。Backend契約はstale CAS、active重複、8 repository rollbackを検証 |
74
- | RC-03-A | Team definition snapshot、static child slot定義、Handoff graph/Target照合 | worker version不一致とTarget/graph不足でfail closed。既存Handoff統合specで別Persistenceを拒否 |
75
- | RC-03-B | immutable Context/input/knowledge/assignment/outcome | 現在policyを変更しても保存済みHandoffContextを使用。worker結果・static child結果・knowledge metadataを保持 |
76
- | RC-04-A | 既存Task待機/Runtime shutdown契約 | `task_spec.rb`、`agent/acs16_task_quiescence_spec.rb`、Runtime/admission specs。Runtime再構築テストで暗黙cancelを追加しない |
77
- | RC-04-B/C/D | Team cancel flag、Handoff exact cancellation、Agent子admission条件、既存terminal barrier | 予約worker/Targetを起動せずID保持。外部fact待ちのactive childを持つparentはactiveのままcancel情報を保存し再起動後も保持。既存admission/physical-quiescence specsと合わせて確認 |
78
- | RC-04-E | Source terminal linkとTarget cancel。責務はTargetのまま | transfer後cancel→再起動→後続turnでもSourceへ戻らず、過去の予約IDとcancel結果を維持 |
79
- | RC-05 | callback/外部効果とsemantic recordの分離 | mixed external/framework Tool batchは外部factだけresolveし、完了childを再実行しない。内部`finalize`の事実をApplicationへ問い合わせない |
80
-
81
- `lib/phronomy/testing/persistence_contract/coordination_repositories.rb`の新shared examplesは、
82
- 外部backendにも公開される`phronomy/testing/persistence_contract`経由で実行されます。
83
- raw SPI/API snapshot/RBS、旧Handoff定数削除、EventLoop単一writer/causal barrier、
84
- logical-operation tracingの既存guardも維持しています。
85
-
86
- ## 検証の範囲と限界
87
-
88
- 実測環境はRuby 3.3.6。使用gemは配布ZIPの`verification/gems.txt`に記録します。
89
- 配布対象に対する実測コマンド、結果、ログは同梱の検証記録を参照してください。
90
-
91
- - 通常RSpecは外部LLMへの接続を要するintegration tagを除外します。
92
- - 選択したHandoff/Orchestrator/Team integrationはWebMockで実行します。
93
- - 追加F4テストは、commit済みDurableRecordを複製し、新Backendと新Runtimeで復旧するモデルです。
94
- これは実OSプロセスの強制終了や物理ディスクへのfsyncの実証ではありません。
95
- - 実LLM、Redis、PostgreSQL、OpenTelemetry等を使う別スイートは今回の実測対象外です。
96
- optional依存/service未設定59件と既存obsolete2件の計61件がpendingです。
97
- - 外部backendのF4保存性と複数processの排他は、そのbackendとdeploymentの契約に依存します。
98
- InMemory自身はプロセス終了後の保存を保証しません。
99
- - semantic cancellationは外部効果のrollbackではありません。TokenオブジェクトはRuntime-onlyです。
100
- durable cancel flag/factがcommitした後は保持し、未確定外部処理は既存Recoveryで照合します。
101
- fact/approval待ちをfailedにして子を忘れず、`ExecutionRehydrationRequiredError`で制御を返します。
102
-
103
- Frameworkが実施するのは、確定outcomeの再利用と未完了実行の同じsemantic identityでの復旧です。
104
- callback outbox/ACK、global generic class registry、Proc/Class永続化、distributed transaction、
105
- Team専用の第二execution engineは追加していません。
106
-
107
- ## パッケージ
108
-
109
- 完全版ファイルと削除manifestを同梱します。baseline/適用前後のハッシュを検査して適用します。
110
- 新しいClassの配置をZeitwerkの命名規則に合わせ、旧overlayのdecorator ignoreは不要です。
111
- 旧`MultiAgent::Handoff*`、`Runner`、`Coordinator`、`CoordinationState`の実装を削除します。
112
- 適用・依存関係・VERIFY手順は配布rootの`README_APPLY_JA.md`を参照してください。
70
+ | RC-01-A/B | `Persistence#execution_result` / `list_executions`, and corresponding Team APIs | Reads active/terminal candidates, pagination, and results in a reconstructed environment without loading the owner; does not invoke Providers or add ownership registrations |
71
+ | RC-01-C | `Persistence#handoff_result`, read-only materialization | Reservation access without graph/owner, read failures, and NotFound for purged results. Callback policy is also covered by the existing `stream_callback_error_policy_spec.rb` |
72
+ | RC-02-A | Existing F1 readback during Agent preparation, `reconcile_terminal_error`, Team `admit`/`update` | Lost acknowledgements immediately after each Team revision commit and Source transfer; reuse of committed worker/child outcomes |
73
+ | RC-02-B/C | Exact reservation reconciliation, atomic admission/CAS, bounded readback | Distinguishes read failure from absence. No dispatch after a failed readback following Team admission. Backend contracts check stale CAS, duplicate active records, and rollback across eight repositories |
74
+ | RC-03-A | Team definition snapshots, static child slot definitions, Handoff graph/Target matching | Fails closed on worker-version mismatch or missing Target/graph. Existing Handoff integration specs reject a different Persistence instance |
75
+ | RC-03-B | Immutable Context/input/knowledge/assignment/outcome | Uses persisted HandoffContext even when the current policy changes. Preserves worker results, static child results, and knowledge metadata |
76
+ | RC-04-A | Existing Task waiting/Runtime shutdown contracts | `task_spec.rb`, `agent/acs16_task_quiescence_spec.rb`, and Runtime/admission specs. Runtime reconstruction tests introduce no implicit cancellation |
77
+ | RC-04-B/C/D | Team cancellation flags, exact Handoff cancellation, Agent child-admission conditions, existing terminal barriers | Preserves reserved worker/Target IDs without starting them. A parent with an active child awaiting external facts remains active, persists cancellation information, and retains it after restart. Checked together with existing admission/physical-quiescence specs |
78
+ | RC-04-E | Source terminal link and Target cancellation; responsibility remains with Target | Cancellation after transfer, restart, and a later turn do not return responsibility to Source; historical reserved IDs and cancellation results are preserved |
79
+ | RC-05 | Separation of callbacks/external effects from semantic records | Mixed external/framework Tool batches resolve only external facts and do not rerun completed children. Application is not asked to determine facts about internal `finalize` |
80
+
81
+ The new shared examples in `lib/phronomy/testing/persistence_contract/coordination_repositories.rb`
82
+ run through `phronomy/testing/persistence_contract`, which is also exposed to external backends.
83
+ Existing guards for raw SPI/API snapshots/RBS, removal of old Handoff constants, the EventLoop single writer/causal barrier,
84
+ and logical-operation tracing are preserved.
85
+
86
+ ## Validation scope and limitations
87
+
88
+ The measured environment is Ruby 3.3.6. Gem versions are recorded in the distribution ZIP's `verification/gems.txt`.
89
+ See the accompanying verification records for commands, results, and logs measured against the distributed files.
90
+
91
+ - Ordinary RSpec runs exclude integration tags requiring connections to external LLMs.
92
+ - Selected Handoff/Orchestrator/Team integration tests run with WebMock.
93
+ - Added F4 tests model recovery by copying committed DurableRecords and using a new Backend and Runtime.
94
+ They do not demonstrate forced termination of a real OS process or fsync to physical storage.
95
+ - Separate suites using live LLMs, Redis, PostgreSQL, OpenTelemetry, and similar dependencies are outside this measurement.
96
+ There are 61 pending cases: 59 with optional dependencies/services unconfigured and two existing obsolete cases.
97
+ - F4 durability and exclusion across multiple processes for external backends depend on the backend and deployment contracts.
98
+ InMemory itself does not guarantee persistence after process termination.
99
+ - Semantic cancellation does not roll back external effects. Token objects are Runtime-only.
100
+ Committed durable cancellation flags/facts are retained, and uncertain external operations are reconciled through existing Recovery.
101
+ Waiting for facts/approval is not converted into failure that forgets a child; control returns through `ExecutionRehydrationRequiredError`.
102
+
103
+ The framework reuses committed outcomes and recovers incomplete executions with the same semantic identity.
104
+ It adds no callback outbox/ACK, global generic class registry, Proc/Class persistence, distributed transaction,
105
+ or second execution engine dedicated to Team.
106
+
107
+ ## Package
108
+
109
+ The package includes complete files and a deletion manifest. Application checks the baseline and pre/post-application hashes.
110
+ New Class locations follow Zeitwerk naming conventions; the old overlay's decorator ignore is unnecessary.
111
+ The old `MultiAgent::Handoff*`, `Runner`, `Coordinator`, and `CoordinationState` implementations are removed.
112
+ See `README_APPLY_JA.md` at the distribution root for application, dependencies, and VERIFY procedures.
@@ -1,179 +1,178 @@
1
- # V2復旧契約の明確化 — 承認済み追補
1
+ # V2 Recovery Contract Clarifications - Approved Addendum
2
2
 
3
- 更新日: 2026-09-06 / 文書改訂: V2 revision 2
3
+ Updated: 2026-09-06 / Document revision: V2 revision 2
4
4
 
5
- ## 0. 位置づけ
5
+ ## 0. Purpose and authority
6
6
 
7
- 本追補は、V2への追加提案5点に対するユーザーの承認を反映した規範的な実装契約である。
8
- ADR-029/030/031およびImplementation Design V2と合わせて適用する。
9
- 元のV2責務境界を維持し、結果参照・保存成否不明・wiring互換性・キャンセル・保証表現を明確化する。
10
- 同じ論点の旧記述と差がある場合、本改訂の明確化を優先する。それ以外の既存ADRの契約を置き換えない。
7
+ This addendum is a normative implementation contract reflecting the user's approval of five additions to V2.
8
+ Apply it together with ADR-029/030/031 and Implementation Design V2.
9
+ It preserves the original V2 responsibility boundaries while clarifying result access, unknown persistence outcomes, wiring compatibility, cancellation, and guarantee wording.
10
+ Where an earlier statement on the same issue differs, these clarifications take precedence. They do not otherwise replace existing ADR contracts.
11
11
 
12
- 対象baselineは `5472116cd99a63ec27875024c955ea82be612d6b` のままとする。
13
- これは仕様の承認であり、実装完了やテスト成功を意味しない。
14
- 公開メソッド名・例外名・既存キャンセル実装への対応付けはbaseline確認後に確定する。
15
- 本書の要件IDは追跡用の文書上のIDであり、新しいRuntime ID・永続ID・APIではない。
12
+ The baseline remains `5472116cd99a63ec27875024c955ea82be612d6b`.
13
+ This is specification approval, not evidence of implementation completion or successful tests.
14
+ Public method names, exception names, and mappings to the existing cancellation implementation will be finalized after inspecting the baseline.
15
+ Requirement IDs in this document are for traceability; they are not new Runtime IDs, persistent IDs, or APIs.
16
16
 
17
- ## 1. RC-01 — 確定結果の参照と実行の発見
17
+ ## 1. RC-01: Accessing final results and discovering executions
18
18
 
19
- ### 必須契約
19
+ ### Required contract
20
20
 
21
- - Applicationはsemantic execution IDを指定して、owner identity、実行状態、確定結果またはエラーを読み取り専用で取得できる。
22
- - 対象はAgentExecutionとTeamExecution。Handoff/Orchestratorは既存のrouting anchor・parent execution・予約済みchild/Target IDを使用し、参照のための新しい実行entityを作らない。
23
- - Handoffでは指定した実行に結び付いたTarget outcomeを識別する。後続ターンの「最新のactive Agentの結果」を過去の呼び出し結果として代用しない。
24
- - admissionがcommitした後、Applicationが実行IDを受け取る前に停止する場合に備え、既知のagent_id/team_idから実行候補を発見できる公開経路を用意する。activeだけでなくterminalとなった実行も対象とする。
25
- - 結果参照・候補列挙はProvider/Tool起動、Agent continuation、callback再配送、ownership取得を伴わない。復旧を起動する操作とは区別する。
26
- - 結果が未確定、不存在、参照不能を区別する。Persistence障害やresult materialization失敗を「実行なし」「処理中」「成功で結果なし」に変換しない。
27
- - 基本状態と確定結果は保存済みrecordから取得する。継続実行に必要なgraph/Procを結果参照だけのために要求しない。既存codec/schemaの互換性要件は維持する。
21
+ - Application can obtain the owner identity, execution state, and committed result or error by semantic execution ID through read-only access.
22
+ - This covers AgentExecution and TeamExecution. Handoff/Orchestrator use existing routing anchors, parent executions, and reserved child/Target IDs; they do not create a new execution entity just for result access.
23
+ - Handoff identifies the Target outcome associated with the specified execution. The latest active Agent result from a later turn must not substitute for an earlier invocation's result.
24
+ - Provide a public path to discover execution candidates from a known agent_id/team_id, covering an interruption after admission commits but before Application receives the execution ID. Include terminal as well as active executions.
25
+ - Result access and candidate enumeration must not invoke Providers/Tools, continue Agent execution, redeliver callbacks, or acquire ownership. Distinguish these operations from operations that initiate recovery.
26
+ - Distinguish an unresolved result, absence, and inability to read. Do not translate Persistence failures or result-materialization failures into no execution, in progress, or successful completion without a result.
27
+ - Read basic state and committed results from persisted records. Do not require the graph/Procs needed for continuation merely to access results. Preserve existing codec/schema compatibility requirements.
28
28
 
29
- ### 範囲の制限
29
+ ### Scope limitations
30
30
 
31
- 候補の発見は、Applicationのリクエストとの自動一意対応やsubmissionのexactly-onceを保証しない。
32
- 複数候補がある場合、時刻が最新という理由だけで対象と断定せず、Applicationが保持する相関情報と照合する。
33
- Application固有のrequest ID・outbox・dedupはApplication責務であり、参照要件だけを理由に汎用idempotency基盤を追加しない。
31
+ Candidate discovery does not guarantee automatic unique correspondence to an Application request or exactly-once submission.
32
+ When multiple candidates exist, do not select one merely because it has the latest timestamp; Application must match its own correlation information.
33
+ Application-specific request IDs, outboxes, and deduplication remain Application responsibilities. Do not add generic idempotency infrastructure solely to meet result-access requirements.
34
34
 
35
- 既存のretention/delete契約を維持する。削除済み結果の復元、無期限保存、新しい履歴管理サービスは要求しない。
36
- 一覧の範囲・順序・ページング等は既存API/SPIを確認して最小限の公開経路に対応付ける。
37
- 既存APIで満たせない箇所のみ追加し、内部repositoryをそのまま公開契約として露出させない。
35
+ Preserve existing retention/deletion contracts. Restoring deleted results, indefinite retention, and a new history-management service are not required.
36
+ Inspect existing API/SPI behavior and map list scope, ordering, pagination, and similar concerns to the smallest necessary public path.
37
+ Add only capabilities that existing APIs cannot provide; do not expose internal repositories directly as the public contract.
38
38
 
39
- ## 2. RC-02 — 不存在・競合・保存成否不明の区別
39
+ ## 2. RC-02: Distinguishing absence, conflicts, and unknown persistence outcomes
40
40
 
41
- ### 共通判断規則
41
+ ### Shared decision rules
42
42
 
43
- | 観測 | 許可する判断・動作 |
43
+ | Observation | Permitted decision or action |
44
44
  |---|---|
45
- | 正常なauthoritative readで予約済みIDの不存在を確認 | 親の最新状態・予約・キャンセル条件を確認し、同じ予約済みIDでadmissionを試みる |
46
- | exact IDのnonterminalを確認 | 同じ実行の既存Recovery契約へ進む |
47
- | exact IDのterminalを確認 | 保存済みoutcomeを利用する。replacement executionを作らない |
48
- | read timeout / I/O failure / record decode failure | 不存在とみなさず、状態を保持して既存のerror/retry契約へ進む |
49
- | write応答消失などでcommit成否不明 | 同じoperation identity・予約済みIDを保持してreadbackする。確認前に別IDや別assignmentを作らない |
50
- | 明確なrevision/admission競合 | 最新のauthoritative factsを再読し、予約・owner・入力との整合を検証する。競合を単純な成功とみなさない |
45
+ | A successful authoritative read confirms that the reserved ID is absent | Check the parent's latest state, reservation, and cancellation conditions, then attempt admission with the same reserved ID |
46
+ | The exact ID is confirmed nonterminal | Follow the existing Recovery contract for the same execution |
47
+ | The exact ID is confirmed terminal | Use the persisted outcome; do not create a replacement execution |
48
+ | Read timeout / I/O failure / record decode failure | Preserve state and follow existing error/retry contracts; do not treat the failure as absence |
49
+ | Commit outcome is unknown, for example after a lost write acknowledgement | Retain the same operation identity and reserved ID for readback; do not create another ID or assignment before confirmation |
50
+ | A definite revision/admission conflict | Reread the latest authoritative facts and validate consistency with the reservation, owner, and input; do not treat the conflict as success by itself |
51
51
 
52
- readbackが利用する整合性は、admission/CASを保護する既存Persistence契約を満たすこと。
53
- cache/indexの不一致や読み取り障害を新規admissionの根拠にしない。
54
- 不存在確認とadmissionの間の競合は既存のatomic admission/CASで防ぐ。
55
- 外部semantic workはadmissionの成功が確定した後にのみ開始する。
52
+ Readback consistency must satisfy the existing Persistence contract that protects admission/CAS.
53
+ Cache/index discrepancies and read failures must not justify new admission.
54
+ Use existing atomic admission/CAS to prevent races between confirming absence and admission.
55
+ Start external semantic work only after admission success is confirmed.
56
56
 
57
- 適用対象: Source Handoff transfer、Target admission/stabilization、parent child reservation/outcome、
58
- Team admission/enqueue/finalize/assignment/worker outcome/terminal。
59
- Team-owned enqueue/finalizeは既存方針のstable tool_invocation_idによるfact照合を維持する。
57
+ Scope: Source Handoff transfer, Target admission/stabilization, parent child reservation/outcome,
58
+ and Team admission/enqueue/finalize/assignment/worker outcome/terminal state.
59
+ Team-owned enqueue/finalize retain the existing policy of fact reconciliation using a stable tool_invocation_id.
60
60
 
61
- 成否不明を解決できない間は、確定していないローカル推測で次のsemantic処理へ進まない。
62
- 無期限に同期待機せず、既存のPersistence error/retry経路へ制御を返す。
63
- Applicationにストレージ上の事実を創作させるmanual resolutionは追加しない。
64
- 既存Agent/Persistenceの成否不明処理を再利用し、coordination専用の第二transaction engineを作らない。
61
+ While an unknown outcome remains unresolved, do not advance to the next semantic operation based on unconfirmed local assumptions.
62
+ Return control through existing Persistence error/retry paths instead of waiting synchronously without a bound.
63
+ Do not add manual resolution that requires Application to invent storage facts.
64
+ Reuse existing Agent/Persistence handling of unknown outcomes; do not create a second transaction engine dedicated to coordination.
65
65
 
66
- ## 3. RC-03 — 復旧時wiringの最低互換性
66
+ ## 3. RC-03: Minimum wiring compatibility for recovery
67
67
 
68
- ### 照合対象
68
+ ### Required checks
69
69
 
70
- | 対象 | 継続前に必要な照合 |
70
+ | Subject | Checks required before continuation |
71
71
  |---|---|
72
- | Agent/Team定義 | 保存されたdefinition id/versionと現在の定義。既存の明示的な互換・移行契約がなければ一致を要求 |
73
- | Orchestrator child | 保存済みslotとstatic subagent登録から解決した定義、予約済みagent_id/execution_id、ownerとの一致 |
74
- | Handoff | original main anchor、保存済みactive/Target ID、必要なgraph接続、同じPersistence instance/domain |
75
- | Team worker/coordinator | Team lineage、保存済みworker slotと定義、予約済みAgent/実行ID、保存済みassignmentとの一致 |
72
+ | Agent/Team definition | Compare the persisted definition id/version with the current definition; require equality unless an existing explicit compatibility/migration contract permits otherwise |
73
+ | Orchestrator child | Match the persisted slot, the definition resolved from static subagent registration, reserved agent_id/execution_id, and owner |
74
+ | Handoff | Match the original main anchor, persisted active/Target IDs, required graph connections, and the same Persistence instance/domain |
75
+ | Team worker/coordinator | Match Team lineage, the persisted worker slot and definition, reserved Agent/execution IDs, and the persisted assignment |
76
76
 
77
- 必要な登録やTargetがない、定義が不一致、Persistence境界が異なる場合は、semantic workを開始せずfail closedとする。
78
- エラーから対象identityと不足・不整合の種類が分かるようにする。既存のconfiguration/rehydration error契約を使う。
79
- 結果の読み取りだけに不要な実行wiringを要求しない(RC-01)。
77
+ If a required registration or Target is missing, a definition is incompatible, or the Persistence boundary differs, fail closed without starting semantic work.
78
+ Use existing configuration/rehydration error contracts and make the affected identity and type of missing/inconsistent information clear from the error.
79
+ Do not require execution wiring unnecessary for read-only result access (RC-01).
80
80
 
81
- ### 確定済みfactの優先
81
+ ### Committed facts take precedence
82
82
 
83
- - 確定済みHandoffContextを現在のHandoffPolicyで再投影しない。
84
- - 確定済みchild input/configを現在のデフォルトで置き換えない。
85
- - 確定済みassignmentを現在のschedulerで選び直さない。
86
- - 確定済みchild/worker/final aggregate outcomeを再計算しない。
87
- - 未確定のscheduler/aggregateは既存V2のreplay-safe契約に従って再実行できる。保存済み入力に対する意味の互換性をApplicationが保つ。
83
+ - Do not reproject committed HandoffContext using the current HandoffPolicy.
84
+ - Do not replace committed child input/config with current defaults.
85
+ - Do not reselect committed assignments using the current scheduler.
86
+ - Do not recompute committed child/worker/final aggregate outcomes.
87
+ - Uncommitted scheduler/aggregate computations may rerun under the existing V2 replay-safe contract. Application must preserve semantic compatibility with the persisted inputs.
88
88
 
89
- Phronomyが検査できるのは宣言されたidentity/versionと構造であり、Rubyコードの意味の同一性ではない。
90
- 同じversionのまま非互換な実装に変更しないことはApplication責務。
91
- versionを上げるだけで旧実行の復旧が自動的に可能になるわけではなく、対応する定義または既存の明示的移行契約が必要。
92
- Proc/Classの永続化、ソースハッシュ、policy descriptor、global generic class registryは追加しない。
89
+ Phronomy can check declared identity/version and structure, not semantic equivalence of Ruby code.
90
+ Application is responsible for not introducing incompatible implementations under an unchanged version.
91
+ Increasing a version alone does not automatically enable recovery of old executions; the corresponding definition or an existing explicit migration contract is required.
92
+ Do not add Proc/Class persistence, source hashes, policy descriptors, or a global generic class registry.
93
93
 
94
- ## 4. RC-04 — 待機終了とsemantic cancellation
94
+ ## 4. RC-04: Ending observation and semantic cancellation
95
95
 
96
- ### 操作の区別
96
+ ### Distinguish operations
97
97
 
98
- | 操作・状態 | 契約 |
98
+ | Operation or state | Contract |
99
99
  |---|---|
100
- | Applicationが待機をやめる・接続が切れる・観測timeout | それだけではdurable executionへのsemantic cancellationとしない |
101
- | Runtime shutdown / process loss | それだけではsemantic cancellationを確定しない。既存shutdown/draining契約で実行を保存・復旧可能に保つ |
102
- | 明示的なsemantic cancellation要求 | 既存Agent cancellation契約に従い、対象owner/runと予約済み実行に対応付ける |
103
- | recovery resolution / approval待ち | failureや自動cancelへ変換せず、既存V2のrehydration経路を維持する |
100
+ | Application stops waiting, a connection is lost, or observation times out | This alone is not semantic cancellation of the durable execution |
101
+ | Runtime shutdown / process loss | This alone does not establish semantic cancellation; preserve execution and recoverability under existing shutdown/draining contracts |
102
+ | Explicit semantic cancellation request | Map it to the target owner/run and reserved executions under the existing Agent cancellation contract |
103
+ | Waiting for recovery resolution / approval | Preserve existing V2 rehydration paths; do not convert waiting into failure or automatic cancellation |
104
104
 
105
- 既存Taskの明示cancelなど、もともとsemantic cancellationを要求するAPIはその契約を維持する。
106
- 単なる観測終了と同じ操作として扱わない。具体的な公開API対応はbaseline確認時に記載する。
105
+ APIs that already request semantic cancellation, such as explicit cancellation of an existing Task, retain that contract.
106
+ Do not treat them as equivalent to merely ending observation. Record concrete public API mappings when inspecting the baseline.
107
107
 
108
- ### 子実行への適用
108
+ ### Applying cancellation to child executions
109
109
 
110
- | 子の状態 | 親runへのsemantic cancellationが受理された場合 |
110
+ | Child state | Behavior after semantic cancellation of the parent run is accepted |
111
111
  |---|---|
112
- | 予約済み・未開始 | 現在の親runに属する新規dispatchを止める。予約情報を失わず、キャンセルのために子を起動しない |
113
- | 実行中・admission競合中 | exact reserved IDの状態を確認し、既存Agent cancellationを適用する。単にローカルTaskを破棄して処理済みとみなさない |
114
- | terminal | durable outcomeを維持する。過去の成功・失敗をキャンセル済みに書き換えたり補償再実行したりしない |
112
+ | Reserved, not started | Stop new dispatch owned by the current parent run; retain reservation information and do not start a child just to cancel it |
113
+ | Running, or racing with admission | Check the exact reserved ID's state and apply existing Agent cancellation; discarding a local Task alone does not complete cancellation handling |
114
+ | Terminal | Preserve the durable outcome; do not rewrite historical success/failure as cancellation or rerun it for compensation |
115
115
 
116
- 親cancelと子admissionの競合は、最新の親run状態・既存admission契約で処理する。
117
- 既にadmitされた子は実行中の規則で照合し、別IDの子を作らない。
118
- 親terminalizationと子settlementの順序は既存Agentのcancel/terminal barrier契約へ対応付ける。
119
- 未完了の子がある場合、そのexact IDと必要なcancel/reconciliation状態を失ってはならない。
120
- restart後にも既存の復旧経路から対象を発見できることを必須とし、未対応の子を忘れたまま親の全処理完了を主張しない。
121
- 新規の公開terminal statusや別のcancel schedulerを本追補だけで追加しない。
116
+ Handle races between parent cancellation and child admission using the latest parent-run state and existing admission contracts.
117
+ Reconcile an already admitted child under the running-child rules; do not create a child with a different ID.
118
+ Map the ordering of parent terminalization and child settlement to existing Agent cancellation/terminal-barrier contracts.
119
+ If a child is incomplete, retain its exact ID and required cancellation/reconciliation state.
120
+ Require rediscovery through existing recovery paths after restart; do not claim that all parent work is complete while forgetting an unhandled child.
121
+ Do not add a new public terminal status or a separate cancellation scheduler solely for this addendum.
122
122
 
123
- キャンセルの範囲は当該親runが所有する子に限定し、共有Agentの別実行・後続Team runへ波及させない。
124
- HandoffのSourceはtransfer commit後にhanded_offであり、後からSourceをcancelしてtransferを取り消したことにしない。
125
- 現在のHandoff turnに対する明示cancelは、保存済みrouting/予約から該当Target実行へ対応付ける。
126
- 観測終了・cancelを理由にactive responsibilityを元のmain Agentへ戻さない。
123
+ Limit cancellation to children owned by the affected parent run; it must not affect other executions of a shared Agent or later Team runs.
124
+ A Handoff Source is handed_off after transfer commits. Cancelling Source later must not be treated as reversing the transfer.
125
+ Map explicit cancellation of the current Handoff turn to the relevant Target execution using persisted routing/reservations.
126
+ Do not return active responsibility to the original main Agent because observation ends or cancellation occurs.
127
127
 
128
- 外部Provider/Toolのcancelは副作用の取り消しを保証しない。成否不明は既存Agent Recovery契約で解決する。
129
- 既存機構で上記の順序・再発見を満たせず第二実行エンジン等が必要なら、Stop Conditionとして報告する。
128
+ Cancellation of external Providers/Tools does not guarantee reversal of side effects. Resolve uncertain outcomes through the existing Agent Recovery contract.
129
+ If existing mechanisms cannot satisfy the required ordering and rediscovery without a second execution engine or similar addition, report a Stop Condition.
130
130
 
131
- ## 5. RC-05 — durability保証の統一表現
131
+ ## 5. RC-05: Consistent durability guarantee wording
132
132
 
133
- > 確定済みのdurable outcomeは再利用する。未完了の実行は同じsemantic identityで復旧する。
134
- > 外部Provider/Tool処理の成否不明は既存Agent Recovery契約に従って解決する。
133
+ > Reuse committed durable outcomes. Recover incomplete executions with the same semantic identity.
134
+ > Resolve uncertain outcomes of external Provider/Tool operations under the existing Agent Recovery contract.
135
135
 
136
- 「開始していないと確認できた場合だけ開始」はframework-owned execution admissionの判断を指す。
137
- 外部システムへのリクエストが一度も届いていないことや、外部副作用のexactly-onceを意味しない。
138
- 未完了実行を同じIDで復旧することも、内部の全Provider/Tool呼び出しの無条件再送を意味しない。
139
- callback喪失、ローカルTask喪失、観測timeoutをsemantic work再実行の理由にしない。
136
+ Starting only when execution is confirmed not to have started refers to framework-owned execution admission.
137
+ It does not mean that no request ever reached an external system, nor does it guarantee exactly-once external side effects.
138
+ Recovering an incomplete execution with the same ID also does not mean unconditionally resending every internal Provider/Tool call.
139
+ Loss of a callback or local Task, or an observation timeout, must not justify rerunning semantic work.
140
140
 
141
- ## 6. 検証条件・対応付け
141
+ ## 6. Validation conditions and implementation mapping
142
142
 
143
- 以下は必要な振る舞いの検証条件であり、新しいspecファイルの本数指定ではない。
144
- 既存specが契約を検証している場合はその根拠を記録し、不足ケースのみ追加する。
143
+ The following are behavioral validation conditions, not a required count of new spec files.
144
+ Where existing specs verify a contract, record that evidence and add only missing cases.
145
145
 
146
- | ID | 検証シナリオ | 必須結果 |
146
+ | ID | Validation scenario | Required outcome |
147
147
  |---|---|---|
148
- | RC-01-A | terminal commit後、callback前にprocess loss | exact IDで同じ結果を読み取れ、semantic work/callbackを再実行しない |
149
- | RC-01-B | admission応答前にcallerを失い、実行はterminalになる | owner identityから候補を発見できる。複数候補を勝手に一つへ決めない |
150
- | RC-01-C | graph/listenerなしで結果参照、または結果のread/decode失敗 | 不要なwiringを要求しない。参照失敗を成功・不存在に偽装しない |
151
- | RC-02-A | 各semantic commitの成功直後に応答を喪失 | readbackで既存factを採用し、別ID・二重assignmentを作らない |
152
- | RC-02-B | read障害、authoritative不存在、CAS競合を別々に注入 | 状態を混同せず、成功が確定したadmission後だけ実行する |
153
- | RC-02-C | 成否不明後のreadbackも失敗 | 状態を保ち制御を返す。無期限の同期待機・新規実行をしない |
154
- | RC-03-A | subagent登録削除、定義version不一致、Target不足 | 継続前にfail closed。別定義・別Targetに置き換えない |
155
- | RC-03-B | 互換な現在のwiringで復旧 | 確定済みContext/input/assignment/outcomeを再計算しない |
156
- | RC-04-A | 待機終了・shutdown・process loss | 暗黙のsemantic cancellationを確定しない |
157
- | RC-04-B | 親cancel時に子が未開始/active/terminal | 状態別規則を守り、exact ID・確定outcomeを維持する |
158
- | RC-04-C | 親cancelとchild admission/terminalを競合させる | 子を紛失せず、既存cancel/terminal barrierへ整合する |
159
- | RC-04-D | cancel要求後の各commit境界でprocess loss | 同じrunの未完了子を復旧経路から発見・照合できる |
160
- | RC-04-E | Handoff transfer後の観測終了・明示cancel | Sourceへ巻き戻さず、当該Target実行にだけ適用する |
161
- | RC-05-A | 外部Tool効果の成否不明とcallback喪失を別々に注入 | 前者は既存Recovery、後者は確定結果参照。盲目的再実行なし |
162
-
163
- baseline統合時には、各RC IDについて「公開API/SPI・実装箇所・既存/追加spec」を対応表に記録する。
164
- 特に結果発見API、互換version扱い、cancel/terminal barrierは未確認のメソッド名で完了扱いにしない。
165
- focused・backend・fault・full suiteの実行成功は、target checkoutでの実測が必要。
166
- 本資料改訂時点では実行していない。
167
-
168
- ## 7. 増やさない責務
169
-
170
- callback outbox/ACK、terminal-delivery index、standalone fan-out用synthetic execution、
171
- Proc/Class serialization、global generic registry、独立Persistence間のdistributed transaction、
172
- Team専用の第二execution engineは引き続き対象外。
173
- 公開結果参照はApplicationの通知配送・外部副作用dedupを代替しない。
174
-
175
- ## 8. 実装との対応
176
-
177
- 2026-09-07の実装・公開API/SPI・検証範囲は
178
- [IMPLEMENTATION_REPORT.md](IMPLEMENTATION_REPORT.md)を参照する。
179
- 本追補の責務境界と必須契約は変更しない。
148
+ | RC-01-A | Process loss after terminal commit and before callback | Read the same result by exact ID without rerunning semantic work or callbacks |
149
+ | RC-01-B | Caller is lost before the admission acknowledgement; execution later becomes terminal | Discover candidates from owner identity; do not arbitrarily choose one when multiple candidates exist |
150
+ | RC-01-C | Access results without a graph/listener, or inject result read/decode failure | Require no unnecessary wiring; do not disguise an access failure as success or absence |
151
+ | RC-02-A | Lose the acknowledgement immediately after each successful semantic commit | Adopt the existing fact through readback; create neither another ID nor duplicate assignments |
152
+ | RC-02-B | Independently inject read failure, authoritative absence, and CAS conflict | Keep the states distinct; execute only after admission success is confirmed |
153
+ | RC-02-C | Readback also fails after an unknown outcome | Preserve state and return control; do not wait synchronously without a bound or create a new execution |
154
+ | RC-03-A | Remove subagent registration, mismatch definition version, or omit Target | Fail closed before continuation; do not substitute another definition or Target |
155
+ | RC-03-B | Recover with compatible current wiring | Do not recompute committed Context/input/assignment/outcome |
156
+ | RC-04-A | End waiting, shut down Runtime, or lose the process | Do not establish implicit semantic cancellation |
157
+ | RC-04-B | Parent cancellation with an unstarted/active/terminal child | Follow state-specific rules and preserve exact IDs and committed outcomes |
158
+ | RC-04-C | Race parent cancellation against child admission/terminal state | Do not lose the child; remain consistent with existing cancellation/terminal barriers |
159
+ | RC-04-D | Lose the process at each commit boundary after a cancellation request | Rediscover and reconcile incomplete children of the same run through recovery paths |
160
+ | RC-04-E | End observation or explicitly cancel after Handoff transfer | Do not roll responsibility back to Source; apply cancellation only to the relevant Target execution |
161
+ | RC-05-A | Independently inject an uncertain external Tool effect and a lost callback | Use existing Recovery for the former and committed-result access for the latter; never rerun blindly |
162
+
163
+ When integrating with the baseline, record the public API/SPI, implementation locations, and existing/additional specs for each RC ID in a mapping table.
164
+ In particular, do not mark result-discovery APIs, compatible-version handling, or cancellation/terminal barriers complete using unverified method names.
165
+ Successful focused, backend, fault, and full-suite runs require actual measurement on the target checkout.
166
+ They have not been run at the time of this document revision.
167
+
168
+ ## 7. Responsibilities that remain out of scope
169
+
170
+ Callback outbox/ACK, a terminal-delivery index, synthetic executions for standalone fan-out,
171
+ Proc/Class serialization, a global generic registry, distributed transactions across independent Persistence instances,
172
+ and a second execution engine dedicated to Team remain out of scope.
173
+ Public result access does not replace Application notification delivery or deduplication of external effects.
174
+
175
+ ## 8. Implementation mapping
176
+
177
+ See [IMPLEMENTATION_REPORT.md](IMPLEMENTATION_REPORT.md) for the implementation, public API/SPI, and validation scope as of 2026-09-07.
178
+ The responsibility boundaries and required contracts in this addendum remain unchanged.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Phronomy
4
- VERSION = "0.30.0"
4
+ VERSION = "0.30.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phronomy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.0
4
+ version: 0.30.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raizo T.C.S
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-23 00:00:00.000000000 Z
11
+ date: 2026-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby_llm