A city declares panes for its rig tabs in rexcity.toml #78
No reviewers
Labels
No labels
No milestone
No project
No assignees
2 participants
Due date
No due date set.
Dependencies
No dependencies set
Reference
mikluko/rexcity!78
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/rexcity-k6t90"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
rexcity.tomltakes panes for every rig's tab,[[rig_tab.pane]]with alabeland acommand, declared once for all rigs. The city will declarelabel = "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 ownrexcity.tomlare 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_ROOTin 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.beadsis, 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-runningdoes 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) andOpenView(acp) go through the sameopenPane, 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:
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;placeAnchortakes the declared blocks to leave out, andsideAnchoris 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. Arexcity.tomlwithout 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.tomlfor 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.tomlis parsed once for both sections;ensureCityPanesis split intoaddMissingPanesandcloseUnwantedPanesover apaneSet, which the rig path reuses. The city tab's behaviour and its warnings are unchanged.internal/rpp/tabs.go:openPanekeeps a rig tab's panes,findTabfinds a rig's tab by its declared panes,placeAnchorleaves them out.internal/state:RigPanes,SaveRigPanes,RigPaneBlocks: one record.rig-panes.<sid>per session, by rig and label;pruneholds the tabs with these panes. A record that does not decode reads as none (the pane is opened again) instead of failing every start.Checks
go vet ./...(linux andGOOS=darwin),go test ./..., and the changelog check (v1.6.0, offline), all green locally. A stubrexthat exits non-zero was first onPATHfor 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_tabentries 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
Reviewed
510abd6(rig_tab declared panes) against the bead rexcity-k6t90; merge result with main8afa954passes go vet (linux, darwin), go test ./..., -race on internal/rpp and internal/state, and the changelog check v1.6.0.Reviewed head
510abd6against rexcity-k6t90. Merged as6a38c88(squash).What I checked:
[[rig_tab.pane]]withlabelandcommand, declared once for all rigs. The command runs through the existingpaneScript(/bin/sh, 5 s restart) inGC_RIG_ROOTfrom 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.citypanes.gomoves the TOML read intoreadDeclarations/validPanesand splitsensureCityPanesintoaddMissingPanes+closeUnwantedPanesover apaneSet. The city path keeps the same anchors, the same directory and the same warnings. No behaviour change, except thatrig_tabkeys are no longer reported as unknown.add/dropdo nothing,placeAnchor(nil)is the oldsideAnchor, and prune is unchanged. A new rig tab costs one extrawindowread. The acp view goes through the sameopenPane..rig-panes.<sid>JSON file (rig -> label -> block). It has no.jsonsuffix, soNames/LockedNames/Forgetnever 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, soobserve/stop/peek/nudge/is-attachedcannot confuse a declared pane with an agent's pane, and a declared pane keeps no agent's record alive.openTabandOpenViewboth hold the city lock, which keeps concurrent starts in one rig from racing.8afa954(tree identical to the head):go vet ./...(linux, darwin/arm64),go test ./...,go test -raceoninternal/rppandinternal/state, and changelog check v1.6.0 built from its tag: valid. A stubrexwas first on PATH and the live tests were not enabled. CI green on the head.[Unreleased]entry present. No new shell.Follow-ups (not blocking):
.rig-panesentry stay until the user closes the tab by hand. Stale entries whose blocks are gone are never pruned from the record.addMissingPanesoverwriteswwith the zero window when thewindowread 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.Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.