fix(gateway): align resume safety-net note with canonical recovery wording

Follow-up on the salvaged resume_pending fix: the empty-turn safety net
now emits the same reason-aware recovery note as the _is_resume_pending
branch (reason phrase + 'session restored' guidance + no-re-execute
instruction) instead of a second, differently-worded note. Also adds the
AUTHOR_MAP entry for the salvaged commit.
This commit is contained in:
teknium1 2026-07-01 02:59:01 -07:00 committed by Teknium
parent c2db3ed7d8
commit 27347b2239
3 changed files with 35 additions and 10 deletions

View file

@ -17434,12 +17434,25 @@ class GatewayRunner(GatewayAuthorizationMixin, GatewayKanbanWatchersMixin, Gatew
and _resume_entry is not None
and getattr(_resume_entry, "resume_pending", False)
):
_sn_reason = (
getattr(_resume_entry, "resume_reason", None) or "restart_timeout"
)
_sn_reason_phrase = (
"a gateway restart"
if _sn_reason == "restart_timeout"
else "a gateway shutdown"
if _sn_reason == "shutdown_timeout"
else "a gateway interruption"
)
message = (
"[System note: The previous turn in this session was "
"interrupted by a gateway restart. Review the conversation "
"history above, finish any unfinished work, and summarize "
"what was accomplished, then wait for the user's next "
"message.]"
f"[System note: The previous turn was interrupted by "
f"{_sn_reason_phrase}; the gateway is now back online. "
f"Any restart/shutdown command in the history has already "
f"run — do NOT re-execute or verify it. Report to the user "
f"that the session was restored successfully and ask what "
f"they would like to do next. Do NOT re-execute old tool "
f"calls — skip any unfinished work from the conversation "
f"history.]"
)
_approval_session_key = session_key or ""

View file

@ -45,6 +45,7 @@ ACP_REGISTRY_MANIFEST = REPO_ROOT / "acp_registry" / "agent.json"
# Auto-extracted from noreply emails + manual overrides
AUTHOR_MAP = {
"7698789+abchiaravalle@users.noreply.github.com": "abchiaravalle", # PR #46997 salvage (recover resume_pending sessions: dual freshness signal + empty-turn safety net so restart auto-resume never sends a blank user turn)
"swissly@users.noreply.github.com": "swissly", # PR #47167 salvage (wrap cron delivery thread-pool fallback in its own try/except so a per-target failure can't escape the except-RuntimeError block and crash the multi-target delivery loop; #47163)
"30854794+YLChen-007@users.noreply.github.com": "YLChen-007", # PR #27289 salvage (case-insensitive streaming reasoning-tag filter in cli.py _stream_delta + gateway stream_consumer so mixed-case variants like <Think>/<ThInK> are suppressed, not just the hardcoded case literals)
"27672904+kangsoo-bit@users.noreply.github.com": "kangsoo-bit", # PR #47508 salvage (keep Telegram gateway alive on transient bootstrap network errors: best-effort deleteWebhook + resilient start_polling degrade to background recovery instead of failing startup)

View file

@ -195,12 +195,23 @@ def _simulate_note_injection(
and resume_entry is not None
and getattr(resume_entry, "resume_pending", False)
):
sn_reason = getattr(resume_entry, "resume_reason", None) or "restart_timeout"
sn_reason_phrase = (
"a gateway restart"
if sn_reason == "restart_timeout"
else "a gateway shutdown"
if sn_reason == "shutdown_timeout"
else "a gateway interruption"
)
message = (
"[System note: The previous turn in this session was "
"interrupted by a gateway restart. Review the conversation "
"history above, finish any unfinished work, and summarize "
"what was accomplished, then wait for the user's next "
"message.]"
f"[System note: The previous turn was interrupted by "
f"{sn_reason_phrase}; the gateway is now back online. "
f"Any restart/shutdown command in the history has already "
f"run — do NOT re-execute or verify it. Report to the user "
f"that the session was restored successfully and ask what "
f"they would like to do next. Do NOT re-execute old tool "
f"calls — skip any unfinished work from the conversation "
f"history.]"
)
return message