From 1e90500e5b814d125e848a4cc36c30b37475b218 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Sat, 28 Nov 2026 10:30:37 -0500 Subject: [PATCH] Cut 11: decouple native_arguments from team.rule_deal (-16 mods) and remove dead PrivateRegistry.path_in in goal_history --- src/agent_comms/execution/native_arguments.py | 18 ++++++++++++------ src/agent_comms/planning/goal_history.py | 8 +------- src/agent_comms/team/rule_deal.py | 6 +++++- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/agent_comms/execution/native_arguments.py b/src/agent_comms/execution/native_arguments.py index 24777b0807..68de64c789 100644 --- a/src/agent_comms/execution/native_arguments.py +++ b/src/agent_comms/execution/native_arguments.py @@ -9,10 +9,10 @@ from abc import ABC, abstractmethod from collections.abc import AsyncIterator, Callable, Iterator, Mapping, Sequence from contextlib import AbstractAsyncContextManager, asynccontextmanager -from dataclasses import dataclass, replace +from dataclasses import dataclass from functools import reduce from pathlib import Path -from typing import TYPE_CHECKING, ClassVar +from typing import TYPE_CHECKING, ClassVar, Self from agent_comms.coordination.errors import IdentityConflict from agent_comms.execution.context_sizes import ContextSizes @@ -20,7 +20,6 @@ from agent_comms.execution.pi_vocabulary import NoThinkingOverride, ThinkingChoice, ThinkingLevel from agent_comms.nominal.declared_family import DeclaredFamily from agent_comms.nominal.field_codec import FieldCodec, NullMember, SingleFieldValue, SubclassUnion -from agent_comms.team.rule_deal import OffDealMode, UndealtRecord from agent_comms.transport.native_tool_mode import NativeToolMode if TYPE_CHECKING: @@ -196,6 +195,13 @@ async def slot_turn( TurnHost.here = ClientHost() +class UndealtRuleDeal(ABC): + """A session's undealt rule-gate record, owning how it disables its own mode.""" + + @abstractmethod + def disabled(self) -> Self: ... + + class ModelProvider(DeclaredFamily, affix="Provider"): """Provider declarations own the native extensions and the action space their models require.""" @@ -222,7 +228,7 @@ def native_tool_mode(cls, mode: NativeToolMode, owner: CodingToolOwner) -> Nativ return mode @classmethod - def undealt(cls, record: UndealtRecord) -> UndealtRecord: + def undealt[Record: UndealtRuleDeal](cls, record: Record) -> Record: """The rule-gate settings a never-dealt thread on this provider starts from.""" return record @@ -329,11 +335,11 @@ def native_tool_mode(cls, mode: NativeToolMode, owner: CodingToolOwner) -> Nativ return ContextLanguageModelMode(owner) @classmethod - def undealt(cls, record: UndealtRecord) -> UndealtRecord: + def undealt[Record: UndealtRuleDeal](cls, record: Record) -> Record: """No papers, rules or audit by default (Tristan, 2026-11-20): the deal is context the checkpoint never saw and its window cannot hold, and its audit is not its protocol.""" - return replace(record, mode=OffDealMode) + return record.disabled() # The conversations' recorded contexts and the slot's holder: durable state, outside the # bus root, which is carried between bus versions by its own roster. diff --git a/src/agent_comms/planning/goal_history.py b/src/agent_comms/planning/goal_history.py index 0de1bcc351..02a799e541 100644 --- a/src/agent_comms/planning/goal_history.py +++ b/src/agent_comms/planning/goal_history.py @@ -20,7 +20,6 @@ from agent_comms.planning.goal_scope import GoalScope from agent_comms.planning.goals import GoalDeclaration, NoGoal from agent_comms.planning.recorded_goal_revision import RecordedGoalRevision, RevisionKind -from agent_comms.registry.registry_privacy import PrivateRegistry from agent_comms.storage.locked_store import DurableFile from agent_comms.storage.store_files import AtomicFile from agent_comms.storage.typed_table import ( @@ -224,13 +223,8 @@ def _transaction(self) -> Iterator[GoalHistoryTransaction]: def _sync_visible_registry(self) -> None: """Adopt a visible post-crash registry value before attesting an intent.""" - targets = [self.registry_path] - guard = PrivateRegistry.path_in(self.registry_path.parent) - if guard.exists(): - targets.append(guard) try: - for target in targets: - AtomicFile(target).sync() + AtomicFile(self.registry_path).sync() except OSError as error: raise GoalHistoryError("Cannot sync visible goal authority.") from error diff --git a/src/agent_comms/team/rule_deal.py b/src/agent_comms/team/rule_deal.py index 1850987826..afc72b9ff2 100644 --- a/src/agent_comms/team/rule_deal.py +++ b/src/agent_comms/team/rule_deal.py @@ -34,6 +34,7 @@ from agent_comms.execution.compaction_redeal import CompactionRedeal from agent_comms.execution.context_reading import ContextUsage +from agent_comms.execution.native_arguments import UndealtRuleDeal from agent_comms.nominal.configuration_record import ConfigurationRecord from agent_comms.nominal.declared_family import DeclaredFamily from agent_comms.nominal.field_codec import ( @@ -841,12 +842,15 @@ def while_supplied(self) -> DealRecord: @dataclass(frozen=True) -class UndealtRecord(DealRecord): +class UndealtRecord(DealRecord, UndealtRuleDeal): """The record of a session with no deal on disk: nothing dealt, nothing due.""" dealt: tuple[Path, ...] = () due: AuditDue = AuditDue(()) + def disabled(self) -> Self: + return replace(self, mode=OffDealMode) + def for_model(self, provider) -> DealRecord: """A session never dealt starts from its model's defaults (ModelProvider.undealt).""" return provider.undealt(self)