refactor(copilot): remove max 8 steps limit from decompose_goal

The step count is now unrestricted — the LLM can decompose goals into
as many steps as needed. Removes MAX_STEPS constant, the too_many_steps
validation, and the two related tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
anvyle
2026-04-15 03:00:05 +02:00
parent 020d094381
commit 8d102d6eeb
3 changed files with 1 additions and 43 deletions

View File

@@ -37,7 +37,7 @@ Before running the workflow below, ALWAYS decompose the goal first:
4. Only after approval, continue with "Workflow for Creating/Editing Agents".
For simple goals (1-2 blocks), keep steps brief (2-3 steps).
For complex goals, decompose into 4-8 steps max.
For complex goals, use as many steps as needed.
### Workflow for Creating/Editing Agents

View File

@@ -18,8 +18,6 @@ from .models import (
logger = logging.getLogger(__name__)
# Matches the guide's "4-8 steps max" constraint.
MAX_STEPS = 8
DEFAULT_ACTION = "add_block"
VALID_ACTIONS = {"add_block", "connect_blocks", "configure", "add_input", "add_output"}
@@ -275,13 +273,6 @@ class DecomposeGoalTool(BaseTool):
session_id=session_id,
)
if len(steps) > MAX_STEPS:
return ErrorResponse(
message=f"Too many steps ({len(steps)}). Keep the plan to {MAX_STEPS} steps max.",
error="too_many_steps",
session_id=session_id,
)
decomposition_steps: list[DecompositionStepModel] = []
for i, step in enumerate(steps):
if not isinstance(step, dict):

View File

@@ -13,7 +13,6 @@ from ._test_data import make_session
from .decompose_goal import (
AUTO_APPROVE_CLIENT_SECONDS,
DEFAULT_ACTION,
MAX_STEPS,
DecomposeGoalTool,
_no_user_action_since,
cancel_auto_approve,
@@ -190,38 +189,6 @@ async def test_empty_steps_returns_error(tool: DecomposeGoalTool, session):
assert result.error == "missing_steps"
@pytest.mark.asyncio
async def test_too_many_steps_returns_error(tool: DecomposeGoalTool, session):
many_steps = [
{"description": f"Step {i}", "action": "add_block"}
for i in range(MAX_STEPS + 1)
]
result = await tool._execute(
user_id=_USER_ID,
session=session,
goal="Over-engineered agent",
steps=many_steps,
)
assert isinstance(result, ErrorResponse)
assert result.error == "too_many_steps"
@pytest.mark.asyncio
async def test_exactly_max_steps_succeeds(tool: DecomposeGoalTool, session):
"""Exactly MAX_STEPS steps should succeed."""
max_steps = [
{"description": f"Step {i}", "action": "add_block"} for i in range(MAX_STEPS)
]
result = await tool._execute(
user_id=_USER_ID,
session=session,
goal="Complex agent",
steps=max_steps,
)
assert isinstance(result, TaskDecompositionResponse)
assert len(result.steps) == MAX_STEPS
# ---------------------------------------------------------------------------
# Validation — malformed step items
# ---------------------------------------------------------------------------