From e26db264f32e677733d19107d2d89a73a9e0a378 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Fri, 30 Oct 2026 06:51:15 -0400 Subject: [PATCH 1/3] Borrow the retained coordinator reader for context annotations --- src/toad/core/context_inspection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/toad/core/context_inspection.py b/src/toad/core/context_inspection.py index bda453d71..da50ed3bd 100644 --- a/src/toad/core/context_inspection.py +++ b/src/toad/core/context_inspection.py @@ -539,7 +539,7 @@ def read( page = comms.contexts.page(owner, comms.registry, cursor=cursor, previous=previous) annotations = WorkingMemoryAnnotations.for_context( - comms.root / "coordination.sqlite3", + comms.registry.store.coordinator_reader, tuple(resource.value for resource in page.resources), JevClassifier.version()) imported = ImportedSessionMetadata.sources_for_owner(comms.registry, thread) inspection_type = ThreadInspectionSource().project_value(entry.status) From ff2f19494f594af283fd43c1eb2c90dd9f5ac6c5 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Fri, 30 Oct 2026 07:49:54 -0400 Subject: [PATCH 2/3] Pass retained owner incarnation to context requests --- src/toad/core/context_inspection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/toad/core/context_inspection.py b/src/toad/core/context_inspection.py index da50ed3bd..910e13636 100644 --- a/src/toad/core/context_inspection.py +++ b/src/toad/core/context_inspection.py @@ -622,7 +622,7 @@ async def _request(self, action: str, **parameters: JsonValue | tuple[int, ...]) if owner.incarnation != self.owner.incarnation: raise ValueError("Selected context thread incarnation changed") process = owner.require_process() - connection = RuntimeConnection(self.service, owner.name, socket_path(self.service.root, process.pid)) + connection = RuntimeConnection(self.service, owner.incarnation, socket_path(self.service.root, process.pid)) try: return await connection.request(action, **parameters) finally: From bcc8ce70b9cf78f64d0c9136e9ff0e4288d0caa8 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Fri, 30 Oct 2026 09:23:12 -0400 Subject: [PATCH 3/3] Use incarnation-bound owner requests and native response declarations --- src/toad/acp/agent_controller.py | 9 +++------ src/toad/core/context_inspection.py | 2 +- src/toad/owner_preparation.py | 12 ------------ 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/toad/acp/agent_controller.py b/src/toad/acp/agent_controller.py index 91057609d..bee74363d 100644 --- a/src/toad/acp/agent_controller.py +++ b/src/toad/acp/agent_controller.py @@ -21,6 +21,7 @@ ) from agent_comms.acp_failure import ACPFailure, RequestFailure from agent_comms.coordination_errors import Refused +from agent_comms.runtime import RuntimeConnection, socket_path from agent_comms.transcripts import TranscriptReadIdentity from agent_comms.ui_model.delivery import DeliveryView from agent_comms.ui_model.observation import ReadDeliveryOverview @@ -390,10 +391,6 @@ async def _cancel_prompt(self, authority: ClientSessionRequest): async def request_owner(self, method: str, **params: JsonValue): if self.coordination is None: raise ValueError("This action requires an agent-comms thread.") - from agent_comms.runtime import RuntimeProxy, socket_path - - from toad.owner_preparation import OwnerRequestContext - coordination = self.coordination authority = ClientSessionRequest(self.agent, self.agent.session_id) self.require_owner(coordination, authority) @@ -403,8 +400,8 @@ def resolve(): owner = comms.registry.require(coordination.thread.name) if owner.incarnation != coordination.thread: raise ValueError("The owner incarnation changed while preparing the request.") - return RuntimeProxy( - OwnerRequestContext(comms), owner.name, socket_path(comms.root, owner.require_process().pid) + return RuntimeConnection( + comms, owner.incarnation, socket_path(comms.root, owner.require_process().pid) ) proxy = await asyncio.to_thread(resolve) diff --git a/src/toad/core/context_inspection.py b/src/toad/core/context_inspection.py index 910e13636..bdbcee116 100644 --- a/src/toad/core/context_inspection.py +++ b/src/toad/core/context_inspection.py @@ -15,7 +15,7 @@ from agent_comms.field_codec import FieldCodec from agent_comms.importing import ImportedSessionMetadata from metaclass_registry.mro_dispatch import handles -from agent_comms.native_turn_context import NativeContextData +from agent_comms.pi_payloads import NativeContextData from agent_comms.pi_payloads import PiMessage from agent_comms.presentation import ReadState from agent_comms.registry_document import RegistryEntry diff --git a/src/toad/owner_preparation.py b/src/toad/owner_preparation.py index 559d689f2..6e1e41886 100644 --- a/src/toad/owner_preparation.py +++ b/src/toad/owner_preparation.py @@ -62,18 +62,6 @@ def from_binding(cls, binding: ThreadOwnerBinding) -> OwnerPlan: return cls().project_value(binding) -@dataclass(frozen=True, slots=True) -class OwnerRequestContext: - """Supply the core proxy's service contract without capturing a UI widget. - - The proxy still resolves and validates the live owner before sending. This - object supplies only the revision-aware reader, never cached goal/delivery - state or an alternative authority for request routing. - """ - - _comms: Comms - - def read_thread_presentation(comms: Comms, name: str) -> ThreadPresentation: """Read the existing core presentation on a worker, without UI dependencies.""" return comms.views.thread_presentations((name,)).read(name)