Skip to content

feat: add Chief fleet picker - #1

Merged
khaliqgant merged 2 commits into
mainfrom
codex/t3-chief-fleet-picker
Aug 7, 2026
Merged

feat: add Chief fleet picker#1
khaliqgant merged 2 commits into
mainfrom
codex/t3-chief-fleet-picker

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Aug 7, 2026

Copy link
Copy Markdown
Member

Summary

  • add a fleet plugin entrypoint that project-scoped lists live agents with agent-relay node agent list
  • create a dedicated Relay fleet Herdr workspace with one Chief-cwd attach pane per listed agent
  • attach ordinary agents with agent-relay node agent attach and the resident Chief with sh scripts/chief.sh brain
  • project broker current_state through pane.report_agent, map to idle|working|blocked|unknown (never done), poll every five seconds, and report only mapped changes
  • keep broker-down failures readable and document the workflow

T1 bridge/setup/status-forwarding implementation is unchanged. This PR does not apply the herdr-plugin GitHub topic.

Acceptance and verification

Named T3 assertions:

  • fleet picker opens exactly one Chief-cwd attach pane per live broker agent
  • status polling reports the initial projection once and then only broker changes
  • maps authoritative broker states to Herdr states without emitting done
  • lists agents project-scoped and replaces raw broker-down errors with a readable failure
  • fleet picker failure waits for dismissal when its pane is interactive
  • fleet panes attach through agent-relay while the resident Chief uses chief.sh
  • fleet agent gives the attach process the pane TTY and project cwd
  • a failed status report is retried instead of suppressing the broker change

Automated evidence:

  • node --test test/fleet.test.mjs: 11 passed, 0 failed
  • npm test: 25 passed, 0 failed, 1 Windows-only skip
  • node --check on all three new runtime modules
  • git diff HEAD --check: clean
  • secrets-pattern scan: clean
  • npm audit --omit=dev: 0 vulnerabilities

Live evidence against the real Chief broker:

  • project-scoped discovery returned 6 live agents and identified chief-khaliq as the resident Chief
  • a temporary Herdr pane at the Chief cwd attached marketing-lead --mode view; the real Claude TUI streamed intact
  • herdr pane get and herdr agent list both showed agent=claude, agent_status=idle
  • the temporary live-check workspace was closed afterward
  • running discovery from /private/tmp produced the readable broker recovery message rather than the raw missing-connection error

Review gate disclosure

NOT SATISFIED: the AGENTS.md Veto gate is not satisfied. The Veto MCP tools, including veto_diff_review, were unavailable in this session, so no Veto verdict exists.

Before intent-to-add, git diff HEAD would not include the four untracked files (dist/fleet.mjs, dist/fleet-picker.mjs, dist/fleet-agent.mjs, and test/fleet.test.mjs), so a diff-based review at that point would have been blind to the new runtime and test code. Before the final complete diff review, all four were made visible with git add -N; the resulting 737-line HEAD diff was then reviewed manually and checked as described above. This does not substitute for or satisfy the unavailable Veto gate.

Low-severity design assumptions

  • agent-relay resolves from the pane process PATH.
  • scripts/chief.sh is intentionally relative and therefore relies on the plugin opening the pane with the Chief project as its cwd.

Summary by cubic

Adds a Chief fleet picker that turns a project-scoped agent-relay broker into a Herdr workspace by opening one attached pane per live agent and projecting broker state into each pane. Makes it easy to view live status and attach to agents directly from Herdr.

  • New Features

    • Added fleet entrypoint: discovers agents via agent-relay node agent list in the project cwd (from Herdr context or HERDR_RELAY_PROJECT_DIR), creates a “Relay fleet” workspace, and opens one tab per live agent.
    • Projects broker state via pane.report_agent with 5s polling and change-only updates; maps idle|working|blocked_on_send|blockedidle|working|blocked, everything else → unknown (never done).
    • Attaches ordinary agents with agent-relay node agent attach; launches the resident Chief via scripts/chief.sh brain. Attach mode is configurable with HERDR_RELAY_ATTACH_MODE (view|drive|passthrough).
    • Graceful broker-down handling: shows a short recovery message with start commands and waits for Enter to dismiss when interactive.
    • Manifest: new panes fleet and fleet-agent (Linux/macOS); README updated; tests added for picker, attach, mapping, and docs.
  • Bug Fixes

    • Picker no longer pre-seeds pane state; the pane’s first poll is authoritative to avoid race conditions.

Written for commit 30646ec. Summary will update on new commits.

Review in cubic

@cursor

cursor Bot commented Aug 7, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request documents and exposes an optional fleet entrypoint. It adds tests for broker discovery, state polling, pane creation, agent attachment, project resolution, recovery, and manifest wiring.

Changes

Fleet entrypoint

Layer / File(s) Summary
Fleet contract and entrypoints
README.md, herdr-plugin.toml, package.json, test/fleet.test.mjs
Documents the fleet and fleet-agent entrypoints, commands, pane behavior, platform support, configuration, polling, state mapping, and recovery handling. Manifest tests verify the entrypoint metadata and README behavior statements.
Fleet picker and broker state
test/fleet.test.mjs
Tests project-scoped agent listing, JSON parsing, broker errors, picker pane creation, state projection, polling, cleanup, focus, and retry behavior.
Agent attachment and project resolution
test/fleet.test.mjs
Tests worker and Chief attach commands, process execution, project directories, inherited TTY behavior, and completion after child exit.

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

Poem

I’m a rabbit checking panes in a row,
Watching broker states change and show.
Chief gets a tab; workers attach.
Polls report changes and retry each match.
Fleet hops onward, clear and bright.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly identifies the main change: adding a Chief fleet picker.
Description check ✅ Passed The description directly explains the fleet entrypoint, agent attachment, status projection, error handling, and verification.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/t3-chief-fleet-picker

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.

@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: 2

🧹 Nitpick comments (1)
test/fleet.test.mjs (1)

143-150: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Assert the picker-to-agent environment contract.

runFleetAgent requires HERDR_RELAY_AGENT_NAME, HERDR_RELAY_AGENT_LABEL, and HERDR_RELAY_ATTACH_MODE. This test checks only HERDR_RELAY_RESIDENT_CHIEF. Assert these values for every plugin.pane.open request so a broken picker environment mapping cannot pass this suite.

🤖 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 `@test/fleet.test.mjs` around lines 143 - 150, Update the assertions for each
open request in the loop over opens to also validate the picker-to-agent
environment contract: assert HERDR_RELAY_AGENT_NAME, HERDR_RELAY_AGENT_LABEL,
and HERDR_RELAY_ATTACH_MODE in open.params.env. Keep the existing resident-chief
assertions and use the expected mapped values for each request so all
plugin.pane.open calls are covered.
🤖 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 `@README.md`:
- Around line 130-136: Update the “Open the local broker fleet” instructions
near the herdr plugin command to state that the fleet entrypoint is supported
only on Linux and macOS, and cannot be opened on Windows.

In `@test/fleet.test.mjs`:
- Around line 72-78: Update the picker failure test around fleetPickerMain to
inject BrokerUnavailableError through listAgents instead of relying on default
runtime dependencies, and capture console.error during execution. Assert the
error output includes the project directory and “agent-relay node up”, while
preserving the existing dismissed and process.exitCode assertions.

---

Nitpick comments:
In `@test/fleet.test.mjs`:
- Around line 143-150: Update the assertions for each open request in the loop
over opens to also validate the picker-to-agent environment contract: assert
HERDR_RELAY_AGENT_NAME, HERDR_RELAY_AGENT_LABEL, and HERDR_RELAY_ATTACH_MODE in
open.params.env. Keep the existing resident-chief assertions and use the
expected mapped values for each request so all plugin.pane.open calls are
covered.
🪄 Autofix

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 Plus

Run ID: da0c4ed6-81ce-4155-b707-4a6b7336bd77

📥 Commits

Reviewing files that changed from the base of the PR and between 4f0cf1f and 3ec58d7.

⛔ Files ignored due to path filters (3)
  • dist/fleet-agent.mjs is excluded by !**/dist/**
  • dist/fleet-picker.mjs is excluded by !**/dist/**
  • dist/fleet.mjs is excluded by !**/dist/**
📒 Files selected for processing (4)
  • README.md
  • herdr-plugin.toml
  • package.json
  • test/fleet.test.mjs

Comment thread README.md
Comment thread test/fleet.test.mjs

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ec58d760b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread dist/fleet-picker.mjs Outdated

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 7 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread test/fleet.test.mjs
Comment thread README.md Outdated
@khaliqgant
khaliqgant merged commit 24afb6d into main Aug 7, 2026
5 checks passed
khaliqgant added a commit that referenced this pull request Aug 7, 2026
Brings in #1 (fleet picker) and its review fixes now that main carries them.

One conflict, confined to dist/fleet-picker.mjs's import block. Resolved by
keeping T3's body — the picker no longer calls pane.report_agent or sets
HERDR_RELAY_INITIAL_STATE, leaving the pane's own projector as the single writer
of its agent state — and keeping T4's shared openedPane import. projectBrokerState
and brokerStateMessage are dropped: main deleted their only call sites in this
file, so retaining them would leave unused imports.

The two branches converged on the same principle from opposite ends: T3 removed
the picker's node-side status write, T4 declined to add one in the fleet node.
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