refactor(gateway): keep operator authority fixed per request (#201334) Problem: a role edit during an admitted Gateway operator turn aborted that turn. The operator authority subscribed to role, profile, device and membership changes and revoked the running request, so downstream effects failed with "agent runtime authority is no longer active" (25 logged on one host in four days). Fix: operator authority is checked once when a request starts and stays fixed for that request (role, scopes, model ceiling, session-sharing policy facts). Role, device, membership and policy changes apply to the next request. Every new start re-checks once through `reauthorize`: queued input at adoption, a returned child result at admission, and input injected into a running turn; it checks the person's current authority and committed source, never socket liveness. A refused queued or returned input stops once with a visible notice. Explicit Stop, release, Gateway shutdown, profile-merge identity, credential and data fences are unchanged. User impact: a turn that started finishes even if the operator's role changes meanwhile; the next request reflects the change. Work that starts later (queued, returned, injected) is refused if authority was revoked. Proof: real Gateway from source: role change during a real message.action handoff fails with the logged error on base and delivers on head; explicit Stop still refuses; the next fresh request is refused. Regression tests cover queued, returned-result and injected starts, model-policy and sourceAgent changes, profile switches and socket-close-only reconnects. Co-authored-by: Ayaan Zaidi <hi@obviy.us>
refactor(gateway): keep operator authority fixed per request (#201334)
Find Your Interest





