Aari 47b258ebd7
feat(mcp): add ordinary durable task driver (#4690)
* 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>
2026-08-15 14:26:38 +08:00

16 lines
748 B
Python

from pydantic import BaseModel, Field
class McpTasksConfig(BaseModel):
"""Startup configuration for the protocol-neutral MCP task poller."""
enabled: bool = Field(default=False)
poll_interval_seconds: int = Field(default=5, ge=1, le=300)
lease_seconds: int = Field(default=120, ge=5, le=3600)
max_concurrent_polls: int = Field(default=8, ge=1, le=64)
max_poll_backoff_seconds: int = Field(default=300, ge=1, le=3600)
input_required_poll_interval_seconds: int = Field(default=60, ge=5, le=3600)
tracking_degraded_after_errors: int = Field(default=3, ge=1, le=100)
max_result_bytes: int = Field(default=65_536, ge=1024, le=10_485_760)
result_preview_max_chars: int = Field(default=2_000, ge=64, le=100_000)