Skip to content

Show herdr plugin pane tokens in the sidebar (#1209) - #1341

Merged
devswha merged 3 commits into
mainfrom
work/3-show-herdr-plugin-pane-tokens-
Oct 18, 2026
Merged

devswha merged 3 commits into
mainfrom
work/3-show-herdr-plugin-pane-tokens-

Conversation

@devswha

@devswha devswha commented Oct 18, 2026

Copy link
Copy Markdown
Owner

HWU-3 is finished: agent rows in the sidebar now show what herdr plugins attach to a pane (#1209). It's one commit on the branch (fc7d9e3), and the message says Closes #1209. The earlier stop was the weekly usage limit, not a fault in the code; I picked up from what was on disk.

What users see

  • The line itself: a pane's plugin values (for example the Quota plugin's 5h 95% · Wk 67%, or a task's progress) appear as a small dim line under its agent row. This works in both One line (the default) and Two lines mode, and only on panes that have values.
  • Long and unsafe values: values are shown as plain text, never HTML. Long ones are cut, and the full text is in the row's hover tooltip and in the phone's ⋯ sheet. Empty values show nothing, and a disconnected PC shows none.
  • Follows herdr's config: the server reads the $name tokens and their hide rules from your herdr [ui.sidebar.agents] rows (including per-agent rows). If no rows are set, every value is shown. As in herdr's own sidebar, the config of the PC running the web UI applies to remote PCs too.
  • Live updates: values change as herdr reports them. A plugin's line for the agent (display_agent) already showed in the row; it now also updates immediately. Before, it could lag up to 5 seconds, because herdr announces that change as a status event with an unchanged status.

Checks

  • The new tests pass. They cover the value picker and herdr's rule matching, the config reader, the event stream, the row rendering, and an integration test against the isolated test herdr session.
  • A new browser check on the demo data passes on desktop and phone in both row modes. Four existing sidebar and settings browser checks pass; sidebar-activity fails the same way on the unchanged base commit.
  • bun run check fast: typecheck and build pass. Unit tests: 4382 pass, 2 fail, neither caused by this change: install-star fails the same way on the base commit on this Mac, and portal passed when rerun.
  • I couldn't run the herdr-backed check lanes because another task held the only slot on this PC. I ran the main API, watch and token integration suites directly on the test session instead: 137 pass, and the 1 failure also fails on the base commit.

I wrote a page with the demo screenshots: /Users/devswha/.herdr-projects/reports/herdr-web-ui/3/index.html

Also noticed

  • scripts/ci-tests.ts: the unit runner only picks up *.test.ts, so src/components/*.test.tsx (AgentMark, TurnTime, …) never run in CI.
  • scripts/install-star.test.ts: "opens nothing on a PC with no display and no BROWSER" fails on macOS.
  • scripts/sidebar-activity-demo-regression.ts: times out waiting for the checkout-api workspace menu on this Mac.
  • server/api.contract.test.ts: "creates, edits, searches, inspects, and closes an owned workspace" doesn't find mention.txt locally.
  • server/portal.test.ts: "rechecks cancellation after awaiting the relay" failed once under the parallel unit run.

Task: HWU-3 (herdr-web-ui/3)

devswha and others added 2 commits October 18, 2026 20:13
herdr plugins attach short text values to a pane (`herdr pane report-metadata
--token name=value`): the Quota plugin's usage left, herdr-projects' summary and
progress. herdr's TUI draws them where the user's `[ui.sidebar.agents]` rows name
`$name`; the web UI drew none.

- Agent rows draw the pane's tokens as a small dim line of their own under the
  place, on One line and Two lines alike, only where the pane has one. Values are
  text, never markup; long ones are cut, and the row's tooltip and a phone's ⋯
  sheet say them whole. A disconnected PC draws none, as it draws no state.
- The design follows herdr's own sidebar: server/herdr-sidebar.ts reads the
  `$name` tokens (and their `hide` rules) of `[ui.sidebar.agents]` `rows` and
  `rows_by_agent` from herdr's config.toml (HERDR_CONFIG_PATH, XDG_CONFIG_HOME,
  then %APPDATA% or ~/.config), re-reads it when it changes while a browser
  listens, and tells it on the machine events as `herdr-sidebar`. Like herdr's
  sidebar it is this PC's config, applied to every PC's agents. Where no rows are
  set, every token is drawn, by name. herdr's colors and weights are not drawn.
- Tokens already reach the client in herdr's snapshot and refresh on
  pane.updated. A plugin's `display_agent` alone comes only as a status event of
  the same status (live, herdr 0.9.3), so the collector now refreshes clients
  when that line changes instead of waiting for the 5 s poll.

Tests: the token picker and herdr's rule semantics, the config reader and its
watcher, the event stream, the collector's display_agent refresh, the row's
rendering, a contract test against the isolated test herdr, and a demo browser
regression with screenshots (scripts/sidebar-tokens-demo-regression.ts).

Closes #1209

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eba4202d-5362-4483-9097-adfb9febd040
📥 Commits

Reviewing files that changed from the base of the PR and between b5cdbdb and 66048cb.

📒 Files selected for processing: 23
  • DESIGN.md
  • changelog.d/sidebar-plugin-tokens.md
  • docs/development.md
  • scripts/ci-browser.sh
  • scripts/ci-browser.test.ts
  • scripts/sidebar-tokens-demo-regression.ts
  • server/collector.test.ts
  • server/collector.ts
  • server/herdr-sidebar.test.ts
  • server/herdr-sidebar.ts
  • server/index.ts
  • server/machine-api.ts
  • server/pane-tokens.contract.test.ts
  • shared/machines.ts
  • shared/pane-tokens.test.ts
  • shared/pane-tokens.ts
  • src/App.tsx
  • src/components/AgentSidebar.css
  • src/components/AgentSidebar.test.ts
  • src/components/AgentSidebar.tsx
  • src/components/RowMenu.css
  • src/components/RowMenu.tsx
  • src/lib/agentRowTokens.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • New Features
    • Agent sidebar rows can display pane plugin status values beneath the agent’s title and context. Values follow configured row order and visibility rules, with all available values shown by name when no rows are configured.
    • Status values update live, appear in tooltips and the phone’s row sheet, and are omitted for away PCs. Long values are truncated in the sidebar while remaining available in full in the details.
    • Agent-provided context text appears alongside the agent’s place and updates live.

The server now reads herdr agent-row settings and sends configuration and pane status updates to the browser. Agent rows display selected plugin token values, with full values available in tooltips and phone sheets. Regression tests cover configuration parsing, event delivery, and rendering.

Changes: Sidebar Plugin Token Display

Layer / File(s) Summary
Token layout contracts and configuration
shared/pane-tokens.ts, shared/pane-tokens.test.ts, server/herdr-sidebar.ts, server/herdr-sidebar.test.ts
Shared helpers select and filter token values. The server parses herdr row settings, resolves the configuration path, and monitors parsed configuration changes.
Status collection and configuration events
server/collector.ts, server/collector.test.ts, shared/machines.ts, server/index.ts, server/machine-api.ts, server/pane-tokens.contract.test.ts, src/App.tsx
The collector parses and tracks display_agent. The machine event stream sends initial and updated sidebar layouts, and the browser handles those events.
Agent-row rendering and regression coverage
src/lib/agentRowTokens.ts, src/components/AgentSidebar.*, src/components/RowMenu.*, scripts/sidebar-tokens-demo-regression.ts, scripts/ci-browser.sh, scripts/ci-browser.test.ts, docs/development.md, DESIGN.md, changelog.d/sidebar-plugin-tokens.md
The sidebar renders resolved tokens and includes them in tooltips and phone sheets. Unit and browser tests cover display behavior, filtering, and live updates; documentation and changelog describe the feature.

Priority: ⬇️ Low

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

Change: Feature

Suggested reviewers: sergiorademacher, kilhyeonjun

Merge Risk: ⚪ Minimal · up to 66048

No confirmed issue currently blocks merging. The event-stream test’s server setup could not be fully assessed.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 43.48% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 18 files. (5 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: showing herdr plugin pane tokens in the sidebar.
Description check Passed The description explains the user-facing behavior, configuration rules, live updates, issue reference, and validation results. It provides the required change and validation information, including con…
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.
Full details: Description check

Explanation

The description explains the user-facing behavior, configuration rules, live updates, issue reference, and validation results. It provides the required change and validation information, including contract-test coverage and known unrelated failures.

Full details: Docstring Coverage

Explanation

Docstring coverage is 43.48% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 18 files. (5 skipped: 5 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@devswha

devswha commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Review 1 · Pass

Does the change do what the task asked? Yes. Gate: major and worse must be fixed.

The change carries pane tokens through to the agent sidebar and presents them safely in desktop and phone layouts. The live isolated herdr test and demo browser checks passed; the full fast check had two unrelated unit test failures on this host, so the whole repository suite is not green here.

No findings.

@devswha
devswha marked this pull request as ready for review October 18, 2026 11:23
@devswha

devswha commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Review 2 · Pass

Does the change do what the task asked? Yes. Gate: major and worse must be fixed.

The change meets the requested behavior in the inspected server, shared contract, and sidebar paths. Focused server and UI tests passed, and the demo browser regression exercised live updates, configured token selection, long values, plain text rendering, and phone layouts. I found no qualifying faults; the full repository check suite was not run.

No findings.

@devswha
devswha merged commit 97a4803 into main Oct 18, 2026
17 checks passed
@devswha
devswha deleted the work/3-show-herdr-plugin-pane-tokens- branch October 18, 2026 13:12
devswha added a commit that referenced this pull request Oct 19, 2026
…e rows

The phone sheet scrolls long token values instead of pushing its actions out, an open sheet reads its row at each render, a recovery resets the display_agent baseline to the resynced snapshot, and a token named twice in herdr's rows shows at the first place that does not hide it. Refs #1349.
devswha added a commit that referenced this pull request Oct 19, 2026
…e rows (#1402)

Refs #1349 (items 1, 2, 3 and 5; item 4, hide-rule operands on the
machine events, touches what watch-only browsers receive and goes in its
own PR).

## Change

Follow-ups to #1341 (plugin pane tokens in the sidebar, not released
yet, so no changelog fragment: `changelog.d/sidebar-plugin-tokens.md`
still describes the feature).

1. **Long token values no longer push the phone sheet's actions away.**
`.row-sheet-detail` is capped at a third of the screen and scrolls.
Before, 32 long tokens filled the sheet: the title scrolled off the top
and Pin agent sat under Cancel, out of reach. This follows the iOS
action sheet (and the Claude and Codex apps' long-press sheets): a long
message scrolls, the actions stay put.
2. **An open phone sheet follows its row.** `AgentSidebar` kept a copy
of the title, place and tokens taken when the menu opened. The menu now
keeps only which row and anchor, and reads what it says from the row at
each render, so a changed value, a hide rule that now applies or a PC
going away shows in the open sheet too.
3. **A plugin line (`display_agent`) after a recovery is measured
against what clients show.** The collector's dedupe baseline was seeded
only for panes it had never seen, so after a lost subscription the
baseline stayed at the line heard before the loss. A change back to that
line then looked like no change, and the sidebar waited for the next
roster poll. On a resync, which already tells clients to read the panes
again, the baseline now takes the snapshot's line, except for panes an
event has spoken for since the snapshot was asked.
4. **A token named twice in herdr's rows shows if any of its places
shows it.** `server/herdr-sidebar.ts` kept only the first place of a
token, so a token hidden by its first place's rule showed nowhere,
though herdr tests each place on its own (`src/ui/sidebar/tokens.rs`
maps every row entry independently). The parser now keeps each place,
and `paneTokenValues` says a token once, at the first place whose rules
leave it shown. The `herdr-sidebar` machine event may now list a name
more than once; an older browser reading it keeps the first place, as
before.

## Validation

- `bun run check fast`: workflow syntax, generated types and themes,
typecheck, build, unit tests (4504 pass, 0 fail, 8 skip).
- New unit cases: `shared/pane-tokens.test.ts` (a token named twice),
`server/herdr-sidebar.test.ts` (each place kept, updated from "each
once"), `server/collector.test.ts` (an event after a recovery). The
collector case times out against main's `server/collector.ts` and passes
with this change.
- `scripts/sidebar-tokens-demo-regression.ts` (demo fixture, no live
session) gained two phone checks: the open sheet's detail follows a
changed value, and with 32 long tokens the sheet's title, Pin agent and
Cancel are on screen and hit-testable while the detail scrolls. All four
desktop and phone passes are green. Both checks failed on main when
reproduced by hand before the fix (Pin agent covered by Cancel; sheet
kept `40% 12m · 5h 95%` after the row changed).
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