fix: prevent timeout stalls and release 1.2.1
This commit is contained in:
1 parent
84e183d28d
commit
1dc2b0c686
11 files changed
+129
-11
No files matched your search
@@ -1063,6 +1063,8 @@ class FlashRunner:
|
||||
current_xml_list = xml_list
|
||||
previous_turn: _TurnRecord | None = None
|
||||
pending_notices: list[str] = []
|
||||
no_tool_attempts = 0
|
||||
no_tool_limit = settings.ARTEMIS_FLASH_MAX_NO_PROGRESS_ATTEMPTS
|
||||
|
||||
while limit is None or turns < limit:
|
||||
control = getattr(self.ctx, "task_control", None)
|
||||
@@ -1198,11 +1200,24 @@ class FlashRunner:
|
||||
if is_final:
|
||||
final_report = {"status": "failed", "explanation": raw_text}
|
||||
break
|
||||
no_tool_attempts += 1
|
||||
if no_tool_attempts >= no_tool_limit:
|
||||
final_report = {
|
||||
"status": "failed",
|
||||
"explanation": (
|
||||
f"模型连续 {no_tool_attempts} 次未调用工具,"
|
||||
"已停止任务以避免空转和重复计费;未执行新的设备动作。"
|
||||
),
|
||||
}
|
||||
break
|
||||
pending_notices.append(_NO_TOOL_CALL_NOTICE)
|
||||
ledger.stage_turn(messages[turn_base:])
|
||||
# Keep the observation and any injected user instruction, but
|
||||
# do not feed the model its own unproductive prose on retry.
|
||||
ledger.stage_turn(messages[turn_base:-1])
|
||||
previous_turn = _TurnRecord()
|
||||
continue
|
||||
|
||||
no_tool_attempts = 0
|
||||
# Process tool calls
|
||||
turn = _TurnRecord()
|
||||
(
|
||||
|
||||
Reference in new issue
Block a user