Skip to content

feat(herdr-core): rename, split and move workspaces and tabs where Ovis keeps the layout - #2799

Merged
devswha merged 5 commits into
mainfrom
feat/hc-parity-workspaces
Nov 5, 2026
Merged

devswha merged 5 commits into
mainfrom
feat/hc-parity-workspaces

Conversation

@devswha

@devswha devswha commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

What

On herdr-core, Ovis can now rename workspaces and tabs and move a one-pane tab to another workspace, wherever no Herdr app keeps the core's layout. The UI offers each layout action only where the PC's herdr answers it. Splitting stays off on herdr-core for now (#2812).

Why

The desktop app runs the server with OVIS_RUNTIME=herdr-core on its own hc session (ovis). No Herdr app arranges that core, yet every layout action was refused as unsupported and hidden behind one appLayout boolean.

What hc offers (0.1.17 OpenRPC schema)

hc has terminals, labels (terminal.label, where key= removes a label) and opaque docs. It has no workspace, tab or split methods. The adapter already groups terminals into workspaces and tabs by the herdr.space and herdr.tab labels when the herdr-app document does not place them, so:

herdr call herdr-core, no Herdr app document herdr-core, Herdr app document present
workspace.create, tab.create, *.close already supported; a new tab now carries its workspace's name already supported
workspace.rename, tab.rename ovis.workspace / ovis.tab label on each terminal in it unsupported (names are the app's)
pane.move (new_tab) relabels the terminal into the target workspace; it carries that workspace's name, so it never renames it. Refused for a helper going to Other terminals (it would still show under its parent) unsupported
pane.split unsupported: rects come from terminal grids, so split panes shrink each other (#2812) unsupported
tab.move, workspace.move, zoom, swap, resize, focus, worktrees unsupported (no order or geometry in hc) unsupported

"Ovis keeps the layout" is a fact read from hc: doc.get herdr-app has a null value (never written, or deleted). ping reports it as capabilities.layout = { rename, split, move }, with split always false for now. The client turns this into HerdrIdentity.layout (shared/machines.ts HerdrCoreLayout), and each call checks the same fact again before it changes anything.

UI

AppLayoutContext now carries a LayoutOffer (rename, split, move, arrange) instead of a boolean. appLayoutOf returns cached frozen objects, so the context value and hook dependencies keep the same identity between renders.

  • herdr TUI: every action, as before.
  • herdr-core where the Herdr app keeps the layout: none, as before.
  • herdr-core where Ovis keeps the layout: rename tab and workspace, move tab to workspace. No split, reorder, zoom, swap, divider drag, pane rename or worktree actions.

The menus are unchanged; they only follow VS Code-style when gating (an action is listed only where it can run).

Validation

  • Failing first: the new live contract test (server/herdr-core/live.test.ts, real isolated hc core) and each new adapter case failed before its change.
  • OVIS_TEST_HC_BIN=<hc 0.1.14> bun test server/herdr-core/ plus the UI gating tests: 179 pass, 0 fail.
  • hc 0.1.17: everything passes except the existing schema-pin test (it pins the 0.1.14 schema CI uses).
  • bun run check fast: pass on the final head (unit 11265 pass, 0 fail; typecheck, build, generated types and themes fresh).
  • Manual QA on a real Ovis server with an isolated hc 0.1.17 core: see the PR comment. Rename, move, the Herdr-app document switch and the menus pass; the split row failed, which is why split is off here.
  • Not run: check full, and a manual desktop-app session.

Follow-ups

…is keeps the layout

hc has no workspace, tab or split API. On a core whose herdr-app document
was never written (the desktop app's own core), the adapter keeps names,
splits and a pane's move to another workspace in terminal labels, and ping
reports which layout calls it answers. The UI gates each layout action on
that offer instead of one herdr-core boolean.
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 31 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 029780f and 95f57d9.

Files selected for processing: 20

  • changelog.d/hc-workspace-layout.md
  • server/herdr-core/adapter.test.ts
  • server/herdr-core/adapter.ts
  • server/herdr-core/live.test.ts
  • server/herdr/client.ts
  • shared/machines.ts
  • src/App.tsx
  • src/components/CommandPalette.appLayout.test.tsx
  • src/components/CommandPalette.tsx
  • src/components/MachineSidebar.tsx
  • src/components/PaneCanvas.appLayout.test.tsx
  • src/components/PaneCanvas.tsx
  • src/components/Sidebar.appLayout.test.tsx
  • src/components/Sidebar.tsx
  • src/components/TabStrip.appLayout.test.tsx
  • src/components/TabStrip.tsx
  • src/lib/layoutActions.test.ts
  • src/lib/layoutActions.ts
  • src/lib/machineContext.test.ts
  • src/lib/machineContext.tsx
  • 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

…e on new tabs, refuse a helper's move to Other terminals

Review round: a split records the pane it split (ovis.split=<dir>:<pane>) and
a label-made tab is tiled as that split tree; tab.create and pane.split carry
the workspace's name; moving a helper to Other terminals is refused, as its
parent's tab would still show it.
@devswha

devswha commented Nov 4, 2026

Copy link
Copy Markdown
Owner Author

Reviews and manual QA (head cdfae32)

Reviews: omo (BLOCK, no HIGH) and Codex Terra 6.1 fast xhigh (one unreproduced HIGH), each on both heads. One fix round was done (cdfae32): a workspace's name is kept on new tabs and splits, a helper's move to Other terminals is refused, and splits are recorded as <dir>:<pane> and laid out as a split tree. Failing-first tests cover each fix.

Manual QA on a real Ovis server, isolated hc 0.1.17 core (own session and state, loopback)

# Scenario Result
1 /api/health on a core with no Herdr app document PASS: layout: {rename, split, move: true}
2 Rename workspace and tab PASS: 200, names shown
3 New tab in a renamed workspace, then close the tab the name was given in PASS: the name stays
4 Move a one-pane tab to another workspace PASS: 200, the source workspace closes, the target's name is unchanged
5 Tab reorder, workspace reorder, zoom PASS: refused as unsupported, and not offered in the UI
6 Write the herdr-app document: health and rename PASS: layout all false, rename/split refused; clearing it restores them
7 Pane menu in the app on this core PASS: Split right, Split down, Close pane only
8 Split right, then split the left pane down, viewed in the app FAIL (see below)

Row 8 (blocking): split panes collapse. On a label-kept tab, each pane's layout rect is its terminal's own grid. The pane canvas sizes each cell from those rects, and the terminal attach then resizes the terminal to the cell, which changes the rect again. Within seconds, one pane's real terminal went 200x120, then 15x1, 12x1 and 8x1, leaving a one-row shell. Main never reached this, because pane.split was refused there. Fix direction: give label-kept tabs top-down geometry (divide a stable area by the split tree, as herdr's own splits do) instead of building it up from terminal grids.

Other findings (not fixed in this PR)

  • MEDIUM, reproduced: split, rename and move are offered on targets the adapter refuses (Other terminals, helper tabs). Tracked in herdr-core: hide split, rename and move on targets the adapter refuses (Other terminals, helper tabs) #2806.
  • HIGH (Codex), unreproduced: a check-then-write race if a Herdr app writes its document during a rename, split or move on this core. hc has no atomic label write to close it. The desktop app's core runs in its own hc session that no Herdr app opens.
  • MEDIUM, unreproduced: remote PCs read the layout flags only when the bridge is verified, so a document written later is seen after a reconnect.
  • LOW: a where label (only the Herdr app writes one) outranks Ovis's names; a pane split off one that closed moves to the right of the tab; tab order follows hc's terminal order.

…eir own

Panes of a label-kept tab take their rects from their terminals' grids, and
the attach sizes each terminal to its cell, so split panes shrank each other
(a shell went to one row). ping now reports layout.split false, pane.split
stays unsupported, and the split-tree layout goes until top-down geometry
lands.
…aces

# Conflicts:
#	src/components/CommandPalette.tsx
#	src/components/PaneCanvas.appLayout.test.tsx
@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Merge note: merged on the omo review (CLEAR at 95f57d9 after re-merging main, incl. a fix for three layout-offer checks that main's #2765 auto-merge broke, covered by failing-first tests), Codex rounds and green required checks. Splits on herdr-core follow in #2830.

@devswha
devswha merged commit 5341d98 into main Nov 5, 2026
24 checks passed
@devswha
devswha deleted the feat/hc-parity-workspaces branch November 5, 2026 00:54
devswha added a commit that referenced this pull request Nov 5, 2026
…ent, laid out top down (#2830)

Fixes #2812

Follows #2799 (merged); this branch has origin/main merged in.

## What

On a herdr-core no Herdr app arranges (the desktop app's own core), Ovis
now keeps the layout itself, and split panes no longer shrink each
other:

- **One Ovis-owned hc document, `ovis-layout`** (schema 1): ordered
`workspaces[]`, each with ordered `tabs[]`, each tab a split tree
(`{leaf}` or `{split: right|down, ratio, first, second}`) and `zoomed`.
Written as `doc.get` -> edit -> `doc.set(version)`, with one retry on
`conflict`. Membership and names stay in terminal labels (`herdr.space`,
`herdr.tab`, `ovis.*`), so a Herdr app started later still adopts the
terminals.
- **Top-down geometry**: every tab is cut from a fixed 1000x1000 area by
its tree and never by terminal `cols`/`rows`. This also applies to tabs
from the Herdr app's document, laid out by `size.weight`, with a `stack`
showing its active child and `hidden` nodes skipped. `splits[]` is
filled with herdr's path ids (`split_<n>_<path>`), so divider drag and
keyboard resize work unchanged.
- **Reconcile on every snapshot**: a leaf whose terminal is gone is
pruned, a terminal labeled into a tab without a leaf is appended to its
right, and a core with labels but no document (#2799's state) is laid
out from the labels. The document is first written on the first layout
change.
- **Re-enabled on Ovis-kept tabs**: `pane.split`,
`layout.set_split_ratio`, `pane.resize`, `pane.swap` (neighbour or
explicit), `pane.zoom`, `tab.move`, `workspace.move`, `pane.rename`
(`ovis.pane` label). `ping` reports `layout.split`/`layout.arrange` only
where hc's hello lists `doc.set` (capabilities come from
`hello.methods`, never from version strings). `HelloInfo` now carries
`methods`.
- **Read-only where the Herdr app arranges the core**: Ovis never writes
`herdr-app`. A `ovis-layout` written in an unknown schema is neither
read nor overwritten.
- UI: `LayoutOffer` gains `worktrees` (always false on herdr-core), so
`arrange` can turn on without offering worktrees.

## Why

Issue #2812: a pane's rect was its terminal's grid, the attach resized
the terminal to its cell, and the next snapshot read that grid back, so
nested splits collapsed (a shell went to 8x1). Labels alone can't hold
order, ratios or zoom, and they can't be written atomically across
terminals. That's why the order and tree live in one CAS document.

Public contract: `docs/herdr-core-layout.md` (labels table, document
format, reconcile and write rules); `docs/guide.md` herdr-core section
updated.

## Validation

- Failing first: the new `snapshot.test.ts` #2812 replay (split right,
then left pane down, viewers size terminals to their cells, three
snapshots must have identical rects) fails on #2799's head 2e9c37a
(rects follow the grids) and passes now.
- `bun test server/herdr-core/`: 165 pass, 0 fail (with the review-round
fixes, see the PR comment). The new adapter cases cover split right/down
as one tree, the CAS retry, ratio/resize/swap/zoom, reorder with Other
terminals last, prune/append, a foreign-schema document and the app
document refusing writes, and pane names.
- Live (`server/herdr-core/live.test.ts`, isolated hc core: own session,
state and socket): hc 0.1.14 (CI's pin) 7 pass / 0 fail. On hc 0.1.17
everything passes except the existing schema-pin test (it pins 0.1.14,
as noted in #2799). The live case splits right then down, attaches each
terminal at 15x1 / 56x29 (#2812's sizes) and checks the rects are
unchanged across snapshots.
- UI gating tests (CommandPalette, Sidebar, TabStrip, PaneCanvas,
layoutActions): pass.
- `bun run check fast`: pass on the merge with origin/main 89405e8
(unit 11312 pass, 0 fail). Review rounds and their fixes: see the PR
comments.
- Not run: `check full`, a manual desktop-app session.

## Follow-ups / known limits

- Two viewers of one terminal at different sizes (phone + desktop) still
trade `cols`/`rows`. That's a viewer-policy issue, not geometry.
- A Herdr app started later on an Ovis-arranged core adopts the
terminals and their grouping but not split ratios or order (documented
in the guide).
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