Files
SuperBizAgent-java/openspec/changes/archive/2026-07-21-single-react-harness-run-context/tasks.md
T

2.4 KiB

1. Run State Primitives

  • 1.1 Implement structurally immutable RunContext with explicit identity, deadline, cancellation, budget, retry policy, and lifecycle handles.
  • 1.2 Implement first-reason-wins cancellation with resource callbacks and first-terminal-wins Run lifecycle.
  • 1.3 Add Run identity, cancellation, and terminal race tests with a controlled Clock.

2. Budget and Capacity

  • 2.1 Implement validated caller-supplied RunBudgetLimits and thread-safe Model/Tool/per-Tool/Token accounting.
  • 2.2 Implement atomic single-Run byte capacity reservation with no partial update on rejection.
  • 2.3 Add budget tests for consistent counters, actual Token recording, concurrent reservations, and exhaustion details.

3. Harness Core

  • 3.1 Implement DiagnosisHarnessCore Run creation, active/deadline checks, budget gates, explicit cancellation, and success/failure completion.
  • 3.2 Add Fake Model/Tool tests proving explicit synchronous/asynchronous RunContext propagation and cancellation/deadline/budget terminal outcomes.

4. Retry Boundary

  • 4.1 Implement typed RetryFailure, bounded RetryPolicy, strict HarnessRetryPolicies, RetryAttempt, and RetryExecutionException.
  • 4.2 Implement HarnessRetryExecutor with per-attempt active checks and attempt recording, without backoff, recursion, or hidden loops.
  • 4.3 Add Fake Router/Tool/SemanticGuard retry tests for allowed technical retry, one-attempt policies, cancellation between attempts, and non-retryable outcomes.

5. Tool Store Foundations

  • 5.1 Implement configurable ToolCallKeyFactory with exact framework ID preservation and safe-segment validation.
  • 5.2 Add key factory tests covering exact key format, blank/unsafe/oversized segments, and no generated fallback ID.

6. Hidden Retry Configuration

  • 6.1 Set spring.ai.retry.max-attempts to 1 without changing Model routing or provider configuration.
  • 6.2 Add a focused YAML configuration test proving the hidden Spring AI retry override.

7. Verification

  • 7.1 Run focused Harness Core, retry, budget, key/capacity, and retry configuration tests.
  • 7.2 Run stage 0/1 Harness and ACI contract tests plus existing ChatController test as regression coverage.
  • 7.3 Verify new production code has no ThreadLocal/current-holder usage and current Chat/AIOps/Controller/JPA/Redis call sites remain unchanged.