Skip to content

fix: use bd ready for dependency-aware task ordering#109

Merged
subsy merged 1 commit intomainfrom
fix/beads-dependency-ordering
Jan 16, 2026
Merged

fix: use bd ready for dependency-aware task ordering#109
subsy merged 1 commit intomainfrom
fix/beads-dependency-ordering

Conversation

@subsy
Copy link
Owner

@subsy subsy commented Jan 16, 2026

Summary

  • Override getNextTask() in BeadsTrackerPlugin to use bd ready --json for server-side dependency filtering
  • The previous approach using bd list --json didn't include dependency data, causing all tasks to appear "ready"
  • This fix ensures tasks are shown in the correct order based on their actual blockers (e.g., task 1 before task 18 in a chained dependency setup)

Changes

  • src/plugins/trackers/builtin/beads.ts: Add getNextTask() override that uses bd ready with support for parent, labels, priority, and assignee filters
  • tests/plugins/beads-tracker.test.ts: Add unit tests for the new getNextTask() behavior

Test plan

  • bun run typecheck passes
  • bun run lint passes
  • bun run build passes
  • bun test tests/plugins/beads-tracker.test.ts passes (25 pass, 6 todo)
  • Manual testing with chained dependencies confirms correct ordering

Fixes #97

Summary by CodeRabbit

Release Notes

  • New Features

    • Beads Tracker Plugin now intelligently fetches and prioritises the next task using enhanced server-side filtering, including epic selection, label filters, priority ordering, and assignee assignment, with a limit of 10 ready tasks returned.
    • In-progress tasks are automatically prioritised above other available ready tasks.
  • Tests

    • Comprehensive test coverage added for task retrieval with various filtering configurations.

✏️ Tip: You can customize this high-level summary in your review settings.

Override getNextTask() in BeadsTrackerPlugin to use `bd ready --json`
instead of relying on the base implementation with `bd list`.

The previous approach failed because `bd list --json` doesn't include
dependency data, causing all tasks to appear "ready" regardless of their
actual blockers. This led to tasks being shown in wrong order (e.g.,
task 18 before task 1 in a chained dependency setup).

The fix leverages `bd ready` which:
- Performs server-side dependency filtering
- Returns only truly unblocked tasks
- Uses hybrid sorting (priority + other factors)
- Supports the same filters (parent, labels, priority, assignee)

Fixes #97
@vercel
Copy link

vercel bot commented Jan 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
ralph-tui Ignored Ignored Jan 16, 2026 6:53pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 16, 2026

Walkthrough

Adds a getNextTask method to BeadsTrackerPlugin that invokes the bd ready CLI command instead of bd list, enabling server-side dependency filtering. The method applies filters for epic/parent, labels, priority, and assignee, returning up to 10 tasks with preference for in-progress items. Comprehensive test coverage validates configuration integration and filter handling.

Changes

Cohort / File(s) Summary
Plugin implementation
src/plugins/trackers/builtin/beads.ts
New override async getNextTask() method leveraging bd ready for dependency-aware task fetching. Builds CLI arguments with JSON output, applies epic/labels/priority/assignee filters, executes bd ready command, parses JSON response, and converts to TrackerTask objects with in-progress preference.
Test suite
tests/plugins/beads-tracker.test.ts
Removes mock import dependency. Adds comprehensive test suite for getNextTask including existence validation, configuration integration (epicId, labels handling), filter tests (parentId, assignee, priority variants), and placeholder tests documenting intended CLI-based behaviour expectations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 Through ready command, dependencies align,
No more tangled chains in reverse design,
Tasks queue in order, blocked ones deferred,
The rabbit's fix—finally, progress is heard! 📋✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: using bd ready for dependency-aware task ordering, which directly addresses the PR's primary objective.
Linked Issues check ✅ Passed The code changes implement all core requirements from issue #97: switching from bd list to bd ready for server-side dependency filtering, ensuring correct task ordering.
Out of Scope Changes check ✅ Passed All changes are directly aligned with the objectives: getNextTask override implementation in beads.ts and corresponding comprehensive test suite additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a11c134 and c3fe5f8.

📒 Files selected for processing (2)
  • src/plugins/trackers/builtin/beads.ts
  • tests/plugins/beads-tracker.test.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Start all code files with a file-level JSDoc comment section explaining the file's purpose, prefixed with 'ABOUTME: '

Files:

  • src/plugins/trackers/builtin/beads.ts
  • tests/plugins/beads-tracker.test.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Start all code files with a file-level JSDoc comment section explaining the file's purpose, prefixed with "ABOUTME: "

Files:

  • src/plugins/trackers/builtin/beads.ts
  • tests/plugins/beads-tracker.test.ts
🧬 Code graph analysis (2)
src/plugins/trackers/builtin/beads.ts (1)
src/plugins/trackers/types.ts (2)
  • TaskFilter (152-179)
  • TrackerTask (26-71)
tests/plugins/beads-tracker.test.ts (1)
src/plugins/trackers/builtin/beads.ts (1)
  • BeadsTrackerPlugin (207-639)
🔇 Additional comments (3)
src/plugins/trackers/builtin/beads.ts (1)

550-623: LGTM! Well-structured override with server-side dependency filtering.

The getNextTask implementation correctly addresses issue #97 by leveraging bd ready for dependency-aware task ordering. The method properly:

  • Applies filters consistently with getTasks() (parent, labels)
  • Handles priority arrays by selecting the highest priority (lowest number)
  • Prefers in_progress tasks over open tasks, matching base behaviour
  • Includes appropriate error handling with graceful fallback to undefined

The JSDoc comment clearly documents the rationale and links to the related issue.

tests/plugins/beads-tracker.test.ts (2)

6-6: LGTM!

Removing the unused mock import is appropriate since these tests don't use mocking.


151-253: Good test coverage for the new getNextTask method.

The test suite appropriately:

  • Validates method existence and type signature
  • Verifies configuration integration (epicId, labels)
  • Confirms filter acceptance for all supported filter types
  • Uses non-existent paths to avoid CLI side effects whilst verifying graceful failure

The .todo tests serve as useful documentation of expected CLI behaviour for when mocking infrastructure is added.

One minor observation: the tests verify the method doesn't throw and returns undefined when the CLI is unavailable, but they don't verify the actual CLI arguments being constructed. Consider adding unit tests with a mocked execBd function in future to validate argument construction.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 26.54%. Comparing base (a11c134) to head (c3fe5f8).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #109      +/-   ##
==========================================
+ Coverage   26.35%   26.54%   +0.19%     
==========================================
  Files          69       69              
  Lines       16516    16559      +43     
==========================================
+ Hits         4352     4395      +43     
  Misses      12164    12164              
Files with missing lines Coverage Δ
src/plugins/trackers/builtin/beads.ts 36.48% <100.00%> (+6.45%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@subsy subsy merged commit 8e847e4 into main Jan 16, 2026
9 checks passed
subsy added a commit that referenced this pull request Jan 17, 2026
The PR #109 fix added getNextTask() to BeadsTrackerPlugin but the engine
never called it. The engine was doing its own getTasks() + isTaskReady()
loop which returned tasks in wrong order since bd list doesn't include
dependency data.

Changes:
- Add excludeIds to TaskFilter for skipped task handling
- Update engine's getNextAvailableTask() to delegate to tracker.getNextTask()
- Add tests for delegation and excludeIds filter

Fixes #97
sakaman pushed a commit to sakaman/ralph-tui that referenced this pull request Feb 15, 2026
fix: use bd ready for dependency-aware task ordering
sakaman pushed a commit to sakaman/ralph-tui that referenced this pull request Feb 15, 2026
The PR subsy#109 fix added getNextTask() to BeadsTrackerPlugin but the engine
never called it. The engine was doing its own getTasks() + isTaskReady()
loop which returned tasks in wrong order since bd list doesn't include
dependency data.

Changes:
- Add excludeIds to TaskFilter for skipped task handling
- Update engine's getNextAvailableTask() to delegate to tracker.getNextTask()
- Add tests for delegation and excludeIds filter

Fixes subsy#97
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.

Task ordering ignores beads dependencies

1 participant

Comments