Repository navigation
feat(clients): follow the default branch - #1963
Conversation
The worker reads defaultBranchId once per attachment and opens on that line: the initial focus, the transcript windows, the plain log's history and every request the clients make without choosing a line, and the top bar's model, permission and usage fold its events (design §4, §14). The lines panel marks the default branch and the root, p continues on the selected line through session.branch_set_default and then shows it, and the method's refusal is drawn in the panel. x is refused on the root, on the default branch and on every ancestor of the default branch, each with its own message, and the panel states what a move leaves in place. The plain log's history, idle, submit, stop, shell, goal, loop, permission and configuration calls name the conversation it read at attach. The marks and the key exist in every locale, and the README and Tui.md state them.
The Web reads defaultBranchId from the directory and centres that line: its transcript, running state, approvals, questions, submit, stop and withdraw are the default branch's, and the composer's /goal, /compact, /usage and /effort name it while /fork still copies only the root, which it reads at the action (design §9, §14). The Lines tree marks the root and the default branch, offers continue from here and draws session.branch_set_default's refusal on the row that raised it, and a move re-reads the new centre's transcript, goal and permission in one round trip.
An ACP session reads defaultBranchId once at attach and names that line on every call that acts on one, so a prompt with no line reaches the default branch (design §4, §14). Its projection, history windows, cancel path and /compact, /goal and /loop commands follow the same line, and tool ids keep the root's name.
The attach reply carries `defaultBranch {branchId, sequence}`, the line
the conversation is on and its own cutoff (design §14). The TUI's
transcript window and model fold, a resumed line-mode Session's model
fold and the ACP gateway's recovered fold take that cursor instead of
the root's `sequence`; a server that predates the field keeps the old
reading, with its conversation on the root and the reply's `sequence`
as that root's cutoff.
The ACP gateway's fallback for a server without `session.branches`
names the root through `ROOT_BRANCH_ID`; the ACP fixture's frame reader
takes the name `read_frame` so a branch id keeps the name `line`.
Each client's flow runs a Session still on its root and one moved to a
line: the window starts at that line's sequence, and a configuration
fact at the cursor is not folded over the reply's model.
The attach reply carries the line the Session's conversation is on, so the TUI opens on it even when the directory read has not caught up, and `/resume` applies the launch preset to that line instead of to the root the interface is leaving. A Session still listed on its root keeps reading the root, and a server without the field keeps the directory's answer. `p` now shows the moved line as the whole conversation: its transcript, and its own model, permission and context usage in the top bar. Each line numbers its own events, so the model watermark starts from that line's last adopted configuration instead of the root's cursor, which would filter a line's facts at lower sequences. The bar keeps each line's configuration as it folds, so a move shows the line's adopted model even when that fact arrived while another line was the default branch.
`session.branches` is read before the attach, so a default branch that moves between the two reads left the gateway recovering the root's history while the reply named another line: every pending read and the failing reply check compared against the wrong branch. The attach reply is the authoritative record of the line, and the directory answers only for a server that predates the field.
`session.branch_set_default`'s refusal reached the lines panel with only the projection, so the panel recorded it on whichever line was selected when the reply arrived: a user who moved the selection during the round trip read the error on the wrong row. The update carries the line the request named, and the panel draws the reason while that line is selected.
`--permission` changes a resumed Session's default branch, not its root; `p` shows the moved line's own model, permission and usage, and the attach reply, not the directory, names the line the TUI opens on.
The tree's root row drew only `Start`, so a Session whose default branch is still its root never showed `Main line`, although that row holds both roles.
A move that succeeded but whose `session.history` read failed left the centre an empty stream that still read as ready. The move stands, and the view reports the failure the same read reports on a resynchronisation.
`/fork` copies only the root, so the command reads the root's finished turn itself; the caller still passed the row's cut and no longer type-checked.
The bar's permission and usage are read after the move, so the flow waits for the labels instead of reading the transcript at one instant; a regression still fails on the model label as soon as the line is shown.
The timeline's fork command copies the root before the picked message, so its cut is the request's point; `/fork` names none and copies the root's newest finished turn. The store takes the cut when it is given and reads the root only when it is not, which is what the command and its test already expect.
eric8810
left a comment
There was a problem hiding this comment.
I found branch identity mismatches in resume and in-flight operations on this head:
- [P2] Resume must seed the selected line's configuration, not the root's. The stacked server's
connection/subscription.rs:564–599readsPromptSnapshot(ROOT_BRANCH_ID)for attach's model/preferences/capabilities;defaultBranchjust names the other branch and its sequence. CLIsession.rs:334–352and ACPgateway.rs:3112–3128, 3258–3265take the root model but use the selected line's cutoff, skipping its own configuration at or before that cutoff. Webchat.ts:224–232also overwrites the centred history's model with the attach model. A Session with model A on main and B already adopted on the default line resumes showing A. Please pair configuration and cursor for the same branch (without silently changing old attach fields' meaning), and cover different root/line models and a pre-cut line adoption against the actual server reply shape. - [P2] Bind permission edits to the branch whose policy was read. In
web/src/stores/chat.ts:921–941,setPermissionresolves the default before the GET and again after its await for UPDATE. With main's GET held while “Continue from here” moves the centre to worker, the UPDATE sends main's allow/deny exceptions and version to worker. Versions are per branch and both can be 0, so the optimistic check need not reject it. A local test reproduced a write that replaced worker's deny with main's allow. Capture the initiating branch for both calls and don't publish its late reply into a different centre. On CLI startup,session.rs:272–285,326–334andsession_host.rs:820–832,1621–1640have the related issue:--permissionmutates the directory's branch before attach can select a different one. Bind that startup write to the branch chosen by attach as well. - [P2] Reconcile Web streams when resync discovers a new default.
chat.ts:213–224changesdefaultBranchIdwithout removing the promoted line's original stream, unlike the local move path at :857–865.publish:615–618 then includes its cached questions and the new centre's questions. A local reconnect test (main → worker from another client, one pending question on worker) produced two copies of the same question. Share a role-change path for local moves and resync and assert that a newly centred line appears once. - [P2] Recover an in-flight ACP prompt on the branch which accepted it.
gateway.rs:2675–2714looks up the submission on the old pinned branch, then uses the reattach's new branch and cutoff to look up the accepted input's turn. The old branch can stay open after a default move, so the lookup and subsequent notice filter can miss its terminal outcome. Recovery also compares the new line's history to the old line'sprevious_through(:2087–2093, :2153–2158). Keep the outstanding prompt on its original branch through completion (or explicitly settle it on the transition), and reuse the history watermark only when branch identity matches.
Validation: the existing Web suite passed locally (237 Node + 43 Vitest tests). Both added Web interleaving/resync regression checks failed as described. The Rust paths above were reviewed statically; I did not run the Rust suites.
zerob13
left a comment
There was a problem hiding this comment.
The Web client needs a single, coherent transition when a different line becomes the centre. Three gaps remain beyond the existing review:
- The timeline displays the selected line’s rows but identifies them as root rows. A message-level Fork can therefore pass that line’s cut to the root-only fork RPC and return unrelated history. Pass the displayed branch to the timeline and apply the existing root-only guard.
- The default branch changes before history loads. While the old transcript is visible, Send and Stop can already target the new line. Switch the transcript and action target together or disable those actions until the new transcript is ready.
- When the root leaves the centre, its row is not selectable and the history loader skips it as a side line. Keep a way to return to the root and answer pending work without changing the Session’s default back.
These are static findings on the pinned stack. Web, Windows CLI, macOS native, and the new targeted Linux line cases passed. The required aggregate remains red on the three shared TUI failures tracked in #1958.
The attach reply's model, preferences and capabilities are the root's, and the cli read them as the shown line's: line mode and the TUI kept the root's model with the line's cutoff, which made the replay skip the configuration that line adopted at or below it, and `--permission` was written on the line the directory reported before the attach rather than on the line the reply names. A session on its root still takes the reply's record; a session whose conversation is on a line now takes that line's own `context/configured` from the window it reads, with a watermark below all of them, and the startup preset is written after the attach on the line the reply carried. A reply that names no line predates per-line configuration, so its model stays the session's. Refs #1811
…e left behind A gateway load took the attach reply's model, which is the root's, and applied it to the line the reply's cursor named; it now folds that line's own `context/configured` from the window it reads, at a watermark of zero so a later fact still reaches the options, and keeps the reply's record only for the root and for a server whose reply names no line. Recovery looked up an accepted prompt's turn on the line the reattach follows, which a default move may have changed, and compared the new line's history with the old line's watermark. A prompt now stays on the line that accepted it and is answered as an unknown outcome when that line is no longer the one this connection follows, and the watermark is reused only when the branch matches. Refs #1811
…e they came from Three reads mixed the centre with another line. A resync replaced the centred history's model with the attach reply's, which is the root's; `setPermission` read the centred line's policy and then wrote it to the default branch resolved again after the await, and published its late reply into whatever centre the move produced; a resync that discovered another client's move kept the promoted line's stream beside the new centre, so its pending question appeared twice. A move and a resync that discovers one now hand the stream over through the same path, a permission edit keeps the line whose policy it read for both calls, the centred history keeps the model its own window adopted, and the timeline is told which line it shows, so a centre on a line no longer offers a fork that would copy the root from that line's cut. Refs #1811
The bounded-window reads said the attach reply supplies the current model and that a configuration in the window is only historical display. With the default branch, the reply's record is the root's, so a client that follows the move takes the configuration of the line its cursor names and keeps the reply's record for the root and for a server whose reply names no line. Refs #1811
- A move reads the new centre's window before the transcript changes hands, so the rows, their cuts and every action keep naming the line on screen until its replacement is ready. Send and Stop therefore never target a line the reader cannot see. - The root row opens its own line tab while another line is the centre. The history loader and retry path no longer skip the root as a side line, and the panel keeps the root's transcript, composer and pending prompts usable without moving the Session's default back.
- The TUI resume attaches and writes the explicit preset before it adopts the startup model, so a refused preset ends the launch without changing any line's model. - The permission flow resumes with --model and fails if any request arrives before the attach or if a refused preset is followed by a model update.
The page passes the centre to the timeline; mounting it with a stubbed timeline holds that a non-root centre is not labelled as the root.
- A reply without `defaultBranch` names the root because that server cannot move the default branch, not because it predates per-line configuration. - The attach reply's model is the root's; a line takes its own configuration at or below the reply's cursor, and its watermark starts below every window event.
…model The TUI attaches before it adopts, so the attach's UI registration and conversation window now answer first; the startup flow still rejects the model update before any input runs.
eric8810
left a comment
There was a problem hiding this comment.
Reviewed at head a62e56a.
This is the clients' half of design §14, and the two decisions I could read are the ones that would have gone wrong. First, a command now carries where it was typed — Origin (Home or a Session) plus the line — and a submit, draft-submit or stop whose origin or line is no longer the centre is cancelled with its draft kept. That is the discipline a moving default branch needs: without it, a message typed on one line can land on another after an attachment change, and the user never asked for that. Second, the attach reply's defaultBranch {branchId, sequence} becomes the cursor the client resumes from, with the reply's model, modelPreferences and capabilitySnapshot seeded into the root alone and a line's configuration taken from the transcript window at or below its own cursor — the two values are paired rather than mixed, which is exactly the failure mode a client that simply resumed at the reply's sequence would have produced.
default_branch travelling on the view state with the panel refusing to end it or an ancestor is the right place for the fact once the client knows it.
Blocking: none.
Checks are green at this head. I read the command-origin and submit/stop changes in model/session.rs, the default_branch adoption in the liveness path, the view-state field and the PR body's account of the reply split; I did not read the 560-line session_host.rs delta, the 196 lines of dim-acp/src/gateway.rs, the 1025-line ACP branch_flow.rs, the CLI panels and permission changes, or the documentation, and ran nothing. For a change this size that is a partial review, not a full one, and it should be read by someone with the budget to cover the gateway and the panels before it merges.
Non-blocking:
- The PR states it must merge after #1923, because until the default branch can open a line a user could continue on one that cannot open one. That is a merge-order condition rather than a code finding, and it is worth pinning somewhere the merge cannot miss — a label, or the checklist — since the body is the only place it is written and the body is not read at merge time.
Cover the failed page's Retry resuming the centre's live consumer: the reply that arrives between the retry's history window and its ready page shows when the retry succeeds; a move that overtakes the retry leaves the old centre's queue unconsumed; and a consumer that is already running applies each event it holds once.
The retry's reads that follow its history window run while the page is still failed, and the failed page queues the centre's live events without starting a consumer. The guarded success resumes that consumer for the centre it still shows, so a reply that arrived in that interval is applied in order without another event or a resync. A move or a status change that the retry no longer owns skips the resume with the rest of its result, and a consumer that is already running keeps its single pass.
Resolve the per-line configuration reads against the provider route work from main: the ACP model write, the superseded-configuration refresh, the checked attach with expectedConfig, the route admission release point and the CLI resume default keep both the line-bound reads and the expired-route recovery with catalogProviderId. Carry catalog_provider_id through the adopted-model boundary and the attach helper, and give Config::set_model the line parameter while Config::recover_model reads the Session's default line and restores an expired route on the root and on that line.
A load whose default branch is a line must hand the request's expectedConfig to the checked attach, read the directory only after the attach passed, and show that line's own model instead of the attach reply's root model; a model write afterwards must name the line and keep the catalog provider when the server adopts a temporary route.
|
Fixed in 7f70a60. The Retry's reads after its history window run while the page still shows the failed state, and that state queues the centre's live events without starting their consumer. A reply that arrived in that interval waited on the stream until a later event or a resync happened to start it. The guarded success now resumes the consumer for the centre it still shows, after the history, goal and policy reads and their status-sequence check, so the events that arrived during those reads are applied in order without another event or a resync. A move or a published failure that takes the page away from the retry still discards its late success, so no consumer starts for a centre the retry no longer shows, and the old centre's queued events do not enter the moved page. A consumer that is already running keeps its single pass: the event it holds is hydrated and applied once. New tests in |
|
The merge-order condition this review names is met: #1923 merged as ae00b0c on 2026-11-21, before this branch's current head. The body now records the merge instead of the condition. Checks on the pushed head: |
eric8810
left a comment
There was a problem hiding this comment.
Reviewed at head d464ece.
Approving at this head, citing my review at a62e56ae. The branch's only new commit is test(acp): pin the default line's load, attach and model write, which adds flow coverage for the three things a client following the default line must get right — that the line loads, that the attach hands back its cursor, and that a model write lands on it — so it is verification of exactly the half my earlier review had to take on trust. Everything else in the comparison to this head is other pull requests' commits arriving through origin/main.
That earlier review still stands as the record of what I read: the Origin-carrying command model that cancels a submit, draft-submit or stop when its origin or line is no longer the centre and keeps the draft, and the attach reply's defaultBranch {branchId, sequence} used as the cursor while the reply's model, modelPreferences and capabilitySnapshot seed the root alone, with a line's configuration taken from the transcript window at or below its own cursor.
And it still stands as the record of what I did not read: the dim-acp/src/gateway.rs delta, the ACP branch_flow.rs cases (now 1160 lines, further out of reach than before), the CLI panels and permission changes, and the design documents. For a change of this size that is a partial review, and it should be read by someone with the budget to cover the gateway before it merges.
Blocking: none. Nothing I read at a62e56ae has changed.
Checks are green at this head. Verification: not run; this approval rests on the reading recorded at a62e56ae, the confirmation that the only new commit is a test, and the current green checks.
Non-blocking: the merge-order condition still lives only in the body — this must land after #1923 — and a label or checklist entry would pin it where the merge cannot miss it.
# Conflicts: # crates/dimcode/tests/support/cli_harness.rs
Resolve crates/dim-cli/src/session.rs around #2014: session.submit keeps #2014's submission_id while branchId stays conversation, and a denied interactive approval closes the reply stream before session.stop is sent on conversation. Adapt the five #2086 calls that still passed no line to Worker::earlier: an_earlier_page_of_a_line_counts_the_lines_it_opened, a_line_opened_before_its_start_counts_after_the_earlier_page, a_line_counts_the_same_whichever_page_arrives_first, a_transcript_read_that_drops_its_oldest_page and loading_the_page_a_retention_drop_omitted_recounts_the_cut now pass "b-7c", the line each already focused; no test logic or assertion changes.
|
The ordering condition is met: #1923 merged as ae00b0c on 2026-11-21, and the description records it as a checked entry. This branch merged |
eric8810
left a comment
There was a problem hiding this comment.
Reviewed at head 309f5ec.
Approving, citing my reviews at a62e56ae and d464ece8. The head moved by merging origin/main again: the PR's own file list and stats are identical to the head I approved (76 files; commands.rs 11/7, config.rs 65/36, gateway.rs 197/63, branch_flow.rs 1160/0, README.md 9/9), and its last own commit is still test(acp): pin the default line's load, attach and model write. Every commit in the comparison is another pull request's commit arriving from main — the exec stdout work among them.
What those reviews judged stands: commands carry their origin and line and are cancelled with the draft kept when that is no longer the centre; the attach reply's defaultBranch {branchId, sequence} is the cursor while the reply's root configuration seeds the root alone, with a line's configuration taken from the transcript window at or below its own cursor.
What I did not read then, I still have not: the gateway.rs delta, the 1160-line branch_flow.rs, the CLI panels and permission changes, the design documents. This remains a partial review of a large change, and it needs a reader with budget for the gateway before it merges.
Blocking: none. Checks are green at this head.
Verification: not run; this approval rests on the earlier readings, the confirmation that the PR's own content is unchanged, and the current green checks.
Non-blocking: the merge-order condition still lives only in the body — this must land after #1923 — and a label or checklist entry would pin it where the merge cannot miss it.
zerob13
left a comment
There was a problem hiding this comment.
The original Retry regression is fixed and the exact Vue, ACP, and required CI checks passed. [P2] Bind the resumed consumer's failure to the stream that initiated it. In web/src/stores/chat.ts:367–371, the new Retry rejection handler resolves the branch ID again. If the default moves and the old branch is reopened before that rejection settles, the callback can mark the replacement branch stream failed and stop its event consumption. Capture the initiating stream and ensure it is still current before publishing the error, as appropriate for the move/reload lifecycle. This is a source finding about the new callback, not the pre-existing tool-lookup error behavior.
Cover the retry's resumed consumer when the default line moves away and back, when the old centre is reopened as a side line, when a resync reloads the centre in place, and when that consumer finishes after its stream was replaced: the centre or the reopened line keeps the state its own read published and keeps consuming its live events. Cover a goal read that was out before the centre moved away and came back, and a goal failure that the next accepted move overtook: the centre that came back stays ready with no error, and the overtaken read does not put the ready page back to loading.
The retry's resumed consumer resolves the branch again in its rejection handler. A move away and back, a reopen of the old line, or a reload replaces the stream it started on, and the failure marked that replacement failed and stopped its consumption; a reload in place instead kept the error its own reset had cleared. The handler now captures the centre stream and its projection when the consumer starts, and publishes the failure only while both are still current, the load has finished and the Session is not closed. Handing the centre to another line left the outgoing stream's consumer running, so a hydration that finished later applied its old events through the branch resolved at that point and wrote them into the replacement. The handover now retires the outgoing stream first. A goal read recorded the line but not the projection it was asked for, so a read from before a move away landed on the centre that came back and its failure published failed over the newer read. Each queued read now carries the centre projection it belongs to, and a read whose line or projection is no longer the centre's leaves the lines queued behind it to the next read. A move whose goal read finished after a newer accepted move no longer puts that move's ready page back to loading.
The case holds an unopened side line pending questions while a resync reads the directory, moves the centre to the worker line, then rejects the held read: the page must stay ready, keep no error, and the moved centre must keep consuming live events.
The history page names the line it belongs to, so the worker line stores its rows as on worker; the new case asserts that row beside the live event it receives after the move.
A sync that awaits the directory can be overtaken by an accepted move. Its catch now publishes the failure only while no move has taken the next generation and the page is not closed, so the line the move installed keeps its ready page and its live events. The generation the entry captures is the one the directory handover already compares, so the handover and the failure share one check.
|
Fixed in df959de. The retry's resumed consumer now captures the centre stream and its projection before it starts, and its rejection publishes the failure only while that stream is still the centre, still carries that projection, has finished loading and the Session is not closed. A move away and back, a reopen of the old line and an in-place reload therefore leave the replacement's own reads to report its state, where the handler used to resolve the branch again and mark that replacement failed. Handing the centre to another line now retires the outgoing stream before the handover, so a hydration that finishes after the move cannot apply its old events through the branch resolved at that point or write them into the stream that replaced it.
A New tests in |
zerob13
left a comment
There was a problem hiding this comment.
Re-reviewed this head. Retry now binds a late consumer failure to the stream and projection that initiated it, so a move, reload, or close cannot apply that failure to a replacement. The exact Web job passed all 294 tests, including side-tab reopening, returning to the original branch, and in-place reload. Linux and the required CI gate passed. This resolves my previous change request.
eric8810
left a comment
There was a problem hiding this comment.
Reviewed at head df959de.
Approving, citing my reviews at a62e56ae, d464ece8 and 309f5ec6. This head is another merge of origin/main: the PR's own diff is unchanged at 76 files with the same stats I approved (commands.rs 11/7, config.rs 65/36, gateway.rs 197/63, branch_flow.rs 1160/0, README.md 9/9), and every commit since 309f5ec6 belongs to another pull request — the web centre-binding work among them — arriving through main.
Nothing in what those reviews judged has moved, and nothing in what I did not read has become smaller: gateway.rs and the 1160-line ACP flow file still need a reader with budget before this merges, and the merge-order condition (after #1923) still lives only in the body.
Blocking: none. Checks are green at this head.
Verification: not run; this rests on the earlier readings and the confirmation that the PR's own content is unchanged.
Stacks on #1917, which added
session.branch_set_default,defaultBranchIdonsession.branches, the attach reply'sdefaultBranch {branchId, sequence}and the server's routing of every request that omits a line; this is the clients' half of design §14. It follows #1923, which lets the default branch open a line; that PR merged asae00b0cfon 2026-11-21, so the ordering condition is met.Refs #1811.
A client now resumes the Session from the cursor its
session.attachreply carries:defaultBranch {branchId, sequence}names the line the conversation is on and that line's own cutoff, while the reply'ssequencestays the root's. The reply'smodel,modelPreferencesandcapabilitySnapshotare the root's adopted configuration, which is the value they have always carried, so a client that follows the move pairs the configuration with the cursor instead of mixing the two: a Session whose conversation is on a line takes the configuration that line adopted at or below its cursor, from the transcript window the client already reads, and the reply's record seeds the root alone. A reply that carries nodefaultBranchnames the root, because a server without the field cannot move the default branch, so its record is that Session's one model and every client keeps using it. The reply is also the record of that line: a client opens on thebranchIdit names, and the directory'sdefaultBranchIdanswers only for a server that predates the field, which reads the conversation as its root and the reply'ssequenceas that root's cutoff. Asession.summariesitem carries nodefaultBranch, so no client reads a listing for the line it resumes; the ACP gateway's fallback for a server withoutsession.branchesnow names the root throughROOT_BRANCH_IDrather thanDEFAULT_BRANCH_ID.The TUI opens on the line the attach reply names: the initial focus, the history windows, the lines list and the plain log's defaults follow it, and the top bar's model, permission and usage fold its events, the model from that line's own configuration facts at or below the cursor. A launch that names a permission preset writes it after the attach, on the line the reply named, so a move between the directory's answer and the reply can no longer send the preset to the line the Session left; a write the daemon refuses still ends the launch before the startup model is adopted or any turn runs. A launch that names either registers its interface only after they are applied, so a resumed leaf is not observable, or addressable for approvals, while the line still carries its old policy.
/linesmarks the default branchMain lineandmainStart;pcontinues on the selected line throughsession.branch_set_default, then shows its transcript with that line's model, permission and usage in the top bar, and the method's refusal is drawn in the panel where the action was raised;xis refused onmain, on the default branch and on every ancestor of the default branch, each with its own message in the panel, and the panel states what a move leaves in place: the old default branch stays open with the lines it opened, the two lines swap the right to open a line, and the root keeps its own right in either direction (README, Tui). Each command that acts for one line captures the Session and the line when the key is pressed and runs only while both still name that pair: a submit, a draft, a goal, a loop or a configuration setting is cancelled with its whole draft returned to the composer and a message,/compact,/usage,/earlierand a permission change are cancelled with a notice, a shell command is cancelled and reported through the existing shell outcome before Home could start a Session for it, and the stop and interrupt-and-send-now gestures capture the Session and line they were pressed on too, so a move within the Session still stops the line the key saw while a Session handoff cancels the gesture, and a cancelled send now settles so the send keys are usable again and reports the Session change without claiming the draft the handoff cleared. A submitted draft that a queued handoff replaces is returned to the composer for the Session on screen, even when both call their linemain, and Shift-Tab and the Permissions picker bind the permission change to the default line they saw, so a queued move cannot rotate the new line's policy./usagereports the Session's default branch. Home is an origin of its own rather than an empty Session id: a command typed there carries Home, runs only while Home is still the centre, and keeps the startup path, so a message, a permission change or a shell command typed on a Home that a/resumeis about to replace, or that--resumeshows before its attachment reply, is cancelled with the usual notices instead of being submitted to, written on or run in the resumed line, and a send or shell command left over from the Session/newleft starts no Session because the guard decides before Home can create one. The TUI remembers the Session the invocation asked to resume until its first attachment reply arrives, so the invocation's first message still reaches it, and that message leaves its line to the session thread, which submits it on the line the attach reply names, while a key pressed on Home stays Home's. A/resumeor a new Session marks the shown line's permission preset unknown before its read goes out, and a refused or failed read clears the preset from the status line, Settings and the Permissions panel instead of keeping the previous Session's one.The Web reads
defaultBranchIdfrom the directory, leaves the root's parent names optional and centres that line: its transcript, running state, approvals, questions, submit, stop and withdraw are the default branch's, the centred transcript keeps the model its own window adopted rather than the reply's, the Lines tree marks the root and both roles it can hold and offers continue from here with the method's refusal on the row that raised it, a move whose new centre cannot be read reports that failure rather than showing an empty conversation, and that failure's Retry reads the accepted line again, its window, its own model, its goal and its permission, without another move, keeping the centre line's live events the failure buffered for that read while a side line applies its own as they arrive; a Session whose directory read did not finish repeats the whole attach on Retry, which now includes a reconnect that failed at the attach, at the directory or at its lines' pending questions and left a connection with no attachment for the Session, and a retry that succeeds loads the side lines an earlier sync had queued but never loaded; a Session that closes while the retry, or a reconnect waiting for it, is in flight stays closed, one retry runs at a time, a reconnect waits for the retry it overlaps, and a retry that a later move overtook is discarded. A failedsession.model.getduring a sync leaves the centre readable with no model, a failed goal refresh after a move ends the move before its policy read, and a goal read that fails after the Session closed or the connection was lost reports neither as a failed page, while one that answerssession_closedcloses it. A reconnect now drains its attachment queue on every exit, so a replayed approval, a queuedsession.closedand the events it received while its goal read failed reach the retry instead of being cleared; a goal read that lost the connection leaves the page loading for the reconnect and ends a move before its policy read, a move whose history read lost the connection also leaves it loading instead of a ready page with no messages, a page that a centre goal event fails while the sync's policy read is out keeps that failure and its Retry, a refresh call that arrives while one is running queues its own line and is answered by that refresh, whose failed read answersfalseat once and leaves the lines still queued behind it for the next call, a resync's history result and directory answer describe the line they were read for, so a move accepted meanwhile leaves the page to the reads of the line it names and a move that takes a page a resync still had loading leaves that state through its own history, goal and policy reads. The failure page's Retry records the page's status sequence when it starts and writes its policy and its ready page only while no status has landed since, so a goal refresh of that line that fails while the retry's policy read is out keeps its failure, its error and its Retry. A Retry that succeeds resumes the centre's live consumer, so a reply that arrived while its goal or policy read was out is applied in order without another event or a resync. A move that repeats the line already shown takes the next generation before it returns and returns only when the page is not loading, so a repeated move that overtakes one a resync had relied on to finish the page still finishes it. The composer's/goal,/compact,/usageand/effortname the centred line while/forkstill copies only the root, which it reads at the action. A move reads the new centre's window before the transcript changes hands: the rows on screen, their cuts and Send and Stop keep naming the outgoing line until its replacement is ready, then all change together, so an action never targets a line the reader cannot see. The root stays selectable while another line is the centre: its row opens the root's own line tab, its window and pending approvals and questions load and answer there, and its composer works without moving the Session's default back. A permission edit reads and writes one line even if the centre moves while the read is in flight, and its late reply never becomes another centre's policy; a resync that discovers another client's move hands the centre's stream over once, as a local move does, so the promoted line's pending question appears once; and the timeline is told which line it shows, so a centre on a line offers a new line there instead of a fork that would copy the root at that line's cut (Web workspace).An ACP session takes the line from its attach reply once and names it on every call that acts on one, so a prompt with no line reaches the default branch; its projection, its history windows, its cancel path and its
/compact,/goaland/loopcommands all act on it, and tool ids keep the root's name. A model write names the line it changes, a superseded write refreshes that line's model at its own cutoff, andsession/loadhands the request'sexpectedConfigto the checked attach before it reads the directory. A later move of the default branch takes effect on the session's next attach, not mid-session: a reattach onto another line reuses its history watermark only when the line matches, and a prompt whose accepted input ran on the line the Session left is answered as an unknown submission instead of being looked up on the new line.Sites that stay on the root: the TUI's own projections keyed by branch, because the root projection holds every branch's events and a compaction detail belongs to the projection of the line it names; a member Session's observation, which is one merged transcript keyed by the root; a question's label, which is omitted on the root; whether the shown transcript is the root's own, which draws the Session boundary; the scheduler editor's deserialization default, because it round-trips documents the owner already resolved; the Web's line tree root row, new Session page, line conversation and new line dialog, which ask whether a line is the root; and the ACP fork anchor, because a fork copies the source Session's root.
The clients' flows hold what design §14 promises. The CLI and ACP resume from the attach reply's
defaultBranch, on a Session still on its root and on one moved to a line alike, and each shows that line's own model:a_gateway_load_folds_the_default_branchs_cursorin crates/dim-acp/tests/branch_flow.rs covers the root, a line, and an attach reply that disagrees with the directory,a_gateway_load_keeps_the_default_line_apart_from_the_rootcovers the checked attach's expectation and order, the line's own model and a model write that keeps the catalog provider, anda_resumed_line_mode_session_folds_the_default_branchs_cursorandtui_resumes_the_shown_line_from_the_attach_cursorin the CLI's flows cover the same three shapes;a_gateway_call_without_a_line_targets_the_default_branchcovers a reply that names nodefaultBranch, where the directory answers and the reply's model is the Session's one model. A prompt in flight when the default moved is settled bya_recovery_settles_the_prompt_the_moved_default_left_behind. The startup preset follows the reply on both paths and is refused safely:tui_resume_writes_the_explicit_permission_on_the_attached_line, which also holds that a refused write never adopts the launch's--model,tui_resume_applies_the_preset_to_the_resumed_default_branchandpermission_flag_selects_the_new_and_resumed_preset_with_version_checks. The Web takes its centre from the directory'sdefaultBranchIdand reads that line's window;the centre follows the Session's default branch and its commands name it,a moved centre keeps the model its own timeline adopted,a permission edit keeps the line whose policy it read,a resync that discovers a moved default shows its pending question once,a move keeps the outgoing transcript and its target until the new centre is ready,a move to the root does not label the outgoing line's rows as root rowsandthe root opens as its own line while another line is the centrein web/tests/chat-history.mjs assert the line every read and write names, the transcript and target a move pairs, and the root's own window and pending question;a failed move recovers on the accepted line when the failed page is retried,a Session that closes during a retry stays closed,a Session that closes while a reconnect waits for a retry stays closed,a retry after a reconnect that could not attach attaches again,a retry after a reconnect that cannot read the directory attaches again,a retry after a reconnect whose pending questions failed attaches again,a reconnect that waits for a retry keeps the events buffered during it,a goal refresh reports neither a closed Session nor a lost connection as a failure,a goal read that reports the Session closed closes the page,a retry loads the side lines an earlier sync left waiting,a Session whose first sync failed retries the whole attach,a retry a later move overtakes does not replace the line that moved,a reconnect that overlaps a retry reads after it, not beside it,a failed model read during sync keeps the centre readable,a move whose goal refresh fails keeps its failure and reads no policy,a reconnect whose goal read fails keeps an approval it queued,a reconnect whose goal read fails keeps a queued close,a reconnect whose goal read fails keeps the events it buffered,a reconnect whose goal read loses the connection is not ready,a move waits for a goal refresh already running on its line,a move whose goal read loses the connection is not ready and reads no policy,a move whose history read loses the connection is not ready,a permission read that lands after a failed goal refresh does not make the page ready,a concurrent goal refresh reads the line each caller asked for,a Session that closes while the retry reads the policy stays closed,a side line keeps the events it received while the centre page was failed,a resync whose history read fails after another line took the centre leaves the moved page to its own reads,a resync whose directory answer predates a move does not take the centre back,a resync's ready page does not land on a page a move took while its policy read was out,a retry's late policy read does not undo a failure a goal refresh published while it was out,a no-op move finishes the page a resync left loading on the line,a retry that finishes its reads resumes the reply that arrived while they were out,a retry a move overtakes does not consume the old centre's queueanda resumed live consumer applies each event oncehold the failed page's recovery, anda return to the centre while another line's history loads cancels that moveholds the generation a repeated return already takes; the timeline'srefuses a fork of a centre that is not the rootholds the action a moved centre offers,web/src/features/lines/LinesTree.test.tsholds the root row's tab while another line is the default, andweb/src/features/chat/ChatPage.test.tsholds the line the page hands the timeline and the Retry the failed page offers. The TUI's own flows assert the Session and branch a request reached, the preset it applied and the facts the top bar drew:tui_lines_panel_marks_the_default_branch_and_p_moves_it,tui_p_shows_the_moved_lines_own_model_permission_and_usage,tui_resume_applies_the_preset_to_the_resumed_default_branch,tui_x_is_refused_on_the_default_branch_and_on_a_line_it_continues_from,tui_a_refused_continue_is_shown_in_the_lines_panel,tui_a_permission_change_typed_before_a_queued_move_changes_nothing,tui_a_draft_typed_before_a_session_handoff_does_not_go_to_the_new_session,tui_an_interrupt_typed_before_a_session_handoff_does_not_stop_the_new_session,tui_a_send_now_typed_before_a_session_handoff_does_not_stop_the_new_session,tui_a_home_send_and_permission_change_do_not_reach_the_resumed_session,tui_a_stale_send_behind_new_does_not_start_a_session,tui_a_launch_home_permission_change_does_not_reach_the_resumed_session,tui_a_shell_command_typed_before_a_resume_does_not_run_in_the_new_session,tui_a_stale_shell_command_behind_new_does_not_start_a_session,tui_a_launch_home_shell_command_does_not_run_in_the_resumed_sessionandtui_the_first_prompt_of_a_resumed_session_follows_the_line_its_attach_namesin crates/dimcode/tests/cli_flow/lines.rs,tui_resume_registers_its_leaf_after_the_launch_preset_is_appliedin crates/dimcode/tests/cli_flow/permission.rs, andweb/src/lines.test.mjsholds the tree's marks and its continue rule. The seven Home flows hold these transitions: the first holds a/resumeattach reply, types a message and presses Shift-Tab on the Home still on screen, releases the attach, and asserts that the resumed line's first permission write is the probe's own and that no submit came out, with both cancellation notices drawn in scrollback and fullscreen; the second holds a fork in flight, sends/newand then a message from the Session still on screen, and asserts that no Session is created and nothing is submitted while the draft comes back; the third starts--resume, holds its attach reply, presses Shift-Tab on the Home screen, releases the reply, and asserts that the resumed line's first write is a later gesture's against version 1; the fourth starts--resume -pfor a Session whose default branch isline-1, holds the attach reply, and asserts that the first message namesline-1; the fifth holds a/resumeattach reply, types a shell command from the Session still on screen, and asserts that noshell.runfollows the attachment; the sixth sends/newbehind a held/resumeattach, types the same command from the Session still on screen, and asserts that no Session is created; and the seventh starts--resume, holds its attach reply, types a shell command on the Home screen, and asserts that noshell.runfollows the reply. The server-side §20 cases 22, 23 and 27 belong to #1917; this PR covers the clients' half of 27, the line a resumed client centres, the cursor it folds from and the configuration it pairs with that cursor, and changes no server behaviour.The merge with
mainpairs these per-line configuration reads with the provider-route work: the ACP model write carries the line, its superseded refresh reads that line's model at its cutoff,session/loadhands the request'sexpectedConfigto the checked attach before it reads the directory, the route admission is released as soon as the attach returns, and an unattached Session's model recovery restores an expired route on the root and on the Session's default line before it reads that line's adopted configuration.a_gateway_load_keeps_the_default_line_apart_from_the_rootholds that order, the expectation, the line's own model, the line a model write names and the catalog provider an adopted temporary route keeps.The branch also merged
mainat6c46df95175a5a0a3fe48ce53af288dbdb4bcfb3, which brings the exec reply stream from #2014 and the cut tests from #2086. Two hunks incrates/dim-cli/src/session.rsoverlapped: a submit keeps #2014'ssubmissionIdwhile itsbranchIdnames the conversation line, and a denied interactive approval closes the reply stream beforesession.stopis sent on the conversation line. Incrates/dim-cli/src/session_host/tasks.rs, the five tests #2086 added now pass"b-7c", the line each already focuses, to the earlier-history read; only that argument changed, and no test logic or assertion did.Pinned copies of the texts this changes were brought in step: the CLI README,
docs/design/cli-commands.mdand its Chinese mirror for the plain log's[permission] preset:line, the preset prompt and the/usagereading, and the CLI flows that pinned the oldPreset (main branch)text,session.model.update'smainbranch id and a member Session'ssession.stopbranch id. The documents that stated which read supplies the adopted model now state the pairing and the line's own window watermark: the bounded-window reads in clients.md, the browser's read order in web-workspace.md and §14 itself. The merge withmainalso keeps the permission panels' i18n coverage:ApprovalsPaneldraws its labels throught/tf, the status line uses the sharedpreset_label, andPermission unavailableis translated in every locale table.Checks on the final head:
cargo fmt --all -- --check --config error_on_line_overflow=true;cargo clippy -p dim-cli -p dimcode --all-targets --locked -- -D warnings;cargo test -p dim-cli --locked --lib(804 tests);cargo test -p dimcode --test cli_flow --locked(262 passed, 13 ignored); andcargo run --locked -p xtask -- check, including the i18n table and literal-key checks. The Web checks, the ACP flow and the remainingdimcodeintegration targets were run on earlier heads and are not re-claimed for this one.