The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: retain public queued input identity in shared snapshots
Teknium37332c17b113
diff --git a/gateway/session_authority.py b/gateway/session_authority.pyindex 50693039f6f..be55474771d 100644--- a/gateway/session_authority.py+++ b/gateway/session_authority.py@@ -10,7 +10,7 @@ from dataclasses import dataclass, fieldimport uuidfrom gateway.session_contract import (- AdmissionReceipt, Principal, SessionHandle, SessionRef, Submission,+ AdmissionReceipt, PendingAdmission, Principal, SessionHandle, SessionRef, Submission,SubscriptionSnapshot,)from gateway.session_events import SessionEvents@@ -108,7 +108,7 @@ class SessionAuthority:epoch, sequence = live.event_stream.watermark()return SubscriptionSnapshot(subscription, handle, epoch,sequence, tuple(self.db.get_messages_as_conversation(ref.session_id)),- tuple(self._receipt(r) for r in list_session_admissions(+ tuple(self._pending_receipt(r) for r in list_session_admissions(self.db, session_id=ref.session_id)), prompts)async def detach(self, actor, subscription_id):@@ -128,6 +128,15 @@ class SessionAuthority:row['seq'], row['status'], row['outcome'],row['owner_epoch'] or self.epoch, row['generation'])+ def _pending_receipt(self, row):+ # Only public input text crosses the viewer boundary, never the+ # private native envelope's routing or authorization provenance.+ payload = row['payload']+ text = payload.get('text')+ if text is None:+ text = payload.get('native_text_v1', {}).get('event', {}).get('text', '')+ return PendingAdmission(**vars(self._receipt(row)), input_id=row['request_id'], text=text)+def _schedule(self, ref):live = self.sessions[ref.session_id]if live.task is None or live.task.done():diff --git a/gateway/session_contract.py b/gateway/session_contract.pyindex 46f6c87df44..9a2dce031c7 100644--- a/gateway/session_contract.py+++ b/gateway/session_contract.py@@ -57,6 +57,12 @@ class AdmissionReceipt:execution_generation: int | None+@dataclass(frozen=True)+class PendingAdmission(AdmissionReceipt):+ input_id: str+ text: str++@dataclass(frozen=True)class SubscriptionSnapshot:subscription_id: str@@ -64,7 +70,7 @@ class SubscriptionSnapshot:replay_epoch: strlast_sequence: inthistory: tuple[JsonObject, ...]- pending: tuple[AdmissionReceipt, ...]+ pending: tuple[PendingAdmission, ...]prompts: tuple[JsonObject, ...]diff --git a/tests/gateway/fixtures/shared_authority_peer.py b/tests/gateway/fixtures/shared_authority_peer.pyindex 0275510a2fe..1dd9c27e3c1 100644--- a/tests/gateway/fixtures/shared_authority_peer.py+++ b/tests/gateway/fixtures/shared_authority_peer.py@@ -197,6 +197,13 @@ async def probe():assert envelope is not None, 'ACK has no durable native source envelope'assert envelope['source']['user_id'] == 'fixture-user'assert envelope['route'] == entry.session_key+ await ws.send(json.dumps({'jsonrpc': '2.0', 'id': 'queue-snapshot',+ 'method': 'session.resume', 'params': {'session_id': entry.session_id}}))+ projected = (await until(lambda f: f.get('id') == 'queue-snapshot'))['result']['pending']+ visible = next(r for r in projected if r['admission_id'] == queued_row['admission_id'])+ assert visible['text'] == 'FIFO_SECOND' and visible['input_id'] == 'fifo-2', visible+ assert not {'payload', 'native_text_v1', 'source', 'principal_id'} & visible.keys(), visible+ receipt['queue_snapshot_text'] = visible['text']queued_event.text = 'MUTATED_AFTER_ACK'queued_event.source = SessionSource(platform=Platform.TELEGRAM, chat_id='wrong-chat', user_id='foreign')finally:diff --git a/website/docs/developer-guide/gateway-internals.md b/website/docs/developer-guide/gateway-internals.mdindex d99704ff734..63d84f3f149 100644--- a/website/docs/developer-guide/gateway-internals.md+++ b/website/docs/developer-guide/gateway-internals.md@@ -8,6 +8,15 @@ description: "How the messaging gateway boots, authorizes users, routes sessionsThe messaging gateway is the long-running process that connects Hermes to 20+ external messaging platforms through a unified architecture.+## Shared authority pending-input snapshots++`session.resume` returns each pending admission with its original `input_id` and+committed public `text`, alongside the canonical `admission_id`, sequence and status.+This includes native messaging inputs and local-client inputs. Snapshots do not expose+private native routing, source, or authorization envelopes. Submission and receipt+ACKs retain their existing shape. Clients must use `admission_id` for cancellation+and receipt queries rather than assuming it equals the original input ID.+## Shared authority setup readinessAuthenticated local clients can call `setup.status` and `setup.runtime_check` before