Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions core/agent/engine/nodes/cot/cot_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ async def parse_cot_step(
# 其他情况都视为无效格式
raise cot_exc.CotFormatIncorrectExc("无效的推理格式,缺少必要的标识字段")

async def read_response(
# Keep the streaming protocol transitions together as one state machine.
async def read_response( # noqa: C901
self,
messages: LLMMessages,
first_loop: bool,
Expand Down Expand Up @@ -468,7 +469,8 @@ async def _handle_cot_step(
cot_step.action_output = plugin_response.result
yield AgentResponse(typ="cot_step", content=cot_step, model=self.model.name)

async def run(
# Keep the retry, tool-execution, and completion transitions together.
async def run( # noqa: C901
self, span: Span, node_trace_log: NodeTraceLog
) -> AsyncIterator[AgentResponse]:
"""cot run"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
from typing import Any

import pytest

Expand Down Expand Up @@ -75,11 +76,11 @@ def test_release_filter_keeps_workflow_end_content() -> None:

@pytest.mark.asyncio
async def test_idle_workflow_sends_heartbeat_before_30_seconds(
monkeypatch,
monkeypatch: pytest.MonkeyPatch,
) -> None:
observed_timeouts: list[float] = []

async def timeout_immediately(awaitable, *, timeout: float):
async def timeout_immediately(awaitable: Any, *, timeout: float) -> None:
observed_timeouts.append(timeout)
awaitable.close()
raise asyncio.TimeoutError
Expand Down