Skip to content

RT-257: accept the ruled relocation prompt so unattended panes stop stalling - #394

Merged
m4ttheweric merged 4 commits into
mainfrom
rt-257-relocation-rule
Sep 24, 2026
Merged

m4ttheweric merged 4 commits into
mainfrom
rt-257-relocation-rule

Conversation

@m4ttheweric

Copy link
Copy Markdown
Collaborator

A board-launched respond run that enters an existing rt worktree by path stalls on Claude Code's permission-root relocation prompt. The daemon already answers that prompt for registered trees (RT-200), but its parser only recognised the boxed dialog. Claude Code 2.1.281 paints it under a full-width rule and a Tool use heading with no box, so the parser read no dialog, the reconciler opened an attention gate, and the board showed the pane-waiting card until a human answered.

What changed

  • lib/daemon/trust-dialog.ts: a rule line bounds the dialog body the way a box top does. A capture with neither still fails closed, and the transcript above the rule still cannot supply the path.
  • lib/daemon/__tests__/trust-dialog.test.ts: three cases built from the real capture in the attention gate's context (the ruled prompt parses to the dialog's path, a quoted path above the rule loses to the dialog's own, the reason without the proceed question is not a prompt).

Follow-up

  • The running daemon needs a restart after this merges; the parser is in-process.
  • No settings key pre-approves this prompt (only bypassPermissions skips it, per the worktrees docs), so the daemon path is the fix, not a permission rule.

Verification

Parser and accept-driver suites 51/51 green; the ruled-prompt case fails on main.

🤖 Generated with Claude Code

…e (RT-257)

Claude Code 2.1.281 paints the EnterWorktree relocation prompt under a full-width rule and a Tool use heading with no rounded box. The parser bounded the body by a box top only, so it read the live prompt as no dialog and every board-launched pane that entered an rt worktree by path stalled on an attention gate instead of being accepted. A rule now bounds the body the same way a box top does; a capture with neither still fails closed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 84 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 5bd77945-7e23-46bf-8af2-554890ee4b59

📥 Commits

Reviewing files that changed from the base of the PR and between 18664a6 and 9f51bdd.

📒 Files selected for processing (3)
  • lib/daemon/__tests__/trust-accept.test.ts
  • lib/daemon/__tests__/trust-dialog.test.ts
  • lib/daemon/trust-dialog.ts

Comment @coderabbitai help to get the list of available commands.

m4ttheweric and others added 3 commits September 23, 2026 19:59
…not by its top alone

Review finding on rt#394: every 2.1.x permission prompt paints under the same rule and asks the same question, and a Bash, Edit or MCP prompt shows text the model wrote, so a command echoing the reason phrase with a registered path would have been auto-accepted. A ruled prompt must open with the Tool use heading, an Entering worktree(<path>) echo whose path equals the reason's, and a gutter reason line; a boxed one must carry the EnterWorktree heading. The echo comparison also catches a wrap that drops a space inside the path.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…mmand text cannot paint one

Second review round on rt#394: a multi-line Bash command painted a fake ruled dialog inside its indented body, and a boxed command could paint a box top and an EnterWorktree line. The rule must start at column 0, the heading is exactly one space in, the echo three, the reason gutter one, and a boxed top must be a whole line followed by the EnterWorktree line. A wrapped echo is rejoined before the comparison.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…wer than the screen

Third review round on rt#394: when both the echo and the reason word-wrap at the same space, both rejoins drop it and agree on a collapsed, registered path. A path or echo split across rows now reads undrivable, so a human answers those (narrow panes), and the keypress only ever commits to a path that sat whole on one row. A rule shorter than some other line on screen is not the dialog's top, since text a command paints is capped short of the pane width.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@m4ttheweric

Copy link
Copy Markdown
Collaborator Author

Three review rounds (Opus reviewer of record, CodeRabbit rate-limited) hardened the original change. Where the parser stands now:

  • A ruled prompt is this dialog only when the rule starts at column 0 and is at least as wide as every other line on screen, the first line under it is exactly Tool use, the next starts with Entering worktree(, and the reason sits on a │ gutter line at column 1. A boxed prompt needs a whole-line box top followed by │ EnterWorktree. Command text, diffs and tool descriptions paint indented, so none can produce those.
  • The echo path must equal the reason's path.
  • A path or echo split across rows is never rejoined for a keypress; it reads undrivable and a human answers. Narrow panes fail closed rather than risk a wrap that drops a space inside the path.
  • Tests cover the real capture, a Bash command echoing the reason, an Edit diff, an MCP prompt with a gutter description, a command painting a fake ruled or boxed dialog, a shortened rule, the same-space wrap, and a pasted copy.

Known limit, pre-existing and true of any screen parser: if Claude Code ever passes raw control sequences (CR, ESC/CSI) through a displayed command, the screen itself can be forged. The full-width rule check blocks the cases a capped-width row can reach.

@m4ttheweric
m4ttheweric merged commit 2f487fa into main Sep 24, 2026
6 checks passed
@m4ttheweric
m4ttheweric deleted the rt-257-relocation-rule branch September 24, 2026 01:30
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.

1 participant