phronomy 0.37.0 → 0.38.0
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 +4 -4
- data/CHANGELOG.md +87 -0
- data/README.md +24 -2
- data/SECURITY.md +1 -1
- data/docs/architecture/agent-approval-recovery.md +320 -0
- data/docs/architecture/agent-child-approval-recovery.md +387 -0
- data/docs/architecture/agent-child-execution-recovery.md +425 -0
- data/docs/architecture/agent-dispatch-recovery.md +308 -0
- data/docs/architecture/agent-terminal-persistence-evidence.md +360 -0
- data/docs/architecture/agent-terminal-recovery.md +298 -0
- data/docs/architecture/agent-terminal-submission-recovery.md +275 -0
- data/docs/architecture/agent-tool-child-lifetime.md +29 -0
- data/docs/architecture/agent-transition-ownership.md +24 -0
- data/docs/architecture/backend-groups.md +6 -0
- data/docs/architecture/detached-outcome-proof-projection.md +576 -0
- data/docs/architecture/execution-abstraction-review.md +5 -0
- data/docs/architecture/handoff-dispatch-recovery.md +205 -0
- data/docs/architecture/handoff-initial-terminal-application.md +321 -0
- data/docs/architecture/initial-preparation-recovery.md +308 -0
- data/docs/architecture/multi-agent-handoff.md +17 -0
- data/docs/architecture/native-outcome-preparation.md +715 -0
- data/docs/architecture/native-parent-dispatch-recovery.md +460 -0
- data/docs/architecture/native-parent-outcome-recovery.md +644 -0
- data/docs/architecture/parent-child-terminal-acknowledgement.md +297 -0
- data/docs/architecture/r8-unit12.md +6 -3
- data/docs/architecture/r8-unit4.md +11 -2
- data/docs/architecture/recovery-physical-attempt.md +88 -0
- data/docs/architecture/recovery-submission-custody.md +247 -0
- data/docs/architecture/retained-attempts.md +229 -0
- data/docs/architecture/retained-outcome-materialization.md +636 -0
- data/docs/architecture/retained-outcome-publication.md +506 -0
- data/docs/architecture/storage-execution-boundaries.md +1 -1
- data/docs/architecture/structured-output-and-scope.md +15 -0
- data/docs/architecture/synchronous-participant-application.md +397 -0
- data/docs/architecture/synchronous-participant-contract.md +195 -0
- data/docs/architecture/team-admission-rejection.md +91 -0
- data/docs/architecture/team-cancellation-delivery.md +245 -0
- data/docs/architecture/team-child-retirement.md +104 -0
- data/docs/architecture/tracing.md +26 -0
- data/docs/architecture/workflow-terminal-ownership-design.md +25 -9
- data/docs/architecture/workflow-terminal-reconciliation.md +221 -0
- data/docs/architecture.md +16 -9
- data/docs/decisions/025-process-local-agent-ownership-and-runtime-admission.md +8 -0
- data/docs/features.md +3 -3
- data/docs/mcp-client.md +138 -5
- data/docs/migrations/orchestrator-subagent-dispatch.md +89 -0
- data/docs/migrations/vector-async-clients.md +18 -3
- data/docs/persistence-backends.md +30 -4
- data/docs/runtime-and-concurrency.md +235 -11
- data/lib/phronomy/agent/admission.rb +37 -17
- data/lib/phronomy/agent/api/agent.rb +25 -0
- data/lib/phronomy/agent/approval_recovery.rb +30 -0
- data/lib/phronomy/agent/approval_recovery_api.rb +61 -0
- data/lib/phronomy/agent/approval_recovery_error.rb +39 -0
- data/lib/phronomy/agent/approval_recovery_result.rb +94 -0
- data/lib/phronomy/agent/async_event_api.rb +22 -5
- data/lib/phronomy/agent/base.rb +76 -48
- data/lib/phronomy/agent/context_preparation.rb +10 -8
- data/lib/phronomy/agent/dispatch_recovery.rb +29 -0
- data/lib/phronomy/agent/dispatch_recovery_api.rb +84 -0
- data/lib/phronomy/agent/dispatch_recovery_error.rb +36 -0
- data/lib/phronomy/agent/dispatch_recovery_result.rb +93 -0
- data/lib/phronomy/agent/execution/agent_invocation.rb +11 -3
- data/lib/phronomy/agent/execution/approval_continuation_plan.rb +131 -0
- data/lib/phronomy/agent/execution/approval_parent_evidence.rb +116 -0
- data/lib/phronomy/agent/execution/approval_persistence_evidence.rb +111 -0
- data/lib/phronomy/agent/execution/approval_recovery_operation.rb +496 -0
- data/lib/phronomy/agent/execution/approval_resume_commit.rb +174 -10
- data/lib/phronomy/agent/execution/dispatch_continuation_delivery.rb +96 -0
- data/lib/phronomy/agent/execution/dispatch_persistence_evidence.rb +147 -0
- data/lib/phronomy/agent/execution/dispatch_preparation.rb +63 -7
- data/lib/phronomy/agent/execution/dispatch_recovery_operation.rb +495 -0
- data/lib/phronomy/agent/execution/execution_coordinator.rb +724 -158
- data/lib/phronomy/agent/execution/execution_outcome_committer.rb +312 -39
- data/lib/phronomy/agent/execution/execution_registry.rb +508 -13
- data/lib/phronomy/agent/execution/initial_persistence_evidence.rb +269 -0
- data/lib/phronomy/agent/execution/initial_preparation.rb +132 -40
- data/lib/phronomy/agent/execution/initial_preparation_recovery_operation.rb +513 -0
- data/lib/phronomy/agent/execution/invocation_transitions.rb +3 -0
- data/lib/phronomy/agent/execution/outcome_planning.rb +108 -0
- data/lib/phronomy/agent/execution/outcome_preparation.rb +81 -0
- data/lib/phronomy/agent/execution/outcome_recovery_operation.rb +609 -0
- data/lib/phronomy/agent/execution/outcome_text_projection.rb +73 -0
- data/lib/phronomy/agent/execution/outcome_write_plan.rb +48 -0
- data/lib/phronomy/agent/execution/runtime_record_encoder.rb +7 -4
- data/lib/phronomy/agent/execution/terminal_persistence_evidence.rb +280 -0
- data/lib/phronomy/agent/execution/terminal_recovery_operation.rb +38 -0
- data/lib/phronomy/agent/execution_change.rb +138 -26
- data/lib/phronomy/agent/execution_environment.rb +29 -0
- data/lib/phronomy/agent/execution_rejected_error.rb +34 -0
- data/lib/phronomy/agent/initial_preparation_recovery.rb +32 -0
- data/lib/phronomy/agent/initial_preparation_recovery_api.rb +85 -0
- data/lib/phronomy/agent/initial_preparation_recovery_error.rb +41 -0
- data/lib/phronomy/agent/initial_preparation_recovery_result.rb +115 -0
- data/lib/phronomy/agent/lifecycle/hosted_approval_context.rb +86 -0
- data/lib/phronomy/agent/lifecycle/hosted_invocation.rb +42 -10
- data/lib/phronomy/agent/lifecycle/identity_write.rb +101 -0
- data/lib/phronomy/agent/lifecycle/lifetime_api.rb +28 -0
- data/lib/phronomy/agent/lifecycle/ownership_registry.rb +136 -70
- data/lib/phronomy/agent/lifecycle/scope.rb +3 -3
- data/lib/phronomy/agent/outcome_recovery.rb +47 -0
- data/lib/phronomy/agent/outcome_recovery_api.rb +114 -0
- data/lib/phronomy/agent/outcome_recovery_error.rb +36 -0
- data/lib/phronomy/agent/outcome_recovery_result.rb +92 -0
- data/lib/phronomy/agent/output_contract.rb +16 -6
- data/lib/phronomy/agent/persistence/identity_receipt_repository.rb +61 -0
- data/lib/phronomy/agent/persistence/records.rb +2 -0
- data/lib/phronomy/agent/persistence/storage_schema.rb +2 -0
- data/lib/phronomy/agent/recovery/invocation_restorer.rb +8 -5
- data/lib/phronomy/agent/recovery/recovery_coordinator/continuation.rb +6 -4
- data/lib/phronomy/agent/recovery/recovery_coordinator/installation.rb +21 -43
- data/lib/phronomy/agent/recovery/recovery_coordinator.rb +19 -6
- data/lib/phronomy/agent/runtime_binding/engine_environment.rb +12 -0
- data/lib/phronomy/agent/state_writer.rb +4 -3
- data/lib/phronomy/agent/store.rb +7 -1
- data/lib/phronomy/agent/terminal_recovery.rb +41 -0
- data/lib/phronomy/agent/terminal_recovery_api.rb +101 -0
- data/lib/phronomy/agent/terminal_recovery_error.rb +36 -0
- data/lib/phronomy/agent/terminal_recovery_result.rb +67 -0
- data/lib/phronomy/agent/tool_execution/tool_approval_request.rb +25 -1
- data/lib/phronomy/common/values/serializable.rb +37 -4
- data/lib/phronomy/engine/concurrency/offload_pool.rb +32 -4
- data/lib/phronomy/engine/concurrency/pool_registry.rb +6 -0
- data/lib/phronomy/engine/event_loop.rb +161 -11
- data/lib/phronomy/engine/execution_binding.rb +4 -2
- data/lib/phronomy/engine/execution_receiver_binding.rb +5 -0
- data/lib/phronomy/engine/runtime/shutdown_result.rb +21 -0
- data/lib/phronomy/engine/runtime/timer_queue.rb +7 -2
- data/lib/phronomy/engine/runtime.rb +119 -15
- data/lib/phronomy/execution/attempt_completion.rb +91 -0
- data/lib/phronomy/execution/concurrency/cancellation_token.rb +7 -2
- data/lib/phronomy/execution/concurrency/physical_completion_task.rb +7 -2
- data/lib/phronomy/execution/execution.rb +17 -2
- data/lib/phronomy/execution/execution_receiver.rb +27 -0
- data/lib/phronomy/execution/execution_retirement.rb +30 -0
- data/lib/phronomy/execution/invocation_controls.rb +2 -2
- data/lib/phronomy/execution/retained_attempts.rb +179 -0
- data/lib/phronomy/execution/stopped_terminal_custody.rb +99 -0
- data/lib/phronomy/llm_adapter/response.rb +7 -1
- data/lib/phronomy/multi_agent/admission_registry.rb +6 -0
- data/lib/phronomy/multi_agent/durable_subagent_coordinator.rb +175 -39
- data/lib/phronomy/multi_agent/handoff_dispatch_evidence.rb +176 -0
- data/lib/phronomy/multi_agent/handoff_finalization_error.rb +33 -0
- data/lib/phronomy/multi_agent/handoff_history_release.rb +80 -0
- data/lib/phronomy/multi_agent/handoff_participant.rb +31 -6
- data/lib/phronomy/multi_agent/handoff_runner.rb +195 -21
- data/lib/phronomy/multi_agent/handoff_terminal_finalization.rb +176 -0
- data/lib/phronomy/multi_agent/native_approval_evidence.rb +26 -0
- data/lib/phronomy/multi_agent/native_child_authority.rb +135 -0
- data/lib/phronomy/multi_agent/native_dispatch_evidence.rb +43 -0
- data/lib/phronomy/multi_agent/native_outcome_evidence.rb +46 -0
- data/lib/phronomy/multi_agent/native_persistence_plan.rb +93 -0
- data/lib/phronomy/multi_agent/orchestrator.rb +28 -52
- data/lib/phronomy/multi_agent/reserved_child_admission.rb +90 -1
- data/lib/phronomy/multi_agent/store.rb +5 -34
- data/lib/phronomy/multi_agent/subagent_history_release.rb +88 -0
- data/lib/phronomy/multi_agent/team_cancellation_delivery_error.rb +21 -0
- data/lib/phronomy/multi_agent/team_cancellation_request.rb +134 -0
- data/lib/phronomy/multi_agent/team_coordinator.rb +174 -27
- data/lib/phronomy/persistence_composition/stores.rb +10 -3
- data/lib/phronomy/runtime_composition/execution_defaults.rb +18 -0
- data/lib/phronomy/storage/backends/in_memory.rb +3 -1
- data/lib/phronomy/storage/resource.rb +10 -1
- data/lib/phronomy/tools/agent.rb +7 -1
- data/lib/phronomy/tools/mcp.rb +210 -91
- data/lib/phronomy/tools/mcp_http_close_response.rb +23 -0
- data/lib/phronomy/tools/mcp_transport_registry.rb +210 -0
- data/lib/phronomy/tools/vector_search.rb +28 -5
- data/lib/phronomy/tracing/automatic.rb +8 -1
- data/lib/phronomy/version.rb +1 -1
- data/lib/phronomy/workflow/execution/workflow.rb +34 -0
- data/lib/phronomy/workflow/execution/workflow_execution_environment.rb +1 -0
- data/lib/phronomy/workflow/execution/workflow_execution_registry.rb +106 -7
- data/lib/phronomy/workflow/execution/workflow_runner.rb +53 -108
- data/lib/phronomy/workflow/execution/workflow_terminal_operation.rb +489 -0
- data/lib/phronomy/workflow/execution/workflow_terminal_persistence.rb +81 -0
- data/lib/phronomy/workflow/execution/workflow_terminal_recovery.rb +38 -0
- data/lib/phronomy/workflow/execution/workflow_terminal_recovery_error.rb +34 -0
- data/lib/phronomy/workflow/execution/workflow_terminal_recovery_result.rb +56 -0
- data/lib/phronomy/workflow/runtime_binding/workflow_engine_environment.rb +10 -1
- data/lib/phronomy/workflow/runtime_binding/workflow_task_session.rb +3 -1
- data/lib/phronomy/workflow/runtime_binding/workflow_terminal_policy.rb +2 -1
- data/scripts/api_snapshot.rb +46 -1
- data/sig/_private/phronomy/multi_agent/team_cancellation_request.rbs +19 -0
- data/sig/phronomy/agent/approval_recovery.rbs +54 -0
- data/sig/phronomy/agent/dispatch_recovery.rbs +49 -0
- data/sig/phronomy/agent/execution_contract.rbs +4 -1
- data/sig/phronomy/agent/execution_environment.rbs +2 -0
- data/sig/phronomy/agent/initial_preparation_recovery.rbs +48 -0
- data/sig/phronomy/agent/outcome_recovery.rbs +51 -0
- data/sig/phronomy/agent/store.rbs +1 -0
- data/sig/phronomy/agent/terminal_persistence_evidence.rbs +111 -0
- data/sig/phronomy/agent/terminal_recovery.rbs +46 -0
- data/sig/phronomy/agent.rbs +36 -0
- data/sig/phronomy/engine/concurrency/timer_bindings.rbs +2 -0
- data/sig/phronomy/engine/execution_binding.rbs +2 -1
- data/sig/phronomy/engine/execution_receiver.rbs +4 -0
- data/sig/phronomy/engine/observability.rbs +22 -1
- data/sig/phronomy/execution/execution.rbs +16 -1
- data/sig/phronomy/execution/execution_receiver.rbs +12 -0
- data/sig/phronomy/execution/execution_retirement.rbs +18 -0
- data/sig/phronomy/execution/stopped_terminal_custody.rbs +19 -0
- data/sig/phronomy/handoff.rbs +1 -0
- data/sig/phronomy/multi_agent/handoff_finalization_error.rbs +18 -0
- data/sig/phronomy/multi_agent/store.rbs +1 -1
- data/sig/phronomy/multi_agent/team_cancellation_delivery_error.rbs +9 -0
- data/sig/phronomy/persistence_composition.rbs +2 -1
- data/sig/phronomy/storage/contracts.rbs +2 -1
- data/sig/phronomy/tools/mcp.rbs +27 -0
- data/sig/phronomy/workflow.rbs +42 -0
- metadata +104 -2
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
# Synchronous participant application
|
|
2
|
+
|
|
3
|
+
An application participant joins its own records to Agent's synchronous change.
|
|
4
|
+
Agent retains execution, observation and unresolved persistence responsibility;
|
|
5
|
+
the application retains its history policy. The public synchronous participant
|
|
6
|
+
contract does not authorize callback replay after an ambiguous save.
|
|
7
|
+
|
|
8
|
+
For example, a report Agent reads the local case-42 archive through a Tool and
|
|
9
|
+
returns `case-42 report ready`. Its participant retains the report execution
|
|
10
|
+
until an explicit application decision releases that history. A lost save reply
|
|
11
|
+
can close the caller's observation while Agent still retains the same work.
|
|
12
|
+
|
|
13
|
+
## Shared application and explicit cleanup
|
|
14
|
+
|
|
15
|
+
Both versions use the same Agent, participant, input and cleanup policy. The
|
|
16
|
+
participant supplies guarded evidence, enters the original transaction and calls
|
|
17
|
+
the one-shot change while that synchronous call remains active. Agent owns its
|
|
18
|
+
execution records and result interpretation. Only a confirmed successful report
|
|
19
|
+
allows this example to release archive history and unload its Agent.
|
|
20
|
+
|
|
21
|
+
For the case-42 report, one Tool call lies between two Provider calls. The archive
|
|
22
|
+
hold is removed only after the report was observed successfully. If unload is
|
|
23
|
+
refused after history removal, the session flag allows a later unload attempt
|
|
24
|
+
without repeating the history decision.
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
# frozen_string_literal: true
|
|
28
|
+
|
|
29
|
+
require "phronomy"
|
|
30
|
+
|
|
31
|
+
module ParticipantApplication
|
|
32
|
+
class CaseLookup < Phronomy::Tool::Base
|
|
33
|
+
tool_name "lookup_case_archive"
|
|
34
|
+
description "Read the local archive entry for case-42"
|
|
35
|
+
|
|
36
|
+
def execute
|
|
37
|
+
"case-42 archive entry"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
class ReportAgent < Phronomy::Agent::Base
|
|
42
|
+
agent_definition id: "participant-case-report", version: 1
|
|
43
|
+
model "gpt-4o-mini"
|
|
44
|
+
provider :openai
|
|
45
|
+
tools CaseLookup => nil
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# The application retains each completed report until an explicit archive
|
|
49
|
+
# decision. Agent still owns execution records and outcome interpretation.
|
|
50
|
+
class CaseArchiveParticipant
|
|
51
|
+
attr_reader :binding, :execution_id, :commits
|
|
52
|
+
|
|
53
|
+
def initialize(store)
|
|
54
|
+
@store = store
|
|
55
|
+
@binding = Phronomy::Agent::ExecutionExtensionState.new(
|
|
56
|
+
binding_key: "case-archive", binding_version: 1
|
|
57
|
+
)
|
|
58
|
+
@owner_key = "case-archive:case-42"
|
|
59
|
+
@commits = Hash.new(0)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def guard_change(change, scope)
|
|
63
|
+
@store.guard_agents(scope, agent_ids: [change.agent_id])
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def change_evidence(change, scope)
|
|
67
|
+
@store.retained_references(agent_id: change.agent_id, scope: scope)
|
|
68
|
+
.select { |hold| hold.owner_key == @owner_key }.map(&:to_h)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def commit(change)
|
|
72
|
+
@execution_id = change.execution_id
|
|
73
|
+
@commits[change.kind] += 1
|
|
74
|
+
change.coordinator.atomic do |scope|
|
|
75
|
+
guard_change(change, scope)
|
|
76
|
+
change.prepare_in(scope)
|
|
77
|
+
if change.finishing?
|
|
78
|
+
@store.retain(Phronomy::Agent::Retention.new(
|
|
79
|
+
agent_id: change.agent_id, execution_id: change.execution_id,
|
|
80
|
+
owner_key: @owner_key
|
|
81
|
+
), scope: scope)
|
|
82
|
+
end
|
|
83
|
+
change.commit_in(scope)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def release_history(agent_id:, execution_id:)
|
|
88
|
+
@store.coordinator.atomic do |scope|
|
|
89
|
+
@store.guard_agents(scope, agent_ids: [agent_id])
|
|
90
|
+
@store.remove_execution_extension(agent_id: agent_id,
|
|
91
|
+
execution_id: execution_id, binding_key: binding.binding_key, scope: scope)
|
|
92
|
+
@store.release_retention(agent_id: agent_id, owner_key: @owner_key, scope: scope)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def self.open_session
|
|
98
|
+
stores = Phronomy::PersistenceComposition.in_memory
|
|
99
|
+
agent = ReportAgent.create(persistence: stores.agent)
|
|
100
|
+
participant = CaseArchiveParticipant.new(stores.agent)
|
|
101
|
+
{agent: agent, stores: stores, participant: participant,
|
|
102
|
+
config: {phronomy_execution_participant: participant,
|
|
103
|
+
cancellation_token: Phronomy::Concurrency::CancellationToken.new},
|
|
104
|
+
history_released: false}
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# This policy is called only after a successful execution observation.
|
|
108
|
+
# It is never used to dispose of an uncertain participant save.
|
|
109
|
+
def self.close_completed_session(work)
|
|
110
|
+
raise ArgumentError, "The execution has not completed" unless work[:state] == :completed
|
|
111
|
+
session = work.fetch(:session)
|
|
112
|
+
unless session[:history_released]
|
|
113
|
+
session.fetch(:participant).release_history(
|
|
114
|
+
agent_id: session.fetch(:agent).agent_id,
|
|
115
|
+
execution_id: work.fetch(:execution_result).fetch(:execution_id)
|
|
116
|
+
)
|
|
117
|
+
session[:history_released] = true
|
|
118
|
+
end
|
|
119
|
+
session.fetch(:agent).unload!
|
|
120
|
+
work.merge(state: :closed)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Complete Before and After invocation
|
|
126
|
+
|
|
127
|
+
Invocation uses the existing public API on both sides. Each returns the exact
|
|
128
|
+
Task and session so a failed observation cannot discard the accepted work.
|
|
129
|
+
The two functions intentionally have the same behavior and source structure.
|
|
130
|
+
|
|
131
|
+
For case-42, either version starts the same report and then passes its retained
|
|
132
|
+
work object to the corresponding observation function below.
|
|
133
|
+
|
|
134
|
+
<table>
|
|
135
|
+
<thead><tr><th>Before</th><th>After</th></tr></thead>
|
|
136
|
+
<tbody><tr><td><pre><code>module ParticipantApplication
|
|
137
|
+
module Before
|
|
138
|
+
def self.start(session, input)
|
|
139
|
+
task = session.fetch(:agent).invoke_async(input, config: session.fetch(:config))
|
|
140
|
+
{session: session, task: task, state: :observing}
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
</code></pre></td><td><pre><code>module ParticipantApplication
|
|
145
|
+
module After
|
|
146
|
+
def self.start(session, input)
|
|
147
|
+
task = session.fetch(:agent).invoke_async(input, config: session.fetch(:config))
|
|
148
|
+
{session: session, task: task, state: :observing}
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
</code></pre></td></tr></tbody>
|
|
153
|
+
</table>
|
|
154
|
+
|
|
155
|
+
## Complete Before and After observation
|
|
156
|
+
|
|
157
|
+
The normal result and a host-side wait timeout keep their existing meanings.
|
|
158
|
+
The changed failure path reports a typed recovery diagnostic and retains the
|
|
159
|
+
original recovery capability. An explicit later observation uses that capability;
|
|
160
|
+
it does not re-run the participant, Provider or Tool. In the injected save-failure
|
|
161
|
+
cases, the original worker returned an unconfirmed save and no complete retained
|
|
162
|
+
proof is available. Fresh reconciliation therefore returns `unavailable` and
|
|
163
|
+
keeps the exact session and responsibility. A positive late terminal-worker
|
|
164
|
+
result can confirm the saved outcome when the original custody and physical
|
|
165
|
+
completion conditions hold; a private replay proof is not required for that
|
|
166
|
+
confirmation. Fresh dispatch still requires current participant authority.
|
|
167
|
+
|
|
168
|
+
For example, the archive transaction may have committed but its response and
|
|
169
|
+
immediate guarded readback are lost. The Before application can only retain its
|
|
170
|
+
failed or unfinished observation. The After application can distinguish the
|
|
171
|
+
retained save responsibility and report the reason a later reconciliation cannot
|
|
172
|
+
resolve it. It cannot declare successful cleanup or an absent business effect.
|
|
173
|
+
|
|
174
|
+
The shown After helper records the reconciliation receipt and deliberately keeps
|
|
175
|
+
the application session held. It does not automatically turn a confirmed late
|
|
176
|
+
terminal receipt into successful application cleanup. Deciding when to consume
|
|
177
|
+
that result and release archive history remains application policy. The separate
|
|
178
|
+
late-worker integration case exercises that additional confirmation path through
|
|
179
|
+
the public recovery API; the example keeps its unresolved-save decision simple.
|
|
180
|
+
|
|
181
|
+
<table>
|
|
182
|
+
<thead><tr><th>Before</th><th>After</th></tr></thead>
|
|
183
|
+
<tbody><tr><td><pre><code>module ParticipantApplication
|
|
184
|
+
module Before
|
|
185
|
+
def self.observe(work, timeout: nil)
|
|
186
|
+
result = work.fetch(:task).wait_result(timeout: timeout)
|
|
187
|
+
work.merge(state: :completed, execution_result: result, observation_error: nil)
|
|
188
|
+
rescue Phronomy::TimeoutError => error
|
|
189
|
+
raise if work.fetch(:task).done?
|
|
190
|
+
work.merge(state: :observing, observation_error: error)
|
|
191
|
+
rescue => error
|
|
192
|
+
# A failed observation is not permission to unload the original session.
|
|
193
|
+
work.merge(state: :observation_failed, observation_error: error)
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
</code></pre></td><td><pre><code>module ParticipantApplication
|
|
198
|
+
module After
|
|
199
|
+
def self.observe(work, timeout: nil)
|
|
200
|
+
result = work.fetch(:task).wait_result(timeout: timeout)
|
|
201
|
+
work.merge(state: :completed, execution_result: result, observation_error: nil)
|
|
202
|
+
rescue Phronomy::Agent::DispatchRecoveryError => error
|
|
203
|
+
work.merge(state: :held, observation_error: error,
|
|
204
|
+
recovery_kind: :dispatch, recovery: error.recovery)
|
|
205
|
+
rescue Phronomy::Agent::OutcomeRecoveryError => error
|
|
206
|
+
work.merge(state: :held, observation_error: error,
|
|
207
|
+
recovery_kind: :outcome, recovery: error.recovery)
|
|
208
|
+
rescue Phronomy::TimeoutError => error
|
|
209
|
+
raise if work.fetch(:task).done?
|
|
210
|
+
work.merge(state: :observing, observation_error: error)
|
|
211
|
+
rescue => error
|
|
212
|
+
work.merge(state: :observation_failed, observation_error: error)
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# A later explicit inspection uses the original capability. This application
|
|
216
|
+
# never retries the participant callback, Provider work or captured writes.
|
|
217
|
+
def self.begin_reconciliation(work)
|
|
218
|
+
agent = work.fetch(:session).fetch(:agent)
|
|
219
|
+
task = case work.fetch(:recovery_kind)
|
|
220
|
+
when :dispatch then agent.reconcile_dispatch_async(recovery: work.fetch(:recovery))
|
|
221
|
+
when :outcome then agent.reconcile_outcome_async(recovery: work.fetch(:recovery))
|
|
222
|
+
else raise ArgumentError, "Unsupported recovery kind"
|
|
223
|
+
end
|
|
224
|
+
work.merge(recovery_task: task)
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
def self.observe_reconciliation(work, timeout: nil)
|
|
228
|
+
receipt = work.fetch(:recovery_task).wait_result(timeout: timeout)
|
|
229
|
+
# This limited synchronous participant has no captured-write replay
|
|
230
|
+
# capability. An unavailable receipt keeps this exact session and owner;
|
|
231
|
+
# it is not successful cleanup or proof that the business result failed.
|
|
232
|
+
work.merge(state: :held, recovery_receipt: receipt, recovery_error: nil)
|
|
233
|
+
rescue Phronomy::TimeoutError => error
|
|
234
|
+
raise if work.fetch(:recovery_task).done?
|
|
235
|
+
work.merge(recovery_error: error)
|
|
236
|
+
rescue => error
|
|
237
|
+
work.merge(state: :held, recovery_error: error)
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
</code></pre></td></tr></tbody>
|
|
242
|
+
</table>
|
|
243
|
+
|
|
244
|
+
The uncertain-save path is an intentional behavior change. Normal input, output,
|
|
245
|
+
ordering, explicit history cleanup and unload remain equivalent. An observation
|
|
246
|
+
failure is not a business failure or permission to release the job. A host wait
|
|
247
|
+
timeout leaves the Task pending; cancelling a Task observation does not itself
|
|
248
|
+
prove worker cancellation or physical completion.
|
|
249
|
+
|
|
250
|
+
## Shared driver and deterministic fixture
|
|
251
|
+
|
|
252
|
+
The driver chooses one complete application version and performs cleanup only
|
|
253
|
+
when that version has observed successful completion. The offline Provider
|
|
254
|
+
fixture supplies two fixed replies and refuses unexpected Provider replay. Its
|
|
255
|
+
lost-reply participant wraps the real transaction rather than fabricating an
|
|
256
|
+
Agent result or a recovery receipt.
|
|
257
|
+
|
|
258
|
+
Running the driver for case-42 produces the same report with either version.
|
|
259
|
+
Selecting `stage: :dispatch` or `stage: :terminal` in the fixture loses one
|
|
260
|
+
successful participant reply and its immediate readback, allowing the caller's
|
|
261
|
+
held state to be inspected without an HTTP service.
|
|
262
|
+
|
|
263
|
+
```ruby
|
|
264
|
+
module ParticipantApplication
|
|
265
|
+
def self.run_example(input, version:, session:, timeout: nil)
|
|
266
|
+
application = case version
|
|
267
|
+
when :before then Before
|
|
268
|
+
when :after then After
|
|
269
|
+
else raise ArgumentError, "Unknown application version"
|
|
270
|
+
end
|
|
271
|
+
work = application.observe(application.start(session, input), timeout: timeout)
|
|
272
|
+
(work[:state] == :completed) ? close_completed_session(work) : work
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
```ruby
|
|
278
|
+
# frozen_string_literal: true
|
|
279
|
+
|
|
280
|
+
require_relative "application"
|
|
281
|
+
|
|
282
|
+
module ParticipantApplication
|
|
283
|
+
module OfflineFixture
|
|
284
|
+
class Adapter < Phronomy::LLMAdapter::Base
|
|
285
|
+
attr_reader :requests
|
|
286
|
+
|
|
287
|
+
def initialize
|
|
288
|
+
@requests = []
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
protected
|
|
292
|
+
|
|
293
|
+
def perform_complete(request, cancellation_token:)
|
|
294
|
+
cancellation_token&.raise_if_cancelled!
|
|
295
|
+
@requests << request
|
|
296
|
+
case @requests.size
|
|
297
|
+
when 1
|
|
298
|
+
Phronomy::LLMAdapter::Response.new(finish_reason: :tool_calls, tool_calls: [
|
|
299
|
+
Phronomy::Tool::CallRequest.new(id: "lookup-case-42",
|
|
300
|
+
name: "lookup_case_archive", arguments: {})
|
|
301
|
+
])
|
|
302
|
+
when 2
|
|
303
|
+
Phronomy::LLMAdapter::Response.new(content: "case-42 report ready", finish_reason: :stop)
|
|
304
|
+
else
|
|
305
|
+
raise "Unexpected Provider replay"
|
|
306
|
+
end
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
# Fault injection belongs to the verification fixture, not business policy.
|
|
311
|
+
# One successful participant transaction loses its reply and its immediate
|
|
312
|
+
# guarded readback. Subsequent reads become available again.
|
|
313
|
+
class LostReplyParticipant
|
|
314
|
+
def initialize(participant, stage:)
|
|
315
|
+
@participant, @stage = participant, stage
|
|
316
|
+
@faulted = @unreadable = false
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
def binding = @participant.binding
|
|
320
|
+
|
|
321
|
+
def commit(change)
|
|
322
|
+
@participant.commit(change)
|
|
323
|
+
return unless change.kind == @stage && !@faulted
|
|
324
|
+
@faulted = @unreadable = true
|
|
325
|
+
raise IOError, "Case archive participant reply was lost"
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
def guard_change(change, scope)
|
|
329
|
+
if @unreadable
|
|
330
|
+
@unreadable = false
|
|
331
|
+
raise IOError, "Case archive immediate readback unavailable"
|
|
332
|
+
end
|
|
333
|
+
@participant.guard_change(change, scope)
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
def change_evidence(change, scope) = @participant.change_evidence(change, scope)
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
# This fixture supplies deterministic Provider responses without HTTP.
|
|
340
|
+
def self.run(version:, stage: nil, timeout: 2)
|
|
341
|
+
adapter = Adapter.new
|
|
342
|
+
Phronomy.configure { |configuration| configuration.llm_adapter = adapter }
|
|
343
|
+
session = ParticipantApplication.open_session
|
|
344
|
+
if stage
|
|
345
|
+
session.fetch(:config)[:phronomy_execution_participant] =
|
|
346
|
+
LostReplyParticipant.new(session.fetch(:participant), stage: stage)
|
|
347
|
+
end
|
|
348
|
+
work = ParticipantApplication.run_example("Prepare case-42 report",
|
|
349
|
+
version: version, session: session, timeout: timeout)
|
|
350
|
+
{work: work, adapter: adapter}
|
|
351
|
+
end
|
|
352
|
+
end
|
|
353
|
+
end
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
## Behavioral contract and verification
|
|
357
|
+
|
|
358
|
+
The executable fixture and application specification verify public behavior on
|
|
359
|
+
the original Runtime, including persistence facts, original Task state, retained
|
|
360
|
+
capability and local custody. Private registry observations and fault injection
|
|
361
|
+
are confined to the specification and are not application dependencies.
|
|
362
|
+
|
|
363
|
+
For example, after a terminal save becomes unobservable, the specification checks
|
|
364
|
+
that a later unavailable result preserves both admission and session, that the
|
|
365
|
+
computed report remains captured, and that reconciliation and retry do not add
|
|
366
|
+
Provider, Tool or participant calls.
|
|
367
|
+
|
|
368
|
+
| Path | Required behavior |
|
|
369
|
+
| --- | --- |
|
|
370
|
+
| Normal Before and After | Same report, two Provider calls, one Tool call, two dispatch participation calls and one terminal participation call; explicit history release and unload succeed. |
|
|
371
|
+
| Save rolled back or committed, immediate proof unreadable | Original observation closes with the existing typed diagnostic; exact capability, session and admission remain. |
|
|
372
|
+
| Original worker returned an unconfirmed save, with no complete retained proof | Reconciliation and retry return unavailable with a reason; no callback, Provider or Tool replay and no successful cleanup claim. A positive late terminal-worker result is a separate confirmation path, subject to current custody and physical completion. |
|
|
373
|
+
| Complete immediate post proof | Adopt the saved outcome once and retain normal execution behavior. |
|
|
374
|
+
| Host wait timeout | Task and physical work remain distinct; a later normal observation can complete. |
|
|
375
|
+
| Cancelled observer and refused late result delivery | The cancelled observer stays closed; fresh dispatch needs current domain proof, including a participant with no extension metadata; confirmed terminal work can be applied without replaying the old observer. |
|
|
376
|
+
| Approval and coordination waits | Preserve their distinct logical states, original cancellation facts and caller errors; resolving a save owner is not completing the logical job. |
|
|
377
|
+
| Ordinary failure or cancellation | Preserve the stored business result and release local execution custody after confirmed termination. |
|
|
378
|
+
|
|
379
|
+
The comparison uses seven complete source units. Concatenate shared setup,
|
|
380
|
+
Before start, After start, Before observation, After observation and driver with
|
|
381
|
+
one newline between units as `application.rb`; put the final fixture beside it
|
|
382
|
+
as `offline_fixture.rb`. These are the exact files under
|
|
383
|
+
`spec/fixtures/synchronous_participant/`. The application specification is
|
|
384
|
+
`spec/phronomy/agent/synchronous_participant_application_spec.rb`.
|
|
385
|
+
|
|
386
|
+
Baseline characterization uses commit
|
|
387
|
+
`ba0ee79c90298895e991f8b295772513c6237233`: one normal success and two intentional
|
|
388
|
+
uncertain-save gaps. That is not three successful recovery cases. Candidate
|
|
389
|
+
execution evidence binds the complete source, fixture and specifications to the
|
|
390
|
+
reviewed inputs. The development records remain separate from final acceptance.
|
|
391
|
+
These in-memory and deterministic tests do not prove arbitrary participants,
|
|
392
|
+
all storage backends, process-loss recovery or stopped-Runtime management.
|
|
393
|
+
|
|
394
|
+
The benefit is consistent observation and responsibility handling across failure
|
|
395
|
+
paths. Application history policy, unsupported recovery handling and later
|
|
396
|
+
operational decisions remain explicit. This change does not claim fewer
|
|
397
|
+
application lines or a universal retry API.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Synchronous participant changes and retained Agent responsibility
|
|
2
|
+
|
|
3
|
+
Agent owns an accepted execution and its observations. A synchronous participant
|
|
4
|
+
owns the domain records that join one Agent persistence change. Sharing that
|
|
5
|
+
transaction does not give Agent permission to repeat the participant's business
|
|
6
|
+
callback, and a failed observation does not release the accepted execution.
|
|
7
|
+
|
|
8
|
+
For example, an audit participant can save a report and its audit hold in one
|
|
9
|
+
transaction. If the save reply and immediate readback are lost, the caller needs
|
|
10
|
+
a diagnostic while the original Agent keeps the report, control identity and
|
|
11
|
+
unresolved save responsibility. Calling the audit callback again is not a safe
|
|
12
|
+
way to discover what happened.
|
|
13
|
+
|
|
14
|
+
The implementation baseline is `ba0ee79c90298895e991f8b295772513c6237233`.
|
|
15
|
+
Contract concept v55 and foundation v48 define the responsibility boundaries.
|
|
16
|
+
This account describes U-06; the delivery evidence identifies the exact tested
|
|
17
|
+
candidate and distinguishes local validation from application acceptance. The
|
|
18
|
+
[complete application comparison](synchronous-participant-application.md) keeps
|
|
19
|
+
normal invocation, failure observation, retained resources and cleanup visible.
|
|
20
|
+
|
|
21
|
+
## One synchronous change and its evidence
|
|
22
|
+
|
|
23
|
+
A participant may mutate the Agent change only while its original synchronous
|
|
24
|
+
call is active, on the original thread and coordinator, using the prepared scope
|
|
25
|
+
once. The comparison retains independent values from each observation, so a later
|
|
26
|
+
read cannot modify the evidence against which it is compared.
|
|
27
|
+
|
|
28
|
+
For example, reusing a Hash for successive audit snapshots must not make a deleted
|
|
29
|
+
hold appear to match the originally saved hold. Likewise, a callback that failed
|
|
30
|
+
before preparation cannot keep its change and perform the write after returning.
|
|
31
|
+
|
|
32
|
+
`ExecutionChange#perform` establishes the active call boundary. `prepare_in`,
|
|
33
|
+
`commit_in`, `transfer_context` and private native preparation enforce that
|
|
34
|
+
boundary. A rejected nested `perform` does not end the outer call's permission.
|
|
35
|
+
The existing thread, coordinator, prepared-scope, watermark, revision and
|
|
36
|
+
single-use checks remain necessary within that boundary.
|
|
37
|
+
|
|
38
|
+
`change_evidence` returns the JSON value declared by the public SPI. Each value
|
|
39
|
+
is validated and detached when captured; the framework also detaches the complete
|
|
40
|
+
Agent footprint. Root, execution, journal, extension content, cancellation intent
|
|
41
|
+
and participant evidence remain part of the comparison. Cyclic or unsupported
|
|
42
|
+
evidence is rejected rather than retained by mutable identity. A matching Agent
|
|
43
|
+
revision alone does not establish the full post-state.
|
|
44
|
+
|
|
45
|
+
An inner savepoint may make provisional writes, but cannot authorize publication
|
|
46
|
+
or continuation. Its enclosing caller might later commit or roll back; an error
|
|
47
|
+
from the inner call is not proof that those provisional writes disappeared.
|
|
48
|
+
Immediate comparison requires the actual outer transaction and truthful,
|
|
49
|
+
authoritative evidence. No synchronous callback replay is introduced.
|
|
50
|
+
|
|
51
|
+
## Custody is independent of replay permission
|
|
52
|
+
|
|
53
|
+
The existing Agent dispatch and outcome owners retain an uncertain accepted
|
|
54
|
+
operation even when its participant has no private persistence replay adapter.
|
|
55
|
+
The owner closes the original observation with a typed diagnostic and provides
|
|
56
|
+
the existing explicit recovery observation surface. A new observation neither
|
|
57
|
+
reopens the old caller nor acquires additional business authority.
|
|
58
|
+
|
|
59
|
+
For example, an ordinary audit participant can leave an outcome in an unknown
|
|
60
|
+
state. `pending_outcome_recovery` finds the exact retained owner; a subsequent
|
|
61
|
+
`reconcile_outcome` or `retry_outcome` returns `unavailable` with an unsupported
|
|
62
|
+
proof explanation if neither complete supported proof nor a successful original
|
|
63
|
+
worker result is available. The participant callback and the report Tool are not
|
|
64
|
+
executed again, and the job remains retained.
|
|
65
|
+
|
|
66
|
+
| Boundary | Retained behavior | Permission that is not inferred |
|
|
67
|
+
| --- | --- | --- |
|
|
68
|
+
| Provider or Tool dispatch preparation | Existing `DispatchRecoveryOperation`, original command, controls, session and observer failure | A late successful worker does not authorize fresh domain continuation without current supported proof. This includes a participant with no persisted execution extension. |
|
|
69
|
+
| Final, failed, cancelled, waiting or handed-off outcome | Existing `OutcomeRecoveryOperation`, original semantic outcome, captured persisted observation and cancellation fact | A captured proposal or readable Agent result alone does not prove the participant transaction committed. |
|
|
70
|
+
| Positive refusal before a dispatch barrier | Existing `not_prepared` transition transfers the original setup failure to terminal handling | No new dispatch submission-retry API is added. |
|
|
71
|
+
| Positive refusal of an outcome worker | Existing `retry_outcome_submission` may submit the original worker for its first execution | Unknown submission is not refusal and cannot be resubmitted. |
|
|
72
|
+
| Native participant with supported complete persistence proof | Existing bounded comparison and captured-write retry | No Provider, Tool, hook, encoder or arbitrary participant callback replay. |
|
|
73
|
+
|
|
74
|
+
Normal successful dispatch retains its existing continuation. Once a continuation
|
|
75
|
+
has already been authorized, its existing delivery protocol remains in force.
|
|
76
|
+
A later request to grant new continuation must validate the participant or child
|
|
77
|
+
domain's current authority; a historical worker result cannot replace that check.
|
|
78
|
+
|
|
79
|
+
For outcomes, a successful worker or supported complete post-proof confirms the
|
|
80
|
+
save. The semantic result and the `ExecutionObservation` decoded from captured
|
|
81
|
+
content bytes are retained independently of replay capability. A rollback with a
|
|
82
|
+
captured answer is still unconfirmed. A confirmed late outcome may be applied once
|
|
83
|
+
under current ownership without invoking the old event listener again.
|
|
84
|
+
|
|
85
|
+
## Preserve each outcome and the original owner
|
|
86
|
+
|
|
87
|
+
The same custody rules apply across actual termination, saved waits and Source
|
|
88
|
+
handoff, while each keeps its own result meaning. An accepted setup failure also
|
|
89
|
+
needs an owner even if a live execution session could not be installed.
|
|
90
|
+
|
|
91
|
+
For example, saving an approval wait does not finish the Agent job. A Source
|
|
92
|
+
handoff retains its actual transfer receipt and ordinary Handoff event payload;
|
|
93
|
+
it does not claim the Target completed. If session installation fails, the
|
|
94
|
+
terminal save retains the original admission token instead of inventing a session.
|
|
95
|
+
|
|
96
|
+
The outcome owner preserves the cancellation fact captured under transaction
|
|
97
|
+
guards independently of a private replay proof. An approval or coordination wait
|
|
98
|
+
therefore does not lose a durable cancellation merely because the caller's token
|
|
99
|
+
has not been signalled. The original semantic exception and business result remain
|
|
100
|
+
separate from an observation or recovery error.
|
|
101
|
+
|
|
102
|
+
For `state_required: false`, the token stays with the EventLoop owner and does not
|
|
103
|
+
enter the immutable worker command. Registry retention requires the exact Agent,
|
|
104
|
+
coordinator, execution and admission token, plus positive absence of a live
|
|
105
|
+
session. Recovered preparing work passes its existing admission into this path.
|
|
106
|
+
Application and release recheck the same retained entry, token, live root and
|
|
107
|
+
journal, and physical completion. A replacement session or changed authority
|
|
108
|
+
prevents release. Per-invocation participant wiring is preserved through setup
|
|
109
|
+
failure instead of falling back to unrelated Agent-level configuration.
|
|
110
|
+
|
|
111
|
+
## Prepare an approval before choosing its outcome
|
|
112
|
+
|
|
113
|
+
An opting-in participant checks the approval display after its domain guards
|
|
114
|
+
and `prepare_in(scope)`, while the original outer transaction is active and
|
|
115
|
+
before changing its own records. `prepare_approval_in(scope)` verifies the
|
|
116
|
+
Agent revision and the participant's captured evidence. The framework runs
|
|
117
|
+
the original display projection once and uses the prepared display for the
|
|
118
|
+
durable request and its notification. The original Tool arguments remain the
|
|
119
|
+
authority for later execution.
|
|
120
|
+
|
|
121
|
+
For example, a routing review can display a warehouse label while the approved
|
|
122
|
+
Tool continues to receive the original destination. If the label projection
|
|
123
|
+
fails, the participant can retain an outstanding routing hold or explicitly
|
|
124
|
+
finish when its guarded records show it owns no remaining work.
|
|
125
|
+
|
|
126
|
+
| Result | Choices in the same scope |
|
|
127
|
+
| --- | --- |
|
|
128
|
+
| `:not_requested` | Continue the ordinary participant protocol. A participant already waiting for cancellation of its own work can choose that wait before calling the display projection. |
|
|
129
|
+
| `:ready` | Commit the original approval wait using its canonical display. |
|
|
130
|
+
| `:invalid` | Finish with the established display validation failure, or commit `pending: true` to retain participant work. `finishing?` reflects the validation failure. |
|
|
131
|
+
| `:unavailable` | Commit a wait with `pending: true`, or explicitly finish the display failure with `fail_unavailable_approval: true` once the participant has established its own completion. With neither choice, the original exception aborts the transaction and the execution is retained for observation. |
|
|
132
|
+
|
|
133
|
+
An unavailable display establishes preparation failure, independent of the
|
|
134
|
+
Tool's approval decision. An explicit terminal failure preserves the original
|
|
135
|
+
exception as its cause. A coordination wait advances only its own durable
|
|
136
|
+
records and keeps the job active. Neither produces an approval notification.
|
|
137
|
+
Separate control paths still own any unfinished participant work. A lost save
|
|
138
|
+
reply uses the existing guarded readback, without rerunning the projection or
|
|
139
|
+
the participant callback. An unsupported ambiguous save retains custody.
|
|
140
|
+
|
|
141
|
+
## Lifecycle responsibilities and synchronization
|
|
142
|
+
|
|
143
|
+
The five lifecycle viewpoints apply to these separate participants and owners.
|
|
144
|
+
Common execution machinery maintains trial and observation facts; each domain
|
|
145
|
+
still decides whether a save, continuation or release is permitted.
|
|
146
|
+
|
|
147
|
+
For example, an observer can stop waiting during a saved outcome. That closes one
|
|
148
|
+
observation, while the Agent still owns the accepted job and the worker still has
|
|
149
|
+
its own physical lifetime. None of those facts alone authorizes cleanup.
|
|
150
|
+
|
|
151
|
+
| Viewpoint | Rule enforced here |
|
|
152
|
+
| --- | --- |
|
|
153
|
+
| Admission | Preserve the original accepted execution and distinguish worker refusal from unknown admission. |
|
|
154
|
+
| Progress | Apply a confirmed outcome once; authorize fresh dispatch only with current domain authority. |
|
|
155
|
+
| Control | Preserve the original controls and captured cancellation; do not let a fresh observer replace them. |
|
|
156
|
+
| Observation | Close the original caller with a diagnostic and use a separate observation for later reconciliation. |
|
|
157
|
+
| Termination | Separate the job's result, physical completion and the release of its retained responsibility. |
|
|
158
|
+
|
|
159
|
+
C04 Agent owns the synchronous change, dispatch/outcome owners and live application.
|
|
160
|
+
C01 or another participant domain owns its guards and records. C07 supplies
|
|
161
|
+
transactions and `SaveOutcome`; C13 supplies the existing `RetainedAttempts` and
|
|
162
|
+
`AttemptCompletion`. No new general manager, worker, public SPI or mutex
|
|
163
|
+
construction site is introduced by this connection.
|
|
164
|
+
|
|
165
|
+
More phases now allocate the existing recovery owner, including its existing
|
|
166
|
+
mutex. That allocation increase is intentional: worker publication, task callback
|
|
167
|
+
facts, caller observation and EventLoop application share state. The owner and its
|
|
168
|
+
attempt records use the same mutex, while task calls, notification and I/O remain
|
|
169
|
+
outside it. Reusing a mutex is not evidence that synchronization is free or that
|
|
170
|
+
all surrounding locks are minimal. Whole-cohort code and allocation effects are
|
|
171
|
+
reported separately from the earlier common-code reduction.
|
|
172
|
+
|
|
173
|
+
## Acceptance and remaining limits
|
|
174
|
+
|
|
175
|
+
Acceptance requires actual source behavior, complete application examples and
|
|
176
|
+
bounded model checks to agree on lifetime, evidence, custody and publication.
|
|
177
|
+
Positive cases and intentionally unresolved cases have different success criteria.
|
|
178
|
+
|
|
179
|
+
For example, retaining an unsupported unknown save and returning `unavailable`
|
|
180
|
+
passes a custody test, but does not establish eventual job completion or successful
|
|
181
|
+
cleanup. A model counterexample caused by removing physical-return fairness is
|
|
182
|
+
evidence of that premise, not a repaired implementation defect.
|
|
183
|
+
|
|
184
|
+
The new [synchronous participant model](../../spec/models/synchronous_participant/README.md)
|
|
185
|
+
separates Agent custody and caller observation. Ruby tests cover invalid use,
|
|
186
|
+
detached evidence, generic dispatch/outcome uncertainty, late completion,
|
|
187
|
+
sessionless admission, saved waits and Handoff compatibility. Exact commands,
|
|
188
|
+
inputs, results and limits belong to the delivery evidence; this document does
|
|
189
|
+
not assert that every backend or future participant has been verified.
|
|
190
|
+
|
|
191
|
+
U-05 result preparation, U-01 all-path conformance, failed-Runtime administration,
|
|
192
|
+
process-loss recovery, unsupported domain proof and external side-effect resolution
|
|
193
|
+
remain separate. Truthful participant evidence, valid transaction atomicity and
|
|
194
|
+
the declared execution environment remain premises. No unconditional eventual
|
|
195
|
+
release or formal refinement proof for all Ruby behavior is claimed.
|