A city declares panes for its rig tabs in rexcity.toml #78

Merged
city-root merged 1 commit from worker/rexcity-k6t90 into main 2026-11-12 10:36:32 +00:00
Contributor

rexcity.toml takes panes for every rig's tab, [[rig_tab.pane]] with a label and a command, declared once for all rigs. The city will declare label = "beads", command = "bd list --watch --limit 10". This pull request holds the runtime change, its tests, the README section ("How sessions appear in Rex") and the CHANGELOG entry under [Unreleased]. The release and the city's own rexcity.toml are not part of it.

Answers to the bead's points

Where the rig's directory comes from, and when it is unknown. From GC_RIG_ROOT in the env gc gives the agent that starts (the same variable the forgejo and github pack's review formulas read as the rig's checkout): the checkout gc knows the rig by, where .beads is, never the agent's worktree. When the env has none, or it names a path that is not a directory, the rig's panes are skipped with a warning on the start's stderr, and a tab that already holds them keeps them. An agent's start never fails for these panes: a pane Rex cannot open, or a record that cannot be written or read, is a warning too.

The pane stays. It is no gc session (list-running does not show it). It keeps the rig's tab open when the last agent's pane closes, a start in another rig does not prune it, and the next start of an agent of the rig puts it back whenever it is missing. Both Start (tui) and OpenView (acp) go through the same openPane, so a Worker of either kind keeps it.

Placement rule. The declared panes are a column at the right edge of the tab at its full height: the first is split off the whole tab to the right, the next go below the one before (a missing one comes back below the nearest declared pane before it, else above the one after it). An agent's pane never splits a declared pane and never goes beside one: it splits the largest of the other panes, as before. The column therefore keeps half the tab's width however many Workers the tab holds. With nothing but declared panes in the tab (its agents stopped), the next agent goes to the left of all of them. I checked the shapes on the fake Rex:

  • one Worker: Worker on the left half, list on the right half;
  • two Workers: the two split the left half between them, the list is still the right half at full height;
  • five Workers: the left half is cut five ways, the list is still the right half at full height.

What this costs: the list gets half the tab's width, since Rex's split takes half, and the wrapper offers no ratio.

A tab without declared panes, the city tab and the acp box's pane (rexcity acp follow) are placed as before; placeAnchor takes the declared blocks to leave out, and sideAnchor is it with none.

Re-reading. The file is read at each start of an agent in the rig's tab. A pane no longer declared is closed then, after the agent's own pane is in, so a tab that held nothing else is not left empty before the agent has a place. Entries that cannot open get the city tab's warnings (rig_tab.pane N needs a label and a command; skipped, repeated label, unknown key); an unreadable file, or entries none of which can open, leaves the rig's panes as they are. A rexcity.toml without rig panes changes nothing for any rig tab (tested with no file, city panes only, and an empty file).

Opening every rig's tab when the city starts: left out. The runtime is told of nothing but one agent's start, with that agent's env. The rigs' names and paths live in gc's files (city.toml, .gc/site.toml), whose layout the runtime does not own, and nothing calls the runtime at a city start, so it would take a start hook of gc, or an agent of the city (the Operator's start, say) reading .gc/site.toml for every rig. It would also open a tab for every rig, suspended or never used. That is more than small and safe, so a rig's tab still opens with its first agent. The README says so.

How it is built

  • internal/rpp/rigpanes.go: reading [[rig_tab.pane]], the rig's directory, rigPanes (add, drop), rigPaneAnchor.
  • internal/rpp/citypanes.go: rexcity.toml is parsed once for both sections; ensureCityPanes is split into addMissingPanes and closeUnwantedPanes over a paneSet, which the rig path reuses. The city tab's behaviour and its warnings are unchanged.
  • internal/rpp/tabs.go: openPane keeps a rig tab's panes, findTab finds a rig's tab by its declared panes, placeAnchor leaves them out.
  • internal/state: RigPanes, SaveRigPanes, RigPaneBlocks: one record .rig-panes.<sid> per session, by rig and label; prune holds the tabs with these panes. A record that does not decode reads as none (the pane is opened again) instead of failing every start.
  • No new shell.

Checks

go vet ./... (linux and GOOS=darwin), go test ./..., and the changelog check (v1.6.0, offline), all green locally. A stub rex that exits non-zero was first on PATH for every run, so no test reached the live Rex server. New tests use the repository's fake Rex (extended so a split anchored at a whole tab can go right as well as left): a rig tab opening with the declared pane; a second and a third agent, and five; the last agent stopping and the tab staying, and the next agent going left of the list; a missing pane put back, one and both; a lost tab; a pane no longer declared closed, also when the tab held nothing else; the city tab unchanged; rig_tab entries that cannot open; an unknown or missing rig directory; an unreadable record; an acp view; a main pane in a rig tab.

Rebased onto main at 8afa954 (#77's status reports and #69 are in).

Bead: rexcity-k6t90

`rexcity.toml` takes panes for every rig's tab, `[[rig_tab.pane]]` with a `label` and a `command`, declared once for all rigs. The city will declare `label = "beads"`, `command = "bd list --watch --limit 10"`. This pull request holds the runtime change, its tests, the README section ("How sessions appear in Rex") and the CHANGELOG entry under `[Unreleased]`. The release and the city's own `rexcity.toml` are not part of it. ## Answers to the bead's points **Where the rig's directory comes from, and when it is unknown.** From `GC_RIG_ROOT` in the env gc gives the agent that starts (the same variable the forgejo and github pack's review formulas read as the rig's checkout): the checkout gc knows the rig by, where `.beads` is, never the agent's worktree. When the env has none, or it names a path that is not a directory, the rig's panes are skipped with a warning on the start's stderr, and a tab that already holds them keeps them. An agent's start never fails for these panes: a pane Rex cannot open, or a record that cannot be written or read, is a warning too. **The pane stays.** It is no gc session (`list-running` does not show it). It keeps the rig's tab open when the last agent's pane closes, a start in another rig does not prune it, and the next start of an agent of the rig puts it back whenever it is missing. Both Start (tui) and `OpenView` (acp) go through the same `openPane`, so a Worker of either kind keeps it. **Placement rule.** The declared panes are a column at the right edge of the tab at its full height: the first is split off the whole tab to the right, the next go below the one before (a missing one comes back below the nearest declared pane before it, else above the one after it). An agent's pane never splits a declared pane and never goes beside one: it splits the largest of the *other* panes, as before. The column therefore keeps half the tab's width however many Workers the tab holds. With nothing but declared panes in the tab (its agents stopped), the next agent goes to the left of all of them. I checked the shapes on the fake Rex: - one Worker: Worker on the left half, list on the right half; - two Workers: the two split the left half between them, the list is still the right half at full height; - five Workers: the left half is cut five ways, the list is still the right half at full height. What this costs: the list gets half the tab's width, since Rex's split takes half, and the wrapper offers no ratio. A tab without declared panes, the city tab and the acp box's pane (`rexcity acp follow`) are placed as before; `placeAnchor` takes the declared blocks to leave out, and `sideAnchor` is it with none. **Re-reading.** The file is read at each start of an agent in the rig's tab. A pane no longer declared is closed then, after the agent's own pane is in, so a tab that held nothing else is not left empty before the agent has a place. Entries that cannot open get the city tab's warnings (`rig_tab.pane N needs a label and a command; skipped`, repeated label, unknown key); an unreadable file, or entries none of which can open, leaves the rig's panes as they are. A `rexcity.toml` without rig panes changes nothing for any rig tab (tested with no file, city panes only, and an empty file). **Opening every rig's tab when the city starts: left out.** The runtime is told of nothing but one agent's start, with that agent's env. The rigs' names and paths live in gc's files (`city.toml`, `.gc/site.toml`), whose layout the runtime does not own, and nothing calls the runtime at a city start, so it would take a start hook of gc, or an agent of the city (the Operator's start, say) reading `.gc/site.toml` for every rig. It would also open a tab for every rig, suspended or never used. That is more than small and safe, so a rig's tab still opens with its first agent. The README says so. ## How it is built - `internal/rpp/rigpanes.go`: reading `[[rig_tab.pane]]`, the rig's directory, `rigPanes` (add, drop), `rigPaneAnchor`. - `internal/rpp/citypanes.go`: `rexcity.toml` is parsed once for both sections; `ensureCityPanes` is split into `addMissingPanes` and `closeUnwantedPanes` over a `paneSet`, which the rig path reuses. The city tab's behaviour and its warnings are unchanged. - `internal/rpp/tabs.go`: `openPane` keeps a rig tab's panes, `findTab` finds a rig's tab by its declared panes, `placeAnchor` leaves them out. - `internal/state`: `RigPanes`, `SaveRigPanes`, `RigPaneBlocks`: one record `.rig-panes.<sid>` per session, by rig and label; `prune` holds the tabs with these panes. A record that does not decode reads as none (the pane is opened again) instead of failing every start. - No new shell. ## Checks `go vet ./...` (linux and `GOOS=darwin`), `go test ./...`, and the changelog check (v1.6.0, offline), all green locally. A stub `rex` that exits non-zero was first on `PATH` for every run, so no test reached the live Rex server. New tests use the repository's fake Rex (extended so a split anchored at a whole tab can go right as well as left): a rig tab opening with the declared pane; a second and a third agent, and five; the last agent stopping and the tab staying, and the next agent going left of the list; a missing pane put back, one and both; a lost tab; a pane no longer declared closed, also when the tab held nothing else; the city tab unchanged; `rig_tab` entries that cannot open; an unknown or missing rig directory; an unreadable record; an acp view; a main pane in a rig tab. Rebased onto main at 8afa954 (#77's status reports and #69 are in). Bead: rexcity-k6t90
feat: a city declares panes for every rig's tab (rexcity-k6t90)
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 10s
test / go (pull_request) Successful in 1m45s
510abd6a37
The user wants 'bd list --watch --limit 10' open on every rig's tab, as the
city tab can already hold with [[city_tab.pane]]. A rig's tab held only its
agents' panes and closed with the last one, so no list could stay open between
Workers.

rexcity.toml now takes [[rig_tab.pane]] (a label and a command), declared once
for every rig. Each rig's tab holds a copy, run with /bin/sh in the rig's own
directory, taken from GC_RIG_ROOT in the env of the agent that starts (never its
worktree), and run again 5 s after it ends. The pane is no gc session: it keeps
the tab open when the last agent's pane closes, is put back at the next start of
an agent of the rig when it is missing, and is closed when no longer declared
(after the agent's own pane is in, so a tab that held nothing else is not left
empty). A start never fails for it: an unknown rig directory, an unreadable
record or a pane Rex cannot open is a warning, and an unreadable declaration
leaves the tab's panes as they are.

Placement: the declared panes are a column at the right edge of the tab at full
height (the first is split off the whole tab to the right, the next go below the
one before), and an agent's pane never splits one, so the column keeps half the
tab's width however many Workers it holds. With nothing but declared panes in
the tab, the next agent goes to the left of all of them. Tabs without declared
panes are placed exactly as before, and so is the city tab.

The declared panes' blocks are recorded per session and rig in .rig-panes.<sid>
(state.RigPanes), found by findTab so the tab is the rig's, and held by prune so
a start in another rig does not close it. ensureCityPanes is split into
addMissingPanes and closeUnwantedPanes, which the rig path reuses.

Opening every rig's tab when the city starts is left out: the runtime only sees
one agent's start, and the rigs live in gc's files (README says why).

Validation: go vet (linux and darwin), go test ./... with a stub rex first on
PATH; new tests over the fake Rex cover the tab opening, one/two/five Workers,
the last agent stopping, a missing pane put back, a pane no longer declared, the
city tab unchanged, an unknown rig directory, and acp views.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
city-root-review left a comment

Reviewed 510abd6 (rig_tab declared panes) against the bead rexcity-k6t90; merge result with main 8afa954 passes go vet (linux, darwin), go test ./..., -race on internal/rpp and internal/state, and the changelog check v1.6.0.

Reviewed 510abd6 (rig_tab declared panes) against the bead rexcity-k6t90; merge result with main 8afa954 passes go vet (linux, darwin), go test ./..., -race on internal/rpp and internal/state, and the changelog check v1.6.0.
Author
Contributor

Reviewed head 510abd6 against rexcity-k6t90. Merged as 6a38c88 (squash).

What I checked:

  • The bead's "Wanted" list, point by point. Declaration: [[rig_tab.pane]] with label and command, declared once for all rigs. The command runs through the existing paneScript (/bin/sh, 5 s restart) in GC_RIG_ROOT from the starting agent's env. If that is unset or not a directory, the pane is skipped with a warning and the start goes on. The pane is no gc session, holds the tab against prune, and is put back at the next start of an agent of the rig. Placement: a column at the right of the tab, never split by an agent's pane (placeAnchor), so the column keeps half the tab with 1, 2 or 5 Workers. A pane no longer declared is closed after the agent's pane is in. Opening every rig's tab at the city's start is left out, and the README explains why.
  • City tab: citypanes.go moves the TOML read into readDeclarations/validPanes and splits ensureCityPanes into addMissingPanes + closeUnwantedPanes over a paneSet. The city path keeps the same anchors, the same directory and the same warnings. No behaviour change, except that rig_tab keys are no longer reported as unknown.
  • A city with no file or no rig panes: add/drop do nothing, placeAnchor(nil) is the old sideAnchor, and prune is unchanged. A new rig tab costs one extra window read. The acp view goes through the same openPane.
  • State: a new .rig-panes.<sid> JSON file (rig -> label -> block). It has no .json suffix, so Names/LockedNames/Forget never treat it as a name. A 0.32.0 state directory reads as no rig panes, and a 0.32.0 binary ignores the file. Agent records are looked up by block, so observe/stop/peek/nudge/is-attached cannot confuse a declared pane with an agent's pane, and a declared pane keeps no agent's record alive. openTab and OpenView both hold the city lock, which keeps concurrent starts in one rig from racing.
  • Merge result with main 8afa954 (tree identical to the head): go vet ./... (linux, darwin/arm64), go test ./..., go test -race on internal/rpp and internal/state, and changelog check v1.6.0 built from its tag: valid. A stub rex was first on PATH and the live tests were not enabled. CI green on the head.
  • README section and [Unreleased] entry present. No new shell.

Follow-ups (not blocking):

  • A rig's tab now never closes on its own. When a rig is removed from the city, or the declaration is dropped and no agent of the rig starts again, its tab and its .rig-panes entry stay until the user closes the tab by hand. Stale entries whose blocks are gone are never pruned from the record.
  • addMissingPanes overwrites w with the zero window when the window read after a successful split fails. The agent's own split then fails with "tab has no pane". This is the same path as the city tab today, and it only happens when Rex fails at that moment.
  • The way the panes are placed when one is put back (root split to the right, then a third column) is tested only on the fake Rex. Check it on a real tab once the city declares the pane.

Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.

Reviewed head 510abd6 against rexcity-k6t90. Merged as 6a38c88 (squash). What I checked: - The bead's "Wanted" list, point by point. Declaration: `[[rig_tab.pane]]` with `label` and `command`, declared once for all rigs. The command runs through the existing `paneScript` (`/bin/sh`, 5 s restart) in `GC_RIG_ROOT` from the starting agent's env. If that is unset or not a directory, the pane is skipped with a warning and the start goes on. The pane is no gc session, holds the tab against prune, and is put back at the next start of an agent of the rig. Placement: a column at the right of the tab, never split by an agent's pane (`placeAnchor`), so the column keeps half the tab with 1, 2 or 5 Workers. A pane no longer declared is closed after the agent's pane is in. Opening every rig's tab at the city's start is left out, and the README explains why. - City tab: `citypanes.go` moves the TOML read into `readDeclarations`/`validPanes` and splits `ensureCityPanes` into `addMissingPanes` + `closeUnwantedPanes` over a `paneSet`. The city path keeps the same anchors, the same directory and the same warnings. No behaviour change, except that `rig_tab` keys are no longer reported as unknown. - A city with no file or no rig panes: `add`/`drop` do nothing, `placeAnchor(nil)` is the old `sideAnchor`, and prune is unchanged. A new rig tab costs one extra `window` read. The acp view goes through the same `openPane`. - State: a new `.rig-panes.<sid>` JSON file (rig -> label -> block). It has no `.json` suffix, so `Names`/`LockedNames`/`Forget` never treat it as a name. A 0.32.0 state directory reads as no rig panes, and a 0.32.0 binary ignores the file. Agent records are looked up by block, so `observe`/`stop`/`peek`/`nudge`/`is-attached` cannot confuse a declared pane with an agent's pane, and a declared pane keeps no agent's record alive. `openTab` and `OpenView` both hold the city lock, which keeps concurrent starts in one rig from racing. - Merge result with main 8afa954 (tree identical to the head): `go vet ./...` (linux, darwin/arm64), `go test ./...`, `go test -race` on `internal/rpp` and `internal/state`, and changelog check v1.6.0 built from its tag: valid. A stub `rex` was first on PATH and the live tests were not enabled. CI green on the head. - README section and `[Unreleased]` entry present. No new shell. Follow-ups (not blocking): - A rig's tab now never closes on its own. When a rig is removed from the city, or the declaration is dropped and no agent of the rig starts again, its tab and its `.rig-panes` entry stay until the user closes the tab by hand. Stale entries whose blocks are gone are never pruned from the record. - `addMissingPanes` overwrites `w` with the zero window when the `window` read after a successful split fails. The agent's own split then fails with "tab has no pane". This is the same path as the city tab today, and it only happens when Rex fails at that moment. - The way the panes are placed when one is put back (root split to the right, then a third column) is tested only on the fake Rex. Check it on a real tab once the city declares the pane. Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/rexcity!78
No description provided.