AI/Tasks/OrchestratorUpgrades/Orchestrator_Phase02_CancellationBudgetsRetry_Implementation.txt
|
PHASE 02 IMPLEMENTATION PROMPT - CANCELLATION, BUDGETS, AND RETRY SEMANTICS
Goal: Implement structured cancellation, deadline, and retry semantics so orchestration remains robust under time pressure and repeated failure. Inputs: - AI/Tasks/OrchestratorUpgrades/Orchestrator_Phase02_CancellationBudgetsRetry_Strict.txt - AI/Tasks/OrchestratorUpgrades/Overview.txt Required code work: - Add `CancellationToken` propagation to orchestrator loops and tool execution boundaries. - Define a single run budget that covers execution time, iteration count, tool usage, and output tokens. - Replace heuristic retry logic with structured retry codes and retryability metadata. - Add per-tool timeout and deadline behavior without weakening safety or authorization checks. - Ensure retry exhaustion and cancellation states are observable and testable. Implementation constraints: - Keep state-model design and policy enforcement separate from retry logic. - Preserve current behavior except where retry timing or cancellation handling are made explicit and bounded. - Do not implement full tool registry, validation schema, or memory-privacy changes in this phase. Minimum tests to add/update: - Cancellation propagation tests for model and tool execution stages. - Retry budget exhaustion tests. - Structured failure/retryability tests. - Deadline and timeout behavior tests. Validation commands: - dotnet build src/TechToolbox.Agent/TechToolbox.Agent.csproj -c Release - dotnet test src/TechToolbox.Agent/Tests/TechToolbox.Agent.Tests.csproj -c Release --filter "Orchestrator|Retry|Cancellation|Timeout|Budget|Strict" Deliverable: Return changed files, the final cancellation and retry contract, and proof that the orchestrator remains bounded and failure-aware. |