Skip to content

feat(kanban): prevent child task dispatch when parent is not done#19743

Closed
SimbaKingjoe wants to merge 1 commit into
NousResearch:mainfrom
SimbaKingjoe:fix/kanban-dependency-guard-direct-status
Closed

feat(kanban): prevent child task dispatch when parent is not done#19743
SimbaKingjoe wants to merge 1 commit into
NousResearch:mainfrom
SimbaKingjoe:fix/kanban-dependency-guard-direct-status

Conversation

@SimbaKingjoe

@SimbaKingjoe SimbaKingjoe commented May 4, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Prevents child Kanban tasks from being dispatched before their parent tasks are done. Adds a parent dependency guard to the _set_status_direct function so that manually setting a task's status to "ready" via the dashboard API (drag-drop or explicit PATCH) is rejected with 409 when the task's parents are not all completed.

Previously, the dependency guard only existed in recompute_ready (which handles auto-promotion from todoready). Direct status writes via the dashboard API bypassed this check entirely, allowing the dispatcher to spawn a child task whose upstream work hadn't finished yet.

Root cause example: After a dispatcher tick reclaimed stale workers and promoted tasks via recompute_ready, subsequent dashboard status writes set both a child and its grandchild to "ready" in quick succession. The writer (grandchild) was spawned and ran while the analyst (child) was blocked — upstream research wasn't complete.

Related Issue

Fixes #19746

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • plugins/kanban/dashboard/plugin_api.py — Added parent dependency check in _set_status_direct(): when transitioning to "ready", verify all parents are "done". Returns False (409) if not.
  • tests/plugins/test_kanban_dashboard_plugin.py — Updated test_board_progress_rollup to complete the parent (trigger recompute_ready) instead of manually forcing children to "ready". Rewrote test_patch_drag_drop_move_todo_to_ready to verify both the rejection case (parent not done → 409) and the acceptance case (parent done → auto-promoted to ready).

How to Test

  1. Create parent task → create child task with parents=[parent_id]. Child starts as todo.
  2. PATCH /api/plugins/kanban/tasks/{child_id} with {"status":"ready"} → expect 409 Conflict
  3. Complete the parent: PATCH /api/plugins/kanban/tasks/{parent_id} with {"status":"done"}
  4. Verify child auto-promoted to ready by recompute_ready
  5. Run pytest tests/plugins/test_kanban_dashboard_plugin.py -v — all 42 tests pass

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run tests and all pass
  • I've added tests for my changes
  • I've tested on my platform: macOS 15.x

Documentation & Housekeeping

  • N/A (no doc/config/arch changes needed)

Add parent dependency guard to _set_status_direct so dragging
a task to the ready column is rejected (409) when its parents
are not all done. Previously the guard only existed in
recompute_ready, allowing direct status writes via the
dashboard API to bypass the dependency engine.

Root cause: after reclaiming stale workers, both T3 and T4
were set to ready via dashboard status writes in quick
succession, causing the writer to be spawned while the analyst
was blocked — upstream work wasn't done yet.
@SimbaKingjoe SimbaKingjoe changed the title fix(kanban): prevent child task dispatch when parent is not done feat(kanban): prevent child task dispatch when parent is not done May 4, 2026
@alt-glitch alt-glitch added type/feature New feature or request comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have labels May 4, 2026
@teknium1

teknium1 commented May 6, 2026

Copy link
Copy Markdown
Contributor

Merged via PR #20448 (rebase-merge, commit 2002e303). Your authorship is preserved on main. Thanks — _set_status_direct was genuinely missing the parent-done guard that recompute_ready already had, and the 409 response is the right UX.

#20448

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(kanban): add parent dependency guard to direct status writes

3 participants