feat: add MissingToolRule semantic validation

Flags when a workflow stage's allowedTools references a tool name that
is not registered in the tool registry (config drift), surfaced as a
non-blocking WARNING.

- Add ValidationContext.availableTools (nullable; null = registry
  unavailable, skip the check)
- MissingToolRule emits one MISSING_TOOL warning per (stage, tool) pair,
  deterministically ordered
- Populate availableTools from the ToolRegistry at the orchestrator
  construction site; wire the rule into the prod SemanticValidator
This commit is contained in:
2026-05-30 13:18:43 +04:00
parent ee3f9b8aaa
commit e8372e0643
5 changed files with 145 additions and 1 deletions
@@ -304,7 +304,11 @@ abstract class SessionOrchestrator(
is InferenceResult.Failed -> StageExecutionResult.Failure(inferenceResult.reason, retryable = true)
is InferenceResult.Success -> {
if (isCancelled(sessionId)) return StageExecutionResult.Failure("CANCELLED", retryable = false)
val validationCtx = ValidationContext(graph = graph, sessionState = session.state)
val validationCtx = ValidationContext(
graph = graph,
sessionState = session.state,
availableTools = toolRegistry?.all()?.map { it.name }?.toSet()
)
when (val outcome = mapValidationOutcome(sessionId, stageId, validationCtx)) {
is StageExecutionResult.Success -> {
emitToolArtifacts(sessionId, stageId, stageConfig)