mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-09-14 16:08:41 +00:00
* feat(mcp): add durable task runtime foundation * fix(chart): sync embedded config version * fix(mcp): isolate task polls during shutdown * feat(mcp): track consecutive poll errors on mcp_tasks poll_attempt_count grows on every claim (successful polls included), so it cannot drive a failure backoff without misjudging normal long tasks. Add consecutive_poll_error_count: incremented when a claim is released after a poll error, reset to zero by any applied snapshot. The backoff/terminal policy that consumes it lands with the first concrete driver. * fix(mcp): harden durable task lifecycle * fix(mcp): preserve tracked task on dedup conflict --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
26 lines
907 B
Python
26 lines
907 B
Python
import pytest
|
|
from pydantic import ValidationError
|
|
|
|
from deerflow.config.app_config import AppConfig
|
|
from deerflow.config.mcp_tasks_config import McpTasksConfig
|
|
from deerflow.config.reload_boundary import STARTUP_ONLY_FIELDS, STARTUP_ONLY_PREFIX
|
|
|
|
|
|
def test_mcp_task_runtime_is_disabled_by_default_and_bounded():
|
|
config = McpTasksConfig()
|
|
assert config.enabled is False
|
|
assert config.poll_interval_seconds == 5
|
|
assert config.lease_seconds == 120
|
|
assert config.max_concurrent_polls == 8
|
|
|
|
with pytest.raises(ValidationError):
|
|
McpTasksConfig(poll_interval_seconds=0)
|
|
with pytest.raises(ValidationError):
|
|
McpTasksConfig(max_concurrent_polls=0)
|
|
|
|
|
|
def test_mcp_task_runtime_is_registered_as_startup_only():
|
|
assert "mcp_tasks" in STARTUP_ONLY_FIELDS
|
|
field = AppConfig.model_fields["mcp_tasks"]
|
|
assert (field.description or "").startswith(STARTUP_ONLY_PREFIX)
|