The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(gateway): drop the unread LiveSession.paused reason; the notice flag is the state
teknium1382a318b6920
diff --git a/gateway/session_authority.py b/gateway/session_authority.pyindex 7853f83369a..3f4e56503fc 100644--- a/gateway/session_authority.py+++ b/gateway/session_authority.py@@ -31,9 +31,8 @@ class LiveSession:subscribers: dict = field(default_factory=dict)event_stream: SessionEvents = field(default_factory=SessionEvents)controls: PendingControls = field(init=False)- # Why the FIFO is not advancing (unknown head, preflight refusal) or None. The- # messaging ingress tells the platform user once per pause episode, not per message.- paused: str | None = None+ # The messaging ingress tells the platform user once per pause episode (unknown head,+ # preflight refusal), not per message; the drain clears it when the FIFO moves again.pause_notified: bool = Falsedef __post_init__(self):@@ -213,8 +212,6 @@ class SessionAuthority:drain; only the process-local messaging delivery waiters on this session are released,with the reason instead of a reply, so an adapter loop is never parked on a turn thatwill not run. The ingress turns that refusal into one user-facing notice per episode."""- live = self.sessions[ref.session_id]- live.paused = reasonfor row in list_session_admissions(self.db, session_id=ref.session_id):admission_id = row['admission_id']if admission_id not in self.native_waiters:@@ -481,7 +478,6 @@ class SessionAuthority:self._pause(ref, exc.reason)return# The FIFO is moving again (or empty): the next pause is a new episode.- live.paused = Nonelive.pause_notified = Falseif row is None:returndiff --git a/tests/gateway/test_native_pause_notice.py b/tests/gateway/test_native_pause_notice.pyindex f7a2a36273d..2ba4abc145f 100644--- a/tests/gateway/test_native_pause_notice.py+++ b/tests/gateway/test_native_pause_notice.py@@ -55,7 +55,7 @@ async def test_paused_fifo_releases_the_messaging_waiter_with_one_notice_per_epi'session_id': 's', 'admission_id': unknown['admission_id'], 'execution_generation': unknown['generation']}})await asyncio.wait_for(authority.sessions['s'].task, 5)assert executed == ['FOLLOWER', 'one', 'two']- assert authority.sessions['s'].paused is None and not authority.sessions['s'].pause_notified+ assert not authority.sessions['s'].pause_notifiedawait viewer.close()finally:store.close_all_db_handles()