Skip to content

feat(orchestration/planner): wire StrategyPlanner → skill_router for plan-time skill resolution (#7268 Phase 1) - #7432

Merged
mrveiss merged 1 commit into
Dev_new_guifrom
issue-7268
May 10, 2026
Merged

mrveiss merged 1 commit into
Dev_new_guifrom
issue-7268

Conversation

@mrveiss

@mrveiss mrveiss commented May 10, 2026

Copy link
Copy Markdown
Owner

Summary

ADR-006 (Skill-Bound Planning) calls for the live planner to consult `skill_router` per step at plan time, binding each step to a concrete `(skill_name, action)` before the plan is finalized. Phase 1 of #7268 implements the plan-time binding side.

Phase 2 (executor consumption) and Phase 3 (async gap-fill resume) are filed as #7430 and #7431 respectively. #7268 stays open until all three land.

Conservative defaults chosen for Phase 1

The 3 open ADR-006 questions are deferred to Phase 2/3 where they have less reach. Phase 1 picks the safest defaults:

Question Phase 1 choice
Sync vs async gap-fill Neither at plan time. `dry_run=True` skips Phase 3 — gap-fill becomes Phase 3's (#7431) async-resume problem
Cache policy Per-planner. `SkillRouterSkill` instance lazy-created + cached for the planner's lifetime
Removed-skill behavior Deferred to Phase 2 (#7430) — at execute time, `WorkflowExecutor` will check skill availability

Changes

  • `WorkflowTask` (canonical) gains 3 fields: `skill_name`, `skill_action`, `skill_resolution_method` — all default `None`. Existing constructors unchanged.
  • `StrategyPlanner.build_workflow_plan` becomes `async` and invokes a new `_bind_skill_to_task` helper after each task is constructed. Helper calls `skill_router.execute("find_skill", {"task": …, "dry_run": True})`. Failures are best-effort: any exception, missing router, or `success: False` leaves `skill_name=None`.
  • `orchestrator.py:748` updated to `await` the now-async method (only call site outside the module; already inside `async def`).
  • New test file `workflow_planning_test.py` — 7 cases, all pass.

Test plan

```
$ pytest autobot-backend/enhanced_orchestration/workflow_planning_test.py -v
test_workflow_task_has_skill_binding_fields PASSED
test_build_workflow_plan_is_async PASSED
test_skill_router_dry_run_only_no_auto_enable PASSED
test_successful_lookup_populates_skill_fields PASSED
test_no_match_leaves_skill_fields_none PASSED
test_router_exception_leaves_skill_fields_none PASSED
test_router_unavailable_silent_fallback PASSED
7 passed in 0.82s
```

Acceptance criteria addressed (#7268)

Why this is partial closure, not closure

Per CLAUDE.md's premature-closure rule, #7268 stays OPEN until Phases 2 and 3 land. This PR substantially realizes ADR-006 Phase 1 of the planning path; the executor side and the async-resume path are filed as concrete trackers.

Refs #7268, #7430 (Phase 2), #7431 (Phase 3), ADR-006

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

…plan-time skill resolution (#7268 Phase 1)

ADR-006 (Skill-Bound Planning) calls for the live planner to consult
``skill_router`` per step at plan time, binding each step to a concrete
``(skill_name, action)`` before the plan is finalized — so the
``SkillRegistry`` becomes visible to planning instead of only at execute
time, and capability gaps surface during planning rather than mid-run.

This PR implements **Phase 1** of #7268: the plan-time binding side.
Phase 2 (executor consumption) and Phase 3 (async gap-fill resume) are
filed as #7430 and #7431 respectively.

Conservative defaults chosen for Phase 1, deferring the 3 open questions
in #7268 to Phase 2/3 where the choices have less reach:

- **Sync vs async gap-fill**: NEITHER at plan time. Lookup is
  ``dry_run=True`` so no auto-enable, no Phase 3 gap-fill on every
  plan-build. Phase 3 (#7431) handles the async resume path.
- **Cache policy**: per-planner. ``SkillRouterSkill`` instance is lazily
  created on first ``build_workflow_plan`` and cached for the planner's
  lifetime. Per-session/per-tenant nuance is a Phase 3 concern (#7431).
- **Removed-skill behavior**: deferred to Phase 2 (#7430). At execute
  time, ``WorkflowExecutor`` will check skill availability and decide
  whether to re-route or fail.

## Changes

- ``WorkflowTask`` (canonical, ``autobot_shared/workflow/types.py``)
  gains 3 fields: ``skill_name``, ``skill_action``,
  ``skill_resolution_method`` — all default ``None``. Existing
  ``WorkflowTask(...)`` constructors keep working unchanged.
- ``StrategyPlanner.build_workflow_plan`` becomes ``async`` and invokes
  a new ``_bind_skill_to_task`` helper after each task is constructed.
  The helper calls ``skill_router.execute("find_skill", {"task": …,
  "dry_run": True})`` and attaches the returned skill to the task on
  success. Failures are best-effort: any exception or ``success: False``
  leaves ``skill_name=None``, falling back to the existing
  capability-based agent routing.
- ``orchestrator.py:748`` updated to ``await`` the now-async method
  (the only call site outside the module; already inside an
  ``async def``).
- New test file ``workflow_planning_test.py`` with 7 cases covering:
  field surface, async signature, dry_run-only lookup (no auto-enable),
  successful population, no-match fallback, exception fallback, and
  router-unavailable graceful degradation.

## Acceptance criteria addressed (#7268)

- [x] **StrategyPlanner.build_workflow_plan iterates each step and
      resolves it via skill_router.execute(...)** — implemented.
- [x] **Resolved (skill_name, action) attached to the step** — fields
      added to canonical ``WorkflowTask``, populated by
      ``_bind_skill_to_task``.
- [ ] Phase 3 gap-fill handling — deferred to #7431 (intentional;
      ``dry_run=True`` skips Phase 3 at plan time per ADR-006 rec).
- [ ] WorkflowExecutor consumes the bound plan — deferred to #7430.
- [ ] Integration tests + ADR-006 status flip — deferred to Phase 2/3.

#7268 stays open until Phases 2 and 3 land. This commit substantially
realizes ADR-006 Phase 1 of the planning path.

Refs #7268, #7430 (Phase 2), #7431 (Phase 3), ADR-006
@mrveiss
mrveiss merged commit ba934a7 into Dev_new_gui May 10, 2026
3 of 6 checks passed
@mrveiss
mrveiss deleted the issue-7268 branch May 10, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant