Skip to content

Make the default branch movable, and let the root and it open lines #1811

Done

Description

@yyhhyyyyyy

Today a Session's conversation is welded to main. When an agent opens a side line to try another approach, and that side line turns out to be the better one, there is no way to continue on it: main is the only line the Session's input, approvals, model and top bar point at, and the only line a client centres. The best a user can do is paste the side line's conclusions back into main, which loses the reasoning and tool results that made it better in the first place.

The design keeps main exactly where it is and adds a position in the tree above it. main stays the root: the same literal id, the same numbering, the same storage invariants, and every stored branch_id: "main" unchanged. The default branch is the line the Session's conversation is on: it starts as the root and moves only when the user asks. The root is shown as 起点 and the default branch as 主线, so the two never blur. The English name is default branch and the root is the root.

One fact records the choice: an event branch/default {branch, source} written on the root, which lives as long as the Session and cannot end. The App Server, the storage writer and restore all read that one fact, with no model in the loop. Moving it writes that event and at most two status notes, one to a non-root new default branch and one to a non-root old one, and touches no other line, so no other line's cached context prefix moves. The root receives none, because neither of its rules changes with the role.

The design ships in two stacked pieces, so each one can be reviewed for what it is.

Design 1, #1812: choosing the default branch. The fact, its restore and fork rules, the requests that resolve to it, and the end guards. Work already bound to a line stays on it: a pending approval keeps the line that asked, and an existing scheduled job keeps the branch_id it recorded. Only a new job with no target takes the current default branch, at creation. The root, the current default branch and every ancestor of the default branch are refused as end targets, whoever asks, because ending a line ends every line below it. A move and an end admit in one order, so a target whose ancestor is already ending is refused rather than closed by a cascade that already started. A line that becomes the default branch sends no idle notice to its opener and cannot end itself. A BranchSource kind records that a client created a line, distinct from a plugin's, and a line a client created before the upgrade keeps its stored kind and is not selectable. Who may open a line does not change in this piece.

Design 2, stacked: who may open a line, and the cap. The branch tool admits the root in every state, plus the current default line, and refuses every other line with its own code; a plugin line never opens one. The root keeps the right it has today, which is what lets a user ask the root for a line while another line is the default, and that line then starts from the root's history and reports to the root. At most two lines can open a line at any moment. A former default line keeps coordinating the lines it already opened. The roster moves to its own key, branch:roster, because a non-root line can now carry both an identity and a roster and one key would let either retire the other. Kin becomes the parent plus the lines a line opened. The cap is a total over the Session of open lines the tool opened, and it does not count the default line or any ancestor of it: that path cannot be closed, so counting it would spend slots on the lines the user is working on, and a user who keeps continuing on tool children would fill the cap with the line they are on. A switch that leaves the Session over the cap closes nothing and refuses only later opens. The guidance for when a model should open a line applies to both openers and is judged with the scenario set plus one new scenario for the root opening a line after a switch.

The implementation is stacked pull requests, in this order: name the root and classify every literal "main"; add the branch/default event, the restore and fork rules, the guards, the user-opened source and the format bump; route the App Server's defaults and its new method; follow the default branch in the TUI, the Web workspace and the ACP gateway; give the roster its own key and widen kinship; let the root and the default line open lines and add the cap; restate the prompt rule sentences; add the runner's switch step and the evals; and, waiting on a separate prompt-design decision, the opening and coordination policy texts.

  • Name the root: ROOT_BRANCH_ID, and every literal "main" classified as root, current default branch, or unrelated, with a narrow allowlist check and no behaviour change
  • Core: the branch/default event on the root, its restore and fork rules, the user-opened line source, the end guards, the idle-notice and self-end rules for a line that holds the role, the status notes, and the storage format marker upgrade
  • App Server: defaultBranchId on the directory, the method that chooses the default branch, every default target, the catalog's running state and recent activity, and the line-scoped model, profile and prompt refresh
  • Clients: the TUI, the Web workspace and the ACP gateway centre and submit to the default branch, label 主线 and 起点, and offer "continue from here"; the Web composer's /goal, /compact, /usage and /effort act on the line shown, and /fork keeps copying the root
  • Roster and kinship: the roster gets its own key so a non-root line can carry one, and kin becomes the parent plus the lines a line opened
  • Openers and cap: the root in every state and the current default line open lines, every other line is refused with its own code, and the total of open lines per Session excludes the default line and its ancestors
  • Prompt rules: restate only the sentences whose fact changed, leaving every policy sentence byte-identical
  • Evaluation: the existing branch scenarios plus scenarios for switching the default line and for the root opening a line after a switch, run on real models and reported in the PR
  • Policy texts and evaluation: the four conditions for opening a line, their boundaries with background commands, members, goals and event subscriptions, what a brief carries, the status notes' guidance, the new eval scenarios, and the two gates (no regression on any scenario, and a significant rise in the line-opening rate on the three should-open scenarios at 56 runs per arm)

The design is docs/design/timeline-branches.md and its Chinese mirror, with the plugin pages TimelineTree and BranchTool. The fork consequences are in session deletion and fork, the client consequences in Timeline-first TUI and the Web workspace, and the storage format in the native storage format. The stacked design is on the branch hui/branch-default-line-opening.

The model is BranchEligibility, checked with TLC 2.19 (TLA+ tools 1.7.4) on Java 17. Both designs' runs pass with exit 0, and their entries in coverage-completion-results.json and the .md table are refreshed from those runs.

Not in scope: forking from the default branch, comparing and adopting a side line's work automatically, per-line workspaces, per-line permissions and per-line tool lists.

Activity

  1. self-assigned this
    on Nov 18, 2026
  2. changed the title [-]Make the primary line movable, and let only it open lines[/-] [+]Make the default branch movable, and let the root and it open lines[/+] on Nov 18, 2026
  3. yyhhyyyyyy commented on Nov 24, 2026

    @yyhhyyyyyy
    CollaboratorAuthor

    The work in this issue is in these merged pull requests.

    Design

    Implementation

    Still open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions