fix: use correct build_messages signature after emergency trim
Build Nanobot OAuth / build (push) Successful in 1m33s
Build Nanobot OAuth / cleanup (push) Successful in 0s

Used nonexistent 'system_prompt' variable. Match the keyword-arg call
pattern used at the top of _process_message.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-25 14:22:06 +01:00
parent 7b0714c5c5
commit 71e65052d1
+8 -1
View File
@@ -436,7 +436,14 @@ class AgentLoop:
self.sessions.save(session)
logger.info(f"Emergency trim: {old_size} -> {len(session.messages)} messages")
# Rebuild messages from trimmed session
messages, turn_start = self.context.build_messages(session, current_message, system_prompt)
messages = self.context.build_messages(
history=session.get_history(),
current_message=current_message,
media=msg.media if msg.media else None,
channel=msg.channel,
chat_id=msg.chat_id,
)
turn_start = len(messages)
continue # Retry LLM call with shorter context
raise # No trim happened — can't recover