mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-09-11 14:38:38 +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 * feat(mcp): add ordinary durable task driver * test(mcp): address durable task review feedback * fix(mcp): preserve submit tool descriptions * fix(mcp): bound remote task calls * fix(mcp): bound persisted task payloads * fix(mcp): preserve task tool error details * fix(mcp): enforce durable task boundaries * test(mcp): cover task config snapshot lifecycle --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
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
|
|
assert config.max_poll_backoff_seconds == 300
|
|
assert config.input_required_poll_interval_seconds == 60
|
|
assert config.tracking_degraded_after_errors == 3
|
|
assert config.max_result_bytes == 65_536
|
|
assert config.result_preview_max_chars == 2_000
|
|
|
|
with pytest.raises(ValidationError):
|
|
McpTasksConfig(poll_interval_seconds=0)
|
|
with pytest.raises(ValidationError):
|
|
McpTasksConfig(max_concurrent_polls=0)
|
|
with pytest.raises(ValidationError):
|
|
McpTasksConfig(max_result_bytes=10)
|
|
|
|
|
|
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)
|