feat: atomic extract-and-connect + stale PR monitor + response audit #4

Merged
m3taversal merged 70 commits from epimetheus/atomic-connect-and-stale-monitor into main 2026-03-30 11:03:35 +00:00
Showing only changes of commit bb3b033b57 - Show all commits

View file

@ -100,7 +100,8 @@ CONVERSATION_WINDOW = 5 # expire after 5 unanswered messages
unanswered_count: dict[tuple[int, int], int] = {} # (chat_id, user_id) → unanswered count
# Conversation history — last N exchanges for prompt context (Ganymede: high-value change)
MAX_HISTORY = 5
MAX_HISTORY_USER = 5
MAX_HISTORY_CHAT = 10 # Ganymede: group chats need more context (multiple users)
conversation_history: dict[tuple[int, int], list[dict]] = {} # (chat_id, user_id) → [{user, bot}]
@ -694,13 +695,13 @@ IMPORTANT: Two special tags you can append at the end of your response (after yo
# Per-user history
history = conversation_history.setdefault(key, [])
history.append(entry)
if len(history) > MAX_HISTORY:
if len(history) > MAX_HISTORY_USER:
history.pop(0)
# Chat-level history (group context — all users visible)
chat_key = (msg.chat_id, 0)
chat_history = conversation_history.setdefault(chat_key, [])
chat_history.append(entry)
if len(chat_history) > MAX_HISTORY:
if len(chat_history) > MAX_HISTORY_CHAT:
chat_history.pop(0)
# Record rate limit