fix(fm-session-start): show in-flight and queued beads instead of ready-only - #32
Conversation
Stage 2 of the beads-authority migration (data/beads-authority-migration-scout/report.md section 4). The beads branch of session-start's compact backlog listing queried only `task list --ready`, which silently dropped in_progress/blocked work from the digest - a regression against data/backlog.md's `## In flight`/ `## Queued` structure. print_backlog_beads_compact now renders two sections mirroring that structure, both scoped by the firstmate-fleet label (fm_beads_fleet_label, same label fm-fleet-snapshot.sh's Stage 1 beads read already uses): - In flight: task list --label <label> --status in_progress,blocked - Queued: task list --label <label> --ready A failure on either read falls back to the whole title-line rendering of data/backlog.md, same as before. Default (non-beads) backend output is unchanged.
📝 WalkthroughWalkthroughThe session-start Beads backlog now shows fleet-scoped In flight and Queued sections. Each query is bounded and failures trigger complete markdown backlog fallback. Documentation and tests cover the new queries and fallback behavior. ChangesBeads backlog flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SessionStart
participant BeadsCLI
participant MarkdownBacklog
SessionStart->>BeadsCLI: Query fleet-scoped In flight tasks
SessionStart->>BeadsCLI: Query fleet-scoped Queued tasks
BeadsCLI-->>SessionStart: Return listings or failure
SessionStart->>MarkdownBacklog: Render complete fallback on failure
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@bin/fm-session-start.sh`:
- Around line 281-283: Make the fallback output all-or-nothing in
bin/fm-session-start.sh around the query-failure handling: when either Beads
query fails, do not print either captured result before the markdown fallback,
including a successful Queued result when the In flight query fails. Update
tests/fm-session-start.test.sh in the affected fallback case to assert that
ready-task-1 is absent from the output.
In `@docs/configuration.md`:
- Line 63: Update the fallback documentation in the Beads backend section to
state that session start reads data/backlog.md for the title-line fallback when
a Beads read fails, aligning it with the behavior described near the existing
configuration guidance and implemented by bin/fm-session-start.sh.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f24cb485-8550-4f8d-a8f0-2fead362b630
📒 Files selected for processing (3)
bin/fm-session-start.shdocs/configuration.mdtests/fm-session-start.test.sh
| printf 'beads task listing failed; falling back to title-line rendering.\n' | ||
| printf '%s\n' "$out" | ||
| printf '%s\n' "$out_inflight" | ||
| printf '%s\n' "$out_queued" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Keep the fallback output all-or-nothing.
If the In flight query fails and the Queued query succeeds, Line 283 prints the successful Queued result before the markdown fallback. The output then contains a partial Beads listing and the fallback listing.
bin/fm-session-start.sh#L281-L283: Do not print a successful query capture after either query fails.tests/fm-session-start.test.sh#L1392-L1398: Assert thatready-task-1is absent from fallback output.
Proposed fix
else
printf 'beads task listing failed; falling back to title-line rendering.\n'
- printf '%s\n' "$out_inflight"
- printf '%s\n' "$out_queued"
if [ -f "$path" ]; then
print_backlog_manual_compact "$path" "fallback" assert_contains "$out" "- [ ] blocked-followup - Follow compact startup" \
"beads read failure fallback omitted the Queued backlog title line - a partial digest was printed instead of the full title-line fallback"
+ assert_not_contains "$out" "ready-task-1" \
+ "beads read failure fallback printed successful Queued-query output"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| printf 'beads task listing failed; falling back to title-line rendering.\n' | |
| printf '%s\n' "$out" | |
| printf '%s\n' "$out_inflight" | |
| printf '%s\n' "$out_queued" | |
| printf 'beads task listing failed; falling back to title-line rendering.\n' |
| printf 'beads task listing failed; falling back to title-line rendering.\n' | |
| printf '%s\n' "$out" | |
| printf '%s\n' "$out_inflight" | |
| printf '%s\n' "$out_queued" | |
| assert_contains "$out" "- [ ] blocked-followup - Follow compact startup" \ | |
| "beads read failure fallback omitted the Queued backlog title line - a partial digest was printed instead of the full title-line fallback" | |
| assert_not_contains "$out" "ready-task-1" \ | |
| "beads read failure fallback printed successful Queued-query output" |
📍 Affects 2 files
bin/fm-session-start.sh#L281-L283(this comment)tests/fm-session-start.test.sh#L1392-L1398
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@bin/fm-session-start.sh` around lines 281 - 283, Make the fallback output
all-or-nothing in bin/fm-session-start.sh around the query-failure handling:
when either Beads query fails, do not print either captured result before the
markdown fallback, including a successful Queued result when the In flight query
fails. Update tests/fm-session-start.test.sh in the affected fallback case to
assert that ready-task-1 is absent from the output.
| Set the local, gitignored `config/backlog-backend` file to `manual` to force manual backlog editing and suppress the verbose `BOOTSTRAP_INFO: tasks-axi available` fact, not missing-tool reporting. | ||
| Absent or `tasks-axi` selects the default tasks-axi backend. | ||
| The file format is unchanged in tasks-axi and manual modes; both produce the same `## In flight`, `## Queued`, and `## Done` sections in `data/backlog.md`. | ||
| The beads backend does not use `data/backlog.md`; all backlog state lives in the beads store and is queried dynamically at session start. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Correct the fallback documentation.
Line 63 conflicts with Line 57 and bin/fm-session-start.sh. When a Beads read fails, session-start reads data/backlog.md for the title-line fallback.
Proposed fix
-The beads backend does not use `data/backlog.md`; all backlog state lives in the beads store and is queried dynamically at session start.
+When Beads reads succeed, backlog state is queried dynamically from the beads store. If either read fails, session-start uses `data/backlog.md` for its title-line fallback.As per coding guidelines, “Report failures and outcomes faithfully, with concrete evidence rather than masking or minimizing failures.”
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| The beads backend does not use `data/backlog.md`; all backlog state lives in the beads store and is queried dynamically at session start. | |
| When Beads reads succeed, backlog state is queried dynamically from the beads store. If either read fails, session-start uses `data/backlog.md` for its title-line fallback. |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/configuration.md` at line 63, Update the fallback documentation in the
Beads backend section to state that session start reads data/backlog.md for the
title-line fallback when a Beads read fails, aligning it with the behavior
described near the existing configuration guidance and implemented by
bin/fm-session-start.sh.
Source: Coding guidelines
Intent
beads-authority Stage 2 - session-start's beads-backend digest shows In flight (in_progress+blocked) and Queued (ready) sections scoped by the fleet:firstmate label, mirroring data/backlog.md's structure instead of --ready alone; default (markdown) backend output byte-identical; tests added; read/visibility only, no home flipped.
What Changed
print_backlog_beads_compactinbin/fm-session-start.shnow queries the beads store twice —task list --label <fleet-label> --status in_progress,blockedandtask list --label <fleet-label> --ready— and renders them under## In flight/## Queuedheadings, mirroringdata/backlog.md's structure instead of showing onlybd's native ready set.data/backlog.mdrather than emitting a partial digest.docs/configuration.mdupdated to describe the two-section beads digest, its label scoping, and the fallback behavior;tests/fm-session-start.test.shextended with coverage for both sections rendering and the partial-failure fallback path.Risk Assessment
✅ Low: Small, well-scoped read-only change (two
task listcalls instead of one, mirroring backlog.md's structure and reusing the existing fleet-label filter pattern already proven in fm-fleet-snapshot.sh); non-beads backend code paths are untouched, and both the success and partial-failure fallback paths are covered by new tests.Testing
Ran the full fm-session-start test suite (34/34 pass, including the two new beads-digest tests), then independently reproduced the beads-backend digest end-to-end with the same fake
taskCLI fixtures to capture the actual captain-facing transcript showing the## In flight/## Queuedsections, and separately confirmed the default tasks-axi backend's output is byte-for-byte identical between the base and target commits by running both versions of the script against the same fixture and diffing (only volatile tmp-path/pid text differed) — all consistent with the stated read-only, visibility-only intent.Evidence: Real end-to-end session-start digest transcript (beads backend) showing the new In flight / Queued sections
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-session-start.test.sh(full suite, 34 tests, 0 failures)test_backlog_compact_beads_shows_inflight_and_queued_sections — asserts '## In flight'/'## Queued' headings, both fleet:firstmate-scoped queries with --limit 80, and both sections' items presenttest_backlog_compact_beads_partial_failure_falls_back_to_manual — asserts a failing In-flight beads read triggers full title-line fallback rather than a partial digestManual end-to-end run of bin/fm-session-start.sh against a fake beadstaskCLI (same fixtures as the test suite) to capture the real digest transcript a captain would seeSource-diff of bin/fm-session-start.sh between base and target commits confirmed only print_backlog_beads_compact changedLive A/B run of the tasks-axi (default) backend path against both the base and target fm-session-start.sh, diffed after normalizing volatile tmp-path/pid text — byte-identical✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation