fix(reply): done-by-user guard keeps tool calls, other people's lines and started tools safe
- A native tool call message with text is not an earlier answer: leaving it out orphaned its role=tool result. Only plain assistant answers are left out. - The guard is off once any tool run started in the reply, whatever it returned: an MCP call with an empty result was not in invoked_tools_history, so a second try could run it again. - HistoryContext.answers marks the lines that are Jarvis's answers to the asker (to_id is the asker); only those leave the history, not someone else saying the same words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,7 @@ FIELD_HISTORY = [
|
||||
f"[2026-11-18 18:27] 사금향: {FIELD_QUESTION}",
|
||||
f"[2026-11-18 18:27] 자비스: {FIELD_REFUSAL}",
|
||||
]
|
||||
FIELD_ANSWERS = [FIELD_HISTORY[1]] # the history line that is Jarvis's answer to the asker
|
||||
# The same turn in the asker's short-term dialogue memory, as the v2 brain keeps it.
|
||||
FIELD_MEMORY = [("user", FIELD_QUESTION), ("assistant", FIELD_REFUSAL)]
|
||||
|
||||
@@ -97,7 +98,8 @@ def _run(mock_config, eval_db, eval_dialogue_memory, query, recent, memory=()):
|
||||
turn_state.set_chat(chat)
|
||||
try:
|
||||
reply = run_reply_engine(db=eval_db, cfg=mock_config, tts=None, text=query,
|
||||
dialogue_memory=eval_dialogue_memory, history=HistoryContext(recent=recent),
|
||||
dialogue_memory=eval_dialogue_memory,
|
||||
history=HistoryContext(recent=recent, answers=[x for x in FIELD_ANSWERS if x in recent]),
|
||||
legacy_memory=False, default_language="Korean", compact_prompt=True,
|
||||
intent_judge=True) or ""
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user