Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions gateway/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4854,6 +4854,27 @@ def _schedule_resume_pending_sessions(self, platform=None) -> int:
)
continue

# Validate the session owner against the current allowlist
# before auto-resuming. A session created before
# TELEGRAM_ALLOWED_USERS (or equivalent) was configured, or
# before the owner was removed from it, must not silently
# receive a full agent response on gateway restart just
# because it has a resume-pending marker (issue #23778).
try:
if not self._is_user_authorized(source):
logger.warning(
"Skipping auto-resume for %s: session owner is no "
"longer authorized under the current allowlist",
entry.session_key,
)
continue
except Exception as exc:
logger.warning(
"Skipping auto-resume for %s: authorization check failed: %s",
entry.session_key, exc,
)
continue

# Claim the session slot *before* spawning the task so that an
# inbound message arriving between task creation and the task's
# first await (where _process_message_background sets the real
Expand Down
Loading