Skip to content

refactor(mux)!: extract the herdr backend to pbean/bmad-loop-adapter-herdr#146

Merged
pbean merged 2 commits into
mainfrom
refactor/extract-herdr-adapter
Jul 15, 2026
Merged

refactor(mux)!: extract the herdr backend to pbean/bmad-loop-adapter-herdr#146
pbean merged 2 commits into
mainfrom
refactor/extract-herdr-adapter

Conversation

@pbean

@pbean pbean commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

The herdr backend (engine run path #136, TUI-launch surface #137) moves out of core to pbean/bmad-loop-adapter-herdr before ever shipping in a release. The adapter registers through the bmad_loop.mux_backends entry-point discovery that #145 added: co-install it with bmad-loop and herdr appears in bmad-loop mux exactly as before. Core now bundles only tmux — _load_builtin_backends() is tmux-only again.

Second and final PR of the extraction pair (#145 was the discovery seam).

BREAKING CHANGE: bmad_loop.adapters.herdr_backend is gone (it never shipped in a release); install bmad-loop-adapter-herdr alongside bmad-loop instead.

Removed

  • src/bmad_loop/adapters/herdr_backend.py plus its four test files (test_herdr_backend, test_herdr_poller, test_herdr_integration, test_herdr_e2e) — they continue as the adapter repo's backend.py + suite, where the live-herdr integration and E2E tests still run (81 tests, CI green there).

Kept deliberately

  • The seam docstrings, probe.py gate comment, and tui/launch.py note that cite herdr as the external worked example.
  • force_tmux_backend (all 9 use sites) and the win32-matching rationale comments in the registry/launch tests: an installed external backend may match win32 (the herdr adapter does), so these pin selection against exactly that leak.
  • test_backend_registry gains test_win32_bottoms_out_at_tmux_with_no_externals, pinning the win32 fallback reversal now that nothing bundled matches win32.

Docs

  • multiplexer-backends.md's herdr section becomes External backends (install recipe + adapter-repo links).
  • README / FEATURES / docs index / setup guide / TUI guide / ROADMAP / porting guide / authoring guide now name herdr as an external adapter and link its operator guide for the seat-level differences (detach chord ctrl+b q, polled logs, state sidecar).
  • CHANGELOG [Unreleased] herdr bullets collapse into one extraction entry; released sections untouched.

Tests

24 files, +209/−3186. Full suite: 2248 passed + 1 skipped in both inside-tmux and TMUX-less environments (delta vs #145's 2327 = the extracted herdr tests); full trunk check clean.

After merge

Summary by CodeRabbit

  • New Features

    • Added a pluggable terminal multiplexer backend system.
    • Bundled tmux remains the default, while external backends can be installed and registered automatically.
    • Added availability-aware backend selection with environment, saved settings, platform defaults, and fallback matching.
  • Documentation

    • Updated setup, configuration, adapter-authoring, platform, and multiplexer guides to describe external backend installation and selection.
    • Documented a consistent window-target format across multiplexer backends.
  • Refactor

    • Removed the previously bundled Herdr implementation; Herdr is now provided separately.

…herdr

The herdr backend (engine run path #136, TUI-launch surface #137) moves out
of core to pbean/bmad-loop-adapter-herdr before ever shipping in a release.
The adapter registers through the bmad_loop.mux_backends entry-point
discovery (previous commit): co-install it with bmad-loop and 'herdr'
appears in `bmad-loop mux` exactly as before. Core now bundles only tmux —
_load_builtin_backends() is tmux-only again.

Removed: adapters/herdr_backend.py plus its four test files; they continue
as the adapter repo's backend.py + suite, where the live-herdr integration
and E2E tests still run. test_backend_registry gains
test_win32_bottoms_out_at_tmux_with_no_externals pinning the win32 fallback
reversal now that nothing bundled matches win32.

Kept deliberately: the seam docstrings, probe.py gate comment, and
tui/launch.py note that cite herdr as the external worked example, and the
win32-matching rationale comments in tests — an installed external backend
may match win32 (the herdr adapter does), so force_tmux_backend and the
registry/launch tests pin selection against exactly that leak.

Docs: multiplexer-backends.md's herdr section becomes 'External backends'
(install recipe + adapter-repo links); README / FEATURES / docs index /
setup guide / TUI guide / ROADMAP / porting guide / authoring guide now name
herdr as an external adapter and link its operator guide for the seat-level
differences (detach chord ctrl+b q, polled logs, state sidecar). CHANGELOG
[Unreleased] herdr bullets collapse into one extraction entry.

BREAKING CHANGE: bmad_loop.adapters.herdr_backend is gone (it never shipped
in a release); install bmad-loop-adapter-herdr alongside bmad-loop instead.
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@pbean, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9491690a-bfd7-4319-b3bd-d8ed5d17cd17

📥 Commits

Reviewing files that changed from the base of the PR and between 9e6cc64 and 841766d.

📒 Files selected for processing (3)
  • README.md
  • docs/adapter-authoring-guide.md
  • docs/multiplexer-backends.md

Walkthrough

The PR removes the in-repository Herdr multiplexer and its tests, leaving tmux as the only bundled backend. Documentation and tests now describe externally installed, entry-point-registered backends and the canonical multiplexer target contract.

Changes

Multiplexer backend transition

Layer / File(s) Summary
Built-in registry and backend removal
src/bmad_loop/adapters/multiplexer.py, src/bmad_loop/adapters/herdr_backend.py, tests/test_herdr_*
The built-in registry now loads only TmuxMultiplexer; the Herdr implementation and Herdr-specific test modules are removed.
Registry and test alignment
tests/test_backend_registry.py, tests/test_multiplexer.py, tests/conftest.py, tests/test_cli.py, tests/test_tui_app.py, tests/test_policy.py
Tests and fixtures reflect externally discovered backends, tmux fallback behavior, generalized backend errors, and empty-window target encoding.
Backend architecture documentation
CHANGELOG.md, docs/multiplexer-backends.md, docs/ROADMAP.md, docs/porting-to-a-new-os.md, docs/adapter-authoring-guide.md
Documentation describes external backend registration, the target contract, Herdr’s adapter location, and availability semantics.
User-facing documentation
README.md, docs/FEATURES.md, docs/README.md, docs/setup-guide.md, docs/tui-guide.md
User guidance now presents tmux as bundled and other multiplexers as separately installed and registered packages.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: dracic

Poem

I’m a rabbit in the backend lane,
Watching tmux remain the train.
Herdr hops to packages new,
Entry points guide the queue.
Targets match from call to call—
Carrots, docs, and tests for all!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: extracting the Herdr backend into the external adapter repository.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/extract-herdr-adapter

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.

@pbean

pbean commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 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 `@docs/adapter-authoring-guide.md`:
- Around line 101-104: Update the herdr adapter `backend.py` hyperlink in the
authoring guide to target the repository’s
`src/bmad_loop_adapter_herdr/backend.py` file directly, while preserving the
existing link text and surrounding documentation.

In `@docs/multiplexer-backends.md`:
- Around line 4-8: Update the tmux requirement paragraph in the multiplexer
documentation to state that tmux is required for launching, attaching, and
driving runs only when tmux is the selected backend. Preserve the existing
behavior description while making it clear that external backends, such as
Herdr, use their own session mechanism.

In `@README.md`:
- Line 42: Update the README platform requirement to state that a terminal
multiplexer is required, while describing tmux only as the bundled default;
preserve the existing external backend and registry details and align the
wording with docs/setup-guide.md.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 885537df-bb5e-435f-88dd-08c4bf780aa2

📥 Commits

Reviewing files that changed from the base of the PR and between 9d89efb and 9e6cc64.

📒 Files selected for processing (24)
  • CHANGELOG.md
  • README.md
  • docs/FEATURES.md
  • docs/README.md
  • docs/ROADMAP.md
  • docs/adapter-authoring-guide.md
  • docs/multiplexer-backends.md
  • docs/porting-to-a-new-os.md
  • docs/setup-guide.md
  • docs/tui-guide.md
  • src/bmad_loop/adapters/herdr_backend.py
  • src/bmad_loop/adapters/multiplexer.py
  • tests/conftest.py
  • tests/test_backend_registry.py
  • tests/test_cli.py
  • tests/test_generic_tmux.py
  • tests/test_herdr_backend.py
  • tests/test_herdr_e2e.py
  • tests/test_herdr_integration.py
  • tests/test_herdr_poller.py
  • tests/test_multiplexer.py
  • tests/test_policy.py
  • tests/test_tui_app.py
  • tests/test_tui_launch.py
💤 Files with no reviewable changes (6)
  • src/bmad_loop/adapters/herdr_backend.py
  • tests/test_herdr_integration.py
  • tests/test_herdr_e2e.py
  • tests/test_herdr_poller.py
  • tests/test_multiplexer.py
  • tests/test_herdr_backend.py

Comment thread docs/adapter-authoring-guide.md
Comment thread docs/multiplexer-backends.md
Comment thread README.md
Three CodeRabbit findings on #146, all confirmed: README requirements
listed tmux as unconditionally mandatory and multiplexer-backends.md's tmux
section said the same — both now say a terminal multiplexer is required
with tmux as the bundled default, matching setup-guide.md. The authoring
guide's backend.py link pointed at the adapter repo root instead of the
file.
@pbean pbean merged commit 73ce62f into main Jul 15, 2026
9 checks passed
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.

1 participant