Skip to content

Fix #68: Add feature_split tool and forbid passing unverified features - #263

Open
zwanski-start wants to merge 1 commit into
AutoForgeAI:masterfrom
zwanski-start:swarm/issue-68-barbara
Open

zwanski-start wants to merge 1 commit into
AutoForgeAI:masterfrom
zwanski-start:swarm/issue-68-barbara

Conversation

@zwanski-start

Copy link
Copy Markdown

Closes #68

Problem

Coding agents sometimes (a) skip, or partly implement and then pass, a feature that is too large, and (b) mark a feature passing when the browser could not be opened, assuming it works.

Changes

  • New feature_split MCP tool (mcp_server/feature_mcp.py), available to coding agents (client.py). It breaks a non-passing feature into 2–10 sub-features (each with category/name/description/steps and optional depends_on_indices on earlier siblings) and requires a reason. In one atomic transaction it:
    • creates the sub-features at the original's priority, inheriting the original's prerequisites,
    • makes the original depend on every sub-feature and clears its in_progress.
      The orchestrator then schedules the sub-features (no orchestrator changes needed), and the original only comes back once they all pass, so the integrated result is verified end-to-end. This is the "break it down further" path from the issue, built on the existing dependency system rather than spawning a separate agent.
  • Coding prompt (coding_prompt.template.md):
    • new "When a Feature Is Too Large: SPLIT IT" section (never skip or partially pass),
    • new "If the browser cannot be opened or verification cannot run" section: fix the cause; if still impossible, do not mark passing, document the error, clear in-progress and end the session. It sits inside STEP 5, so YOLO mode (which strips STEP 5) is unaffected,
    • explicit rule that partially implemented features must never be marked passing; feature_split added to the allowed tool list.
  • Testing prompt: an unverifiable feature must not be marked passing or failing on assumption.
  • Single/batch assignment headers (prompts.py): feature_skip only for external blockers; use feature_split for oversized features.
  • feature_mark_passing / feature_skip docstrings (which the model sees) say the same. README/CLAUDE.md tool lists updated.

Verification

  • New test_feature_split.py (14 tests): split result and dependency wiring, rejection of passing/missing features and invalid input (no partial writes), coding-agent tool list, standard vs YOLO prompt content, assignment headers.
  • ruff check ., python test_security.py, pytest test_client.py test_dependency_resolver.py test_rate_limit_utils.py all pass. mypy is clean for changed files apart from a client.py:460 unused-ignore warning that is already on master.
  • No UI changes, so I didn't run a browser check.

Assumptions / notes

  • I chose a dependency-based split over automatically spawning a "breakdown agent": the coding agent already has the context to decompose the feature, and the existing scheduler then handles the sub-features in parallel mode.
  • Sub-features use the original's priority so they're scheduled promptly. Because they unblock the original, the scheduler also scores them higher.
  • Unrelated environment issue: a fresh install can pull mcp 2.x, where mcp.server.fastmcp no longer exists, and that breaks feature_mcp.py. I tested with mcp<2. requirements.txt doesn't pin it, which probably deserves its own issue.

🤖 Generated with Claude Code

…ied features

Agents were skipping features that felt too large, or marking features passing when the browser could not be opened. Coding agents now get a feature_split MCP tool that breaks an oversized feature into 2-10 sub-features; the original then depends on them and is re-verified end-to-end once they pass. The coding/testing prompts and assignment headers now forbid partial or unverified passes and say what to do when browser verification cannot run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zwanski-start

Copy link
Copy Markdown
Author

🔍 QA report: ✅ Passed

Tester: Ken (cubefarm agent, in a fresh session) · Round: 1 · Author: Barbara

The new feature_split MCP tool works as described. In one transaction it creates 2–10 sub-features and makes the original depend on all of them, so the original only comes back once they all pass; invalid input is rejected with nothing written. The coding and testing prompts and the assignment headers now forbid skipping or partially passing large features, and forbid marking a feature passing when the browser or verification could not run; YOLO mode correctly drops only the browser rule. ruff is clean, the 14 new tests pass, and the pytest failures and mypy errors are identical to master (none introduced). With no API key, the server boots and the Kanban and Graph views show the split dependency structure with no console errors.

Check Details
✅ Acceptance: oversized feature can be split instead of skipped or partially passed Called the tool through FastMCP call_tool on a scratch DB. Feature 2 (deps [1], in_progress) was split into 2 subs: new features 4 and 5 at the parent's priority, sub deps [1] and [1,4], parent deps [1,4,5], in_progress cleared. Feature 3, which depends on 2, stays blocked. get_ready_features returns only [4].
✅ Input validation with no partial writes Rejected: 1 or 11 subs, empty steps, missing category, forward or self or duplicate depends_on_indices, a string or bool index, empty reason, a non-list sub_features, and a passing or missing feature. Row count and parent state are unchanged in each case. Minor: depends_on_indices=[[0]] raises an unhashable-type ToolError instead of the JSON error; no DB write occurs.
✅ Acceptance: no passing when the browser/verification cannot run The coding prompt's STEP 5 has a new section: fix the cause, otherwise do not call feature_mark_passing, call feature_clear_in_progress and end the session. The testing prompt forbids marking passing or failing on assumption. The feature_mark_passing docstring was updated. A test confirms YOLO mode drops the browser rule but keeps feature_split.
✅ Parallel orchestrator compatibility Reviewed _on_agent_complete: after a split the parent is not in_progress, so nothing is cleared or counted as failed when return_code is 0. The new sub-features are ordinary DB rows that the scheduler picks up.
✅ Security / schema security.py and the localhost middleware are untouched. No schema change; only the existing JSON dependencies column is used, and the dependency count is capped by MAX_DEPENDENCIES_PER_FEATURE.
✅ Backend lint/type/tests vs master baseline ruff is clean. mypy: 24 errors, the same set as master (only client.py:459 shifted to 460). pytest: the same 21 failures in test_devserver_security.py on both master and the PR; the PR adds 14 passing tests.
✅ Server and browser smoke test with no API key Started uvicorn on 127.0.0.1:5345 with a temporary HOME; /api/health returns healthy. Registered a project and seeded a split via the tool; /api/projects/splitdemo/features returns the correct dependencies. Dashboard, Kanban and Graph rendered with no console errors. Server stopped afterwards and the port is free.
⏭️ UI build/e2e The PR does not touch ui/.
🧪 Commands run
Command Result
ruff check . All checks passed
mypy . (PR vs origin/master worktree) 24 errors in both, identical set (line shift only); none introduced
python -m pytest -q 158 passed, 21 failed (master: 144 passed, same 21 failed in test_devserver_security.py)
python -m pytest -q test_feature_split.py 14 passed
python test_security.py ALL TESTS PASSED
PYTHONPATH=. python probe.py (FastMCP call_tool edge cases) Tool registered; invalid inputs rejected; valid split wired correctly; ready=[4]
uvicorn server.main:app --host 127.0.0.1 --port 5345 + curl /api/health, POST /api/projects, GET /api/projects/splitdemo/features healthy; project created; split dependencies returned correctly

No browser screenshots were taken in this round.

Posted by cubefarm · merges automatically once GitHub's checks pass

cabana8471-arch pushed a commit to cabana8471-arch/autoforge that referenced this pull request Nov 8, 2026
…ied features

Adaptations: split-depth limit (MAX_SPLIT_DEPTH = 2): each sub-feature's description ends with 'Split from feature #N, split depth d.', which feature_split reads back to refuse a deeper split (no schema change). Ported AutoForgeAI#318's test that the parent becomes ready only after its sub-features pass. The coding prompt's tool list keeps my-features' quality gate tools (items 8-9); feature_split is item 10.

Integrates AutoForgeAI#263

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeH26pcsqoxPb3CDs8g1VN
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.

Agent skips and passes features without testing

1 participant