AI/Tasks/CurrentTask.txt

Implement a narrow timeout-alignment patch so Invoke-TechAgent and TechToolbox.Agent orchestrator use a consistent run deadline, while preserving safety guardrails.
 
Goal:
- Keep a hard deadline (do not remove it).
- Make the orchestrator run deadline configurable and bounded.
- Align defaults with existing behavior unless explicitly overridden.
 
Scope:
1. Update `AgentOrchestrator.Run.cs` to replace the fixed TimeSpan.FromMinutes(10) run budget with a configurable value.
2. Add configuration plumbing in `AgentConfiguration.cs` for orchestrator run deadline (seconds or minutes, choose one and use consistently).
3. Ensure request/build path from `Invoke-TechAgent.ps1` passes the configured deadline into the runtime configuration object (or environment variable if that is the established pattern).
4. Add/update config default in `config.json` under agent settings.
5. Add tests in `Tests` that verify default, override, and clamp behavior.
 
Required behavior:
1. Default behavior remains effectively current-safe:
- If no override is set, orchestrator deadline should remain 10 minutes.
2. Override support:
- Respect configured value from agent config (and/or environment variable if already used in this subsystem).
3. Clamp bounds for safety:
- Minimum 300 seconds (5 minutes).
- Maximum 1800 seconds (30 minutes).
4. On timeout, existing error text and failure classification should continue to work unless a change is required for correctness.
5. No unrelated refactors.
 
Implementation detail expectations:
1. Prefer a single source of truth for effective deadline resolution (helper method).
2. Include trace logging of effective orchestrator deadline at run start.
3. Keep naming explicit, for example:
- agent.orchestratorRunDeadlineSeconds
or
- agent.runDeadlineSeconds
4. If both config and env var are supported, define precedence clearly in code comments and tests.
 
Tests to add/update:
1. Default deadline test:
- No override => effective deadline equals 600 seconds.
2. Lower bound clamp test:
- Configure below 300 => effective deadline is 300.
3. Upper bound clamp test:
- Configure above 1800 => effective deadline is 1800.
4. Valid override test:
- Configure 1200 => effective deadline is 1200.
5. Optional integration-level test:
- Validate Invoke-TechAgent request wiring includes the deadline setting when provided.
 
Validation to run:
1. dotnet test for touched TechToolbox.Agent test projects/files.
2. Any relevant PowerShell tests if `Invoke-TechAgent.ps1` plumbing is modified.
3. Report exact pass/fail counts and list changed files.
 
Output format:
1. Short root-cause summary.
2. Files changed with concise per-file rationale.
3. Test results with command + outcome.
4. Residual risk notes if any.
 
Constraints:
- Preserve current public behavior except timeout configurability and bounded alignment.
- Keep patch minimal and readable.
- Do not change unrelated retry, iteration, or tool timeout logic.