feat(mcp): add durable product federation receipts

This commit is contained in:
ogt
2026-07-15 08:37:32 +08:00
parent 97c111bc75
commit ba91ce36b7
16 changed files with 2529 additions and 7 deletions

View File

@@ -625,6 +625,7 @@ async def _main() -> None:
agent99_controlled_dispatch_reconciler_task: asyncio.Task[Any] | None = None
incident_lifecycle_reconciler_task: asyncio.Task[Any] | None = None
mcp_version_lifecycle_task: asyncio.Task[Any] | None = None
mcp_federation_task: asyncio.Task[Any] | None = None
# Production API pods reserve their DB pool for serving requests. This
# singleton worker therefore owns the existing bounded, fail-closed
@@ -741,6 +742,28 @@ async def _main() -> None:
owner="signal_worker",
)
if settings.ENABLE_MCP_FEDERATION_RECEIPT_WORKER:
from src.jobs.mcp_federation_job import run_mcp_federation_loop
mcp_federation_task = asyncio.create_task(
run_mcp_federation_loop(),
name="run_mcp_federation_loop",
)
logger.info(
"signal_worker_mcp_federation_started",
interval_seconds=settings.MCP_FEDERATION_INTERVAL_SECONDS,
startup_sleep_seconds=settings.MCP_FEDERATION_STARTUP_SLEEP_SECONDS,
source_is_fixed_allowlist=True,
raw_source_payload_stored=False,
external_runtime_mutation_allowed=False,
external_rag_write_allowed=False,
)
else:
logger.warning(
"signal_worker_mcp_federation_disabled",
owner="signal_worker",
)
# 2026-07-14 Codex v1.4: Agent99 reconciliation has one runtime owner.
# The API reserves its single DB connection for requests, so durable
# dispatch completion belongs to this standalone worker after the CD-owned
@@ -834,6 +857,12 @@ async def _main() -> None:
await mcp_version_lifecycle_task
except asyncio.CancelledError:
pass
if mcp_federation_task is not None:
mcp_federation_task.cancel()
try:
await mcp_federation_task
except asyncio.CancelledError:
pass
await worker.stop()
from src.core.http_client import close_general_client