Skip to content

docs(branch): restate the branch prompts as rules - #1930

Merged
yyhhyyyyyy merged 6 commits into
mainfrom
hui/branch-rule-texts
Nov 21, 2026
Merged

yyhhyyyyyy merged 6 commits into
mainfrom
hui/branch-rule-texts

Conversation

@yyhhyyyyyy

Copy link
Copy Markdown
Collaborator

This PR stacks on #1923 and finishes the rule restatement of timeline branches that the openers change left in the prompts. Refs #1811.

The text audit compared every identity block, roster, parent block, notice, status note, guide entry, result and refusal the branch mechanism writes against §12.1 and §11: 84 text units match their design text, and 9 design sentences differ in 10 rows, of which three rows are rule or fact. This PR changes those three; the seven policy rows stay for the evaluated policy change.

The <dim-branch-line> guide entry gains the status note. Its old second sentence, A later block of this name replaces the earlier one; it is state about the line, not a request., is now A later block of this name replaces the earlier one; a block carrying `default` is the note a move writes. Both are state about the line, not requests. This is protocol under §12.4's guide-entry bullet: the identity key now carries a second kind of block, and a line that compacts into its latest note reads both in its own guide.

The branch tool's end refusal now uses §11's single sentence. The role check's Only a line opened with create can end itself. and the tree guard's line {id} is the default branch or an ancestor of it both become Only a line opened with create can end itself, and not while it or a line below it is the default branch. This is protocol under §12.4's results-and-refusals bullet; the short text left out the guard that refuses a default branch or its ancestor, which is what a tool line calling end usually meets.

Seven policy rows are deliberately left to the evaluated policy change: the description's On main you coordinate: ... in the coordination text for an opener, and the status notes' How you work here: heading with its four bullets on a tool line and two on a line the user opened. Their target text is §12.1's, and the policy change owns the factory members that carry them.

The changed guide entry is pinned in three test binaries, all updated: branch_flow.rs, prompt_guide.rs and minimal_execution.rs. The refusal text is pinned in branch_flow.rs and updated there. Neither sentence has another copy outside the design's target text.

One design inconsistency came out of the audit and is left alone: §12.4's policy bullet names six status-note sentences that §12.1's notes do not contain, while §12.1's How you work here bullets contain four others. §12.1 is the exact text, so the policy rows above follow it, and the reconciliation belongs to the policy change.

Checks: cargo test -p dim-agent-capabilities --test branch_flow 135 passed and 4 ignored; --test flows 7 passed; cargo test -p dim-agent-integration-tests --test prompt_guide 17 passed and --test minimal_execution 22 passed; cargo clippy --workspace --all-targets --locked -- -D warnings, cargo fmt --all -- --check --config error_on_line_overflow=true and cargo run --locked -p xtask -- check pass, the last with the service catalog, plugin documents, boundaries and literal main checks green.

The `<dim-branch-line>` guide entry says that a block of the same name
carrying `default` is the note a move writes, so a line that compacts
into its latest note still reads both kinds of block in its own guide.

The `branch` tool's `end` refusal uses the design's single sentence for
every refused caller: the role check and the tree's CannotEnd guard now
answer `branch_cannot_end` with the same text, which names the
default-branch and ancestor guard the short text left out.

The description's coordination sentence and the status notes' "How you
work here" bullets keep their text; they are judged as one policy family
in the change that first puts a candidate for either in place.

@codoggy codoggy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

I reviewed the merge-base diff for d7a1166cafea92a0efc0f0f2a74a54583736530a, focusing on the branch guide and the refusal a caller sees when it tries to end a protected line. I found no blocking issues in that scope.

Checks: Static inspection: the guide now describes the default attribute written by a move. The tool returns the same branch_cannot_end code for an ineligible line and for a tool line protected by the current default; the tree still decides eligibility. I checked the refusal assertions in branch_flow.rs and the guide assertions in both integration tests. CI: the PR run passed the Rust build/lint, boundary checks, and compiled workspace tests; the overall verify job was still running when checked. Tests not run locally.

A turn that compacts runs an extra model call, which the five-second
`soon` bound does not survive on a loaded machine. Every wait on such a
turn now uses the file's thirty-second `patient` helper.

@codoggy codoggy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

I reviewed the merge-base diff for 3d4fba6e655624386de79b3fb78378d11d6e9a97, focusing on the branch guide, protected-line refusal, and changes to the compaction tests since my previous review. I found no blocking issues in that scope.

Checks: Static inspection: against the updated base, the default attribute still identifies a status note and the tree guard still decides whether the caller may end the line. The five changed waits in branch_flow.rs now use the existing 30-second patient helper rather than the 5-second soon helper. They still wait for session.idle; the subsequent assertions on the parent block, roster or identity remain in place. CI: changes and dependencies passed; verify was queued when checked. Tests not run locally.

@codoggy codoggy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

I reviewed the merge-base diff for d7b206a08c2767fab771d58b3178f2776bb364ee, focusing on the branch identity note and what the model is told when it cannot end a line. I found no blocking issues in that scope.

Checks: Static inspection: the guide’s default attribute matches the note written on a branch move. Both the non-tool and protected-tool refusal paths retain branch_cannot_end, and the explanation now covers a default below the caller as well as the default itself. The compaction tests allow more time for the line to become idle without relaxing their assertions. CI: changes and dependencies passed; no completed verify result was available when checked. Tests not run locally.

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at head d7b206a.

The delta over the parent (1e74653f) is four files, and it is the kind of change that is easy to get half-right: the dim-branch-line guide entry now says a block carrying default is the note a move writes, and the two tests that pin that text (prompt_guide.rs, minimal_execution.rs) move with it in the same commit. A text change that reaches the model without its pinning assertions following would leave the suite asserting the old sentence, so updating them here is the part I looked for first and found.

The other half is a real improvement in the refusal path: CANNOT_END_TEXT names all five cases the refusal covers — the root, the default branch, a plugin line, a line the user opened, and an ancestor of the default branch — and the end refusal now uses one text for both the direct and the BranchRefused::CannotEnd route. One string for one refusal, stated at the layer that refuses, matches "a rule is stated once" applied to a message and stops the two entry points from drifting apart in wording.

The audit in the description — 84 text units matching their design text, nine differing in ten rows, three of them rule or fact, seven policy rows deferred — is the evidence I would ask for on a restatement, and deferring the policy rows rather than bundling them is the right scope call.

Blocking: none.

Checks are green at this head. I read the four-file delta and its text rows; I did not read the 8 changed lines in branch_flow.rs in detail, the generated modules.json touch, or the design-row line, and I ran nothing.

Non-blocking: none.

Follow-up commits on the parent branch take a line's cut while the line is idle, so a turn that starts afterwards cannot leave the cut inside an unfinished model output.
@yyhhyyyyyy
yyhhyyyyyy changed the base branch from hui/branch-openers-cap to main November 21, 2026 04:33

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 645a35848db75d6f801bf852a63528b4ab32c3ba on current main (26ab50e23a6bb6db0193a0f5681fac10a57cb3da, merge 1866635c0578e3736800b85d54804d0a7ddef748). The merge contains only the intended four-file child patch. The guide matches the default-line and protected-ancestor rules, the two refusal paths preserve branch_cannot_end, and a restored line adopts the current guide before its first request.

On the refreshed merge tree, 141 branch-flow tests passed (4 ignored), 17 prompt-guide tests passed, and the changed identity-guide assertion passed. The three other minimal-execution shell failures had the same assertions on unmodified main. This is code approval; the green stacked CI run predates the retarget, and fresh current-base CI should still pass before merge.

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.

4 participants