Skip to content

The agent that grows with you

Merge origin/main into fix/pkg10-messaging

Teknium213bf39a851b
diff --cc gateway/session_authority.py
index 911178b3558,93a891be909..938a696ac67
--- a/gateway/session_authority.py
+++ b/gateway/session_authority.py
@@@ -63,11 -58,11 +63,14 @@@ class LiveSession
# (a contended SQLite writer must not stall loop-side lock takers); readers holding that lock
# still see the claim as started, so no snapshot shows a terminal row without its completion.
settling: dict = field(default_factory=dict)
+ # ``(revision key, payload)`` of the last ``session.context_breakdown``: Desktop re-polls it on
+ # every idle mount and reconnect, and a rebuild walks the whole stored transcript (#140667).
+ context_breakdown: tuple | None = None
# A viewer attached while a guarded deferred pick awaits consent: the next boundary asks again.
reask_pick: bool = False
+ # (principal, effort) of a ``/reasoning`` command that arrived while a turn ran: applied in memory at
+ # once, committed to the policy at the next boundary (gateway/session_setting_commands.py).
+ pending_reasoning: tuple | None = None
# A historic messaging row mounted for reading after its lane moved on (``/new``): ``route`` is
# the lane's CURRENT key, which names another conversation, so nothing route-keyed (agent, Stop,
# turns, eviction) may act through it (gateway/session_route_recovery.py). The lane publishing
@@@ -154,12 -130,9 +157,15 @@@ class SessionAuthority
# Logical owner rotated away by the exhaustion auto-reset -> its session key: an admission
# that reserved it before the rotation commits on that key's current route instead.
self.rotated_owners = {}
+ # Route key -> [lock, holder + waiters] of the native admissions in flight (``_route_turn``, ``keyed_turn``).
+ self._route_turns = {}
+ # Per route: how many messaging /stop and /new fenced it (``fence_route``). Kept for the
+ # owner's life (one int per chat that ever got one): an input or command turn holding an older
+ # value never commits, and a reset entry could read as an old epoch again.
+ self._route_epochs = {}
+ # route -> the compression-exhaustion auto-reset its LOCAL turn deferred: the store refuses a
+ # reset while that turn's admission is started, so the drain runs it once the turn settles.
+ self.deferred_resets = {}
def authorize(self, actor, ref, capability):
"""Every handler calls this first, so a later ``self.sessions[ref.session_id]`` is