Skip to content

Dashboard D2b: the PR actions (a agent, w shell, d delta, e editor, o browser, y copy, x mute) and gh pr-review delta - #36

Merged
catalan-adobe merged 16 commits into
mainfrom
dash-d2b-actions
Dec 1, 2026
Merged

catalan-adobe merged 16 commits into
mainfrom
dash-d2b-actions

Conversation

@catalan-adobe

@catalan-adobe catalan-adobe commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

Dashboard phase D2b: the actions on a selected PR, as in docs/superpowers/specs/2026-11-26-review-dashboard-design.md ("Keys", "Asking an agent"). It covers a, w, d, e, o, y, x and :unmute, and adds gh pr-review delta to the CLI for d. D1 (#28) and D2a (#30, jobs) are merged; the inbox and the shepherd keys come in D3.

Handing the terminal over (a, w, d, e)

handover.rs leaves raw mode and the alternate screen, runs the program in its own process group as the terminal's foreground group, and waits, as system(3) does.

  • Ctrl-C: while the program runs, the dashboard catches SIGINT and SIGQUIT with an empty handler. A caught signal goes back to its default in the program, so Ctrl-C ends the program only.
  • Coming back: the dashboard takes the terminal back, restores the cooked terminal modes it saved (so a program killed after stty -echo -icanon doesn't break the next one), re-enters raw mode, and redraws everything, whether the program succeeded, failed, was killed or couldn't start.
  • Process groups: the program runs in its own process group, which gets the terminal (tcsetpgrp), so Ctrl-C can't reach the dashboard's group. Ctrl-Z stops both, and fg resumes both.
  • Input and workers: the input thread is stopped before the program starts, so every key goes to it. Workers (status refresh, jobs) keep running; nothing draws meanwhile.

Sessions in the review worktree

a, w and e run through the new gh pr-review session <PR-URL> -- <program> [args…].

  • Locks: it takes the PR lock and then the clone-for-PR lock, the same functions and order as a round, without waiting. Under both locks it checks the review worktree (owned_worktree, inside <clone>.reviews).
  • The program: runs as a child in the worktree. Ctrl-C reaches only the program. The locks are released when it ends, even if it's killed. The wrapper returns the program's status: 125 when the session can't start, 126 or 127 when the program can't run.
  • Concurrent rounds: a round, preview or gc of the same PR started meanwhile is refused at once.
  • Edits don't survive: the review worktree belongs to the tool, and the next round or preview resets uncommitted changes. The a/w confirm and the note after e say so; commit and push from your own clone.

The actions

  • a, ask an agent:

    1. Runs show <url> --json -u <account>.
    2. Writes <pr state folder>/brief-<time>.md (0600). The brief holds the PR, the loop label, diagnosis and blocking series, the rounds, the last review's open and Later findings, the approach notes, the open threads, the description, and the spec's question. It says that text quoted from the PR is data, not instructions.
    3. Runs dash.agent.command in the review worktree. The default is pi --no-context-files --no-skills --no-extensions "Read {brief}, then answer its question.": the same flags as the CLI's reviewer, so a PR's AGENTS.md or CLAUDE.md isn't loaded as instructions.
      • Placeholders ({brief}, {worktree}, {pr}, {url}, {number}) become references to GH_PR_REVIEW_* environment variables set only for that command, so values are never spliced into shell source.
      • Refused: a placeholder inside single quotes, or inside backquotes within double quotes, is a config error.

    The loop-check stop dialog from D2a gains "Ask an agent".

  • w: $SHELL (else /bin/sh) in the review worktree.

  • d: the changes since the last round, in $PAGER (else less -R), from the new gh pr-review delta <PR-URL> [--color].

    • It reads the clone named in pr.json and compares the last refs/pr-review/…/round-K with …/head through lib/delta.sh's pick_delta. That gives a plain diff, a diff after the base was merged in, or a range-diff after a rebase.
    • It makes no GitHub call and doesn't fetch, so the head is what the last round or preview fetched; the pager's header says so.
    • Nothing is written to the clone. Comparisons use none of the clone's diff drivers: --no-textconv --no-ext-diff on diff, and environment overrides for range-diff's internal log -p, after dropping config inherited from a parent git. Otherwise a caching textconv driver would write a broken notes ref into the clone.
    • The output reaches the pager as bytes, through a private 0600 file.
  • e: from the Findings tab, which now has a cursor, opens the selected finding as $EDITOR +N <file> (else vi) in the review worktree. Only a regular file beneath the canonical worktree is opened, by its verified path; symlinks pointing outside are refused.

  • o: opens the PR in the browser (open or xdg-open, http(s) only, detached).

  • y: copies the URL through OSC 52, plus pbcopy, wl-copy or xclip if present, then shows a toast.

  • x: after you confirm, adds host/owner/repo#N to the config's ignore list and refreshes. :unmute in the palette lists the entries and removes one.

    • Only the ignore value in the file changes; everything else stays byte for byte.
    • The edit runs in a worker, under an flock beside the resolved file, so two dashboards can't lose each other's changes.
    • An explicit null and a dangling symlink are refused.
    • The file is written to a temporary file and renamed, keeping its mode; a new file is 0600.
    • A file that is invalid JSON, not an object, or with an ignore that isn't a list of strings is refused and never written.
  • No review worktree: a PR never reviewed here, or whose worktree gc removed, gets a dialog instead of a, w or e. The dialog suggests p, which makes the worktree and posts nothing. The state folder isn't used instead: it has no code to look at, and its files belong to the CLI.

Config

dash.agent.command.

Tests

  • Unit: placeholder quoting, tested through sh with spaces, quotes, $(…) and backquotes; the brief, as a snapshot from a fixture; the editor, delta, browser and clipboard commands; and the ignore-list edits (append, no duplicate, unmute, invalid files refused, other keys kept, file mode).
  • Handover: through the helper, with fake agent, shell, editor, pager and clipboard scripts that record their arguments, folder and stdin. The dashboard redraws after each case.
  • tests/pty.rs: runs the real binary in a pseudo-terminal: a fake shell reads a typed line, Ctrl-C ends the shell and not the dashboard, the dashboard redraws, and q exits 0.
  • Snapshots: 7 new (the session warning, the brief, the mute confirm, the no-worktree dialog, the palette with :unmute, the unmute list, the Findings cursor). 14 changed: the footer and help list the new keys, and the stop dialog has the agent button.
  • tests/delta-cmd.sh: 25 checks of the new subcommand: no network, nothing written to the clone (including with a caching textconv driver from the config or an inherited git -c), and each kind of delta.
  • tests/session.sh: 20 checks: locks held while the program runs, released after it ends or is killed, a missing worktree refused, the exit code passed on, Ctrl-C.
  • Results: cargo passes 193 tests (114 unit, 12 actions, 6 contract, 17 jobs, 1 pty, 41 render, 1 sequence, 1 stop-all), with the contract test required, on macOS (Rust 1.88 and 1.100.1, CI's version) and on Linux (rust:1.88). Every shell test file passes under /bin/bash 3.2. fmt, clippy and the shell lint are clean.
  • Follow-ups: Dashboard actions: sessions, handover and config edits left from #36 round 2 #37 has round 2's important and minor findings.

A shared helper for a, w, d and e: leave the alternate screen and raw mode, run the program in the
foreground with the terminal (it inherits stdio, in the dashboard's process group; the dashboard
waits, as system(3) does), then restore the screen whatever way the program ended. The terminal's
SIGINT and SIGQUIT are caught by a no-op handler meanwhile, so ctrl+c ends the program only (a caught
signal is back to its default in the program); a program that kept the terminal for its own group is
made give it back. An input gate stops the key-reading thread first.
actions.rs: placeholders quoted for the shell where they stand, the brief from show --json, the
editor, pager, shell, browser and clipboard command lines, OSC 52, the PR's state folder (checked
against lib/state.sh by the contract test). ignore.rs: add to and remove from the config's ignore
list, changing only that value, refusing a file it can't read, written atomically. dash.agent.command
in the config.
a writes a brief from show --json (as the PR's account) into the PR's state folder, then hands the
terminal to dash.agent.command in the review worktree; the loop check's stop offers it too. w opens
$SHELL there, e the Findings tab's selected finding in $EDITOR (+line file; the tab has a cursor
now), d pages gh pr-review delta in $PAGER. Without a review worktree, a dialog says so (not run in
the state folder: no code there, and its files are the CLI's). o opens the browser and y copies the
URL (OSC 52 and pbcopy/wl-copy/xclip), detached. x mutes after a confirm; :unmute in the palette
lists the ignore entries. Keys, help, palette and footer (gc keeps its room on the dashboard).
Tests: the actions end to end through the handover helper with fake programs, and in a pty.

@catalan-adobe catalan-adobe left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Approach

What it does: Completes D2’s seven PR actions: ask an agent, open a shell, page the delta, edit a finding, open or copy the URL, and mute the PR. The new gh pr-review delta compares locally saved refs without fetching.

Fit with the repo: Two boundaries need attention. First, a, w, and e open writable sessions in the review worktree without taking its locks. The PR says “Workers (status refresh, jobs) keep running,” but README.md and lib/worktree.sh say a round resets and cleans that checkout. A same-PR preview can erase an edit; an edit during review can trip the reviewer’s change detector. Second, dash/src/actions_app.rs lists, adds, and removes ignore entries directly from key handlers, including a synchronous disk flush. Merged PR #30 moved disk work off that thread so slow storage cannot freeze input and drawing.

Strongest case for the approach as built: The base dashboard design explicitly calls for these actions. Four of them share one terminal handover in dash/src/handover.rs, and d reuses pick_delta in lib/delta.sh rather than teaching Rust how to compare rebased rounds. I would keep both choices.

Alternatives: Keep the handover, but have a CLI wrapper hold the existing PR and clone locks for the lifetime of a, w, or e. That makes a same-PR round wait or refuse while leaving other PRs alone. For mute/unmute, send the three config operations through the existing worker-effect channel: a few more messages, no new worker architecture.

Questions for the author: Should edits survive the next preview? If not, a locked session with an explicit reset warning would settle the worktree concern for me. If so, those sessions need a separate user-owned worktree, at the cost of another checkout.

Missing context: No PR discussion clarifies the intended lifetime of interactive edits.

Approach: Questionable

Strengths

  • lib/delta.sh:280–304 resolves the saved refs to commits and reuses pick_delta. The header also tells the reviewer exactly how fresh the comparison is, rather than implying it includes the latest push.
  • dash/src/actions.rs:205 creates briefs exclusively with mode 0600, so two requests in the same second cannot overwrite one another. dash/src/actions_app.rs:150–169 also checks the request ID before launching the agent: a late worker response cannot reopen a cancelled dialog.
  • dash/tests/pty.rs:203–230 checks real terminal behavior, including cooked input, Ctrl-C, redraw, and a clean quit. I ran the eight action tests and the PTY test from a temporary copy; all nine passed without modifying the checkout.

Issues

🚨 Critical (Must Fix Before Merge)

  • lib/delta.sh:313 — A read-only delta can leave a broken ref in the user's clone. A normal git diff honors configured text-conversion drivers. With diff.<driver>.cachetextconv=true, Git writes refs/notes/textconv/<driver>. Line 299 redirects the objects, not the refs: the ref is updated in the real clone, but its new commit is deleted with the temporary object directory. The object-file comparison in tests/delta-cmd.sh:121–127 misses precisely this failure.

    • Disable text conversion and external diff drivers for the comparison, or run it in an isolated temporary Git repository that borrows the clone's objects but owns its refs. Test that the clone's refs remain unchanged and readable with a caching textconv driver configured.
  • dash/src/actions_app.rs:107 — A same-PR preview can discard edits while the interactive session is still open. path.is_dir() is the only admission check shared by a, w, and e. A queued preview can start after that check and run the forced checkout and clean at lib/worktree.sh:420–422, erasing a saved tracked edit or an untracked file. Conversely, saving from the editor during a review can make that review exit 4. Neither requires the user to start a second dashboard.

    • Acquire the existing PR and clone-for-PR locks, validate the worktree under those locks, and hold them until the program exits. Warn before handover that a subsequent preview resets uncommitted work; locking solves the concurrent loss, not that later reset.

⚠️ Important (Should Fix)

  • dash/src/actions.rs:96 — The editor's containment check is lexical only. A finding with an ordinary relative path passes even when the file, or an intermediate directory, is a symlink outside the worktree. The editor follows the link, so saving a purported PR file can modify an unrelated user file.

    • Resolve the worktree and target, require the target to be a regular file beneath the resolved worktree, and pass that verified path to the editor. Cover both a file symlink and a directory symlink.
  • dash/src/handover.rs:100 — The child does not get the promised foreground process group. cmd.spawn() inherits the dashboard's group. Catching SIGINT and SIGQUIT protects the dashboard process, not other members of that group: for example, Ctrl-C can also terminate a foreground output consumer such as tee, leaving the dashboard without its output when it returns. The PTY test starts the dashboard as session leader and has no such sibling.

    • Give the child its own process group, transfer foreground ownership before it reads, and reclaim it on exit or stop. Extend the PTY test to assert that the child's foreground PGID differs from the dashboard's and that a sibling in the dashboard's group survives.
  • dash/src/main.rs:166 — A killed editor can change the terminal mode used by every later handover. After try_restore() releases crossterm's saved mode, enable_raw_mode() saves whatever attributes the child left behind. If an editor dies with echo or canonical input disabled, the dashboard may redraw correctly, but the next w starts with those broken settings; quitting can restore them too.

    • Save the cooked termios before spawning and restore it after reclaiming the terminal, before re-enabling raw mode. Test a child that changes terminal attributes and dies, then check the next shell's attributes, not just the redraw.
  • dash/src/handover.rs:167 — The input pause succeeds without an acknowledgement on timeout. A stalled but live input thread is treated just like an exited one. If it resumes between wait_open() and event::read() after the child starts, it can consume the child's first keystroke and queue it as a dashboard command.

    • Distinguish “paused,” “exited,” and “timed out.” On timeout, abort the handover and reopen the gate rather than starting a second terminal reader.
  • dash/src/actions.rs:45 — Placeholder quoting loses the shell context inside a command substitution. For example, in the reasonable custom template agent "$(cat {brief})", the shell parses the command inside $() independently, but substitute still thinks it is inside the outer double quotes. The generated filename contains literal quote characters, and shell expansions in the value are no longer reliably inert.

    • Pass values separately from shell source. Either support a restricted argument-template grammar with substitution after tokenization or reject unsupported shell contexts explicitly. Include the nested cat example in the sh argument tests.
  • dash/src/actions.rs:11 — The specified default lets the PR supply instructions outside the brief. Plain pi, started in the PR worktree at dash/src/actions_app.rs:166, discovers the checked-out AGENTS.md or CLAUDE.md as agent context. A PR changing that file can therefore steer the answer as instructions, not as quoted data. The warning inside the brief does not cover this channel. This is a safety gap in the planned default, not a request to make the interactive session read-only.

    • Disable project context discovery for the built-in review-agent command, as the CLI already does at gh-pr-review:1369, and leave project-local instructions or extensions as an explicit user opt-in.
  • dash/src/cli.rs:113 — The pager rejects valid Git output that is not UTF-8. delta uses the JSON-oriented runner, which applies strict String::from_utf8 at line 324. Git can emit raw text hunks from a Latin-1 source file; the CLI comparison succeeds, but d reports a decoding error and never opens the pager. Large diffs are also buffered in full and then cloned for the pager.

    • Keep delta output as bytes, preferably spooling it to a private temporary file or piping it to the pager. Keep strict UTF-8 decoding for the JSON commands only.
  • dash/src/ignore.rs:29 — Atomic rename does not prevent lost config updates. Two dashboards can read the same list, append different PRs, and both report success; the last rename silently undoes the first mute. The same race can restore an entry another dashboard just removed.

    • Serialize the entire read–validate–modify–rename operation with a stable lock beside the resolved config target. Locking the replaced file itself is insufficient because rename changes its inode. Add a two-writer test.
  • dash/src/actions_app.rs:299 — Mute and unmute block the event loop on storage. The key handler runs ignore::add directly, including sync_all() at dash/src/ignore.rs:193; listing and removing entries at lines 315 and 328 are synchronous too. A slow or unavailable home-directory mount stops input and drawing, not merely the config action.

    • Send these operations through worker effects. Refresh only after a successful edit response, and let the user dismiss a pending list request without a late response reopening it.
  • dash/src/ignore.rs:65 — An explicit null ignore value is rewritten instead of refused. None and Some(Null) both become an empty list, so x changes {"ignore":null} despite the documented “not a list of strings is never written” rule. The test at line 267 asserts the opposite of that requirement.

    • Default only a missing key to an empty list. Move the null case into the refusal tests and assert that the original bytes survive.
  • dash/src/ignore.rs:182 — Muting replaces a dangling config symlink. If a dotfiles symlink's target is missing or its volume is unmounted, both the initial read and canonicalize return NotFound. The fallback then renames a new regular file over the symlink itself. Remounting the volume does not restore the user's config link.

    • Distinguish an absent directory entry from a dangling symlink with symlink_metadata. Refuse the edit when the link target cannot be resolved, and test that the link survives.

💡 Minor (Nice to Have)

  • dash/src/actions_app.rs:189 — The highlighted finding and the editable finding can disagree after refresh. If a new round has fewer findings, dash/src/ui/detail.rs:858 visually clamps the cursor to the last row, but selected_finding() uses the old index and returns None. Pressing e then says “No finding selected” while a finding is visibly selected. Clamp the stored cursor when replacing the detail, or share one effective-index helper.

  • dash/src/ignore.rs:172 — Adding ignore to an empty object drops its interior whitespace. For an input such as {\n}\n, i already points at }, so the existing newline inside the object disappears. Insert the new member without deleting that whitespace, and test the byte-preservation promise on an empty multiline object.

Recommendations

The most useful regression tests here are before-and-after checks on resources the dashboard borrows: clone refs as well as objects, terminal attributes as well as screen output, and the config as observed by two independent writers. These catch failures that successful exit codes and render snapshots cannot.

Assessment

Ready to merge? No

Reasoning: The main actions work on their tested paths, but a nominally read-only delta can damage a clone ref, and an ordinary background preview can erase work from an active session. Those are merge blockers independent of the smaller terminal and config fixes.


Review generated by gh pr-review · model: azure-openai-direct/gpt-6.2-astra

…after a warning that the worktree is the tool's
…file beneath the worktree, symlinks resolved
…al's modes restored, no handover without the input paused
…es; the default pi without the worktree's context files, skills and extensions
… a dangling symlink refused and kept, an empty object's whitespace kept
…fresh after a successful edit only; a dismissed list stays closed
@catalan-adobe

Copy link
Copy Markdown
Owner Author

Thanks for round 1. Both critical findings, the approach points and the other 13 findings are fixed in 9 commits (118f95e…40f334d). Every new test failed on 690a626.

Approach

  • Sessions on the review worktree, and your question: edits don't survive the next round or preview. The worktree belongs to the tool and gets a forced checkout and clean; commit and push from your own clone. The a/w confirm, the note after e, and both READMEs say so. The locking is the critical fix below.
  • Mute and unmute on the UI thread: fixed in 26b0dd7, through worker effects (see below).

Critical

  • lib/delta.sh:313 (textconv writes refs into the clone): fixed in 118f95e.
    • The diff commands delta prints run with --no-textconv --no-ext-diff.
    • range-diff's internal log -p ignores that flag, so delta also overrides every diff.<driver>.textconv/cachetextconv in the clone's config through GIT_CONFIG_COUNT. merge-tree uses no diff driver.
    • Test, with a caching textconv driver in the rebased, merged-base and plain cases: for-each-ref is byte-identical afterwards, refs/notes/ stays empty, and fsck --connectivity-only is clean. It failed on 690a626.
  • actions_app.rs:107 (sessions vs rounds): fixed in 34485e8 with gh pr-review session <PR-URL> -- <program> [args…].
    • It takes the PR lock and then the clone-for-PR lock, the same functions and order as a round, without waiting. It re-reads pr.json under the lock and requires owned_worktree inside <clone>.reviews.
    • It runs the program as a child in the worktree, catching SIGINT and SIGQUIT with a no-op so the program keeps their defaults. Its EXIT trap releases the locks, including when the program is killed.
    • It returns the program's status: 125 when the session can't start, 126 or 127 when the program can't run.
    • A round, preview or gc of the same PR started meanwhile is refused at once ("another review of this PR is running").
    • The dashboard runs a, w and e through it. tests/session.sh has 20 checks.

Important

  • actions.rs:96 (editor path): fixed in d326381. The worktree and the target are canonicalized, and only a regular file beneath the canonical worktree is opened, by its verified path. File and directory symlinks pointing outside are refused.
  • handover.rs:100 (foreground group): fixed in a5349b3. The child gets its own process group and the terminal (tcsetpgrp), and the dashboard takes the terminal back on exit or Ctrl-Z. The PTY test checks that the child's group differs from the dashboard's and that a sibling in the dashboard's group survives Ctrl-C.
  • main.rs:166 (modes after a killed child): fixed in a5349b3. The cooked termios is saved when the dashboard leaves the screen and restored before it re-enters raw mode. Test: a child killed after stty -echo -icanon leaves the next shell with echo and icanon.
  • handover.rs:167 (input pause): fixed in a5349b3. A pause ends as paused, exited or timed out; a timeout aborts the handover and reopens the gate.
  • actions.rs:45 (placeholders in nested contexts): fixed in cdbef8e. Values go through GH_PR_REVIEW_{BRIEF,WORKTREE,PR,URL,NUMBER}, set only for that command, and are never spliced into shell source.
    • A small lexer emits "$VAR" unquoted or inside $(…), and ${VAR} inside double quotes.
    • It refuses a placeholder inside single quotes, or inside backquotes within double quotes, with a config error.
    • Tests cover agent "$(cat {brief})" and values with spaces, quotes, $(…) and backquotes.
  • actions.rs:11 (the PR's AGENTS.md): fixed in cdbef8e. The default command uses the reviewer's pi flags, --no-context-files --no-skills --no-extensions, and the README says how to opt back in.
  • cli.rs:113 (delta not UTF-8): fixed in 64f5b69. delta's output goes as bytes to a private 0600 file that the pager reads, removed afterwards. A Latin-1 hunk arrives unchanged.
  • ignore.rs:29 (lost config updates): fixed in f50b7e2. Read, validate, modify and rename all happen under an flock on .<name>.lock beside the resolved file. The kernel drops the lock if its holder dies, so there's no stale-lock handling. Test: two writers with 40 adds each, and a remove racing an add; every entry survives.
  • actions_app.rs:299 (storage on the event loop): fixed in 26b0dd7. Add, remove and list go through worker effects. The dashboard refreshes only after an edit that changed the list, and a dismissed :unmute list doesn't reopen on a late reply.
  • ignore.rs:65 (null): fixed in f50b7e2. An explicit null is refused and its bytes survive; only a missing key starts an empty list.
  • ignore.rs:182 (dangling symlink): fixed in f50b7e2. Detected with symlink_metadata and refused; the link stays.

Minor

  • actions_app.rs:189 (cursor after a refresh): fixed in 40f334d. The stored cursor is clamped when the detail is replaced, and drawing and e share one index helper.
  • ignore.rs:172 (empty multiline object): fixed in f50b7e2. {\n} becomes {\n "ignore": [...]\n}.

Checks on 40f334d:

  • dash/: 193 Rust tests pass with the contract test required, on macOS (Rust 1.88 and 1.100.1, CI's version) and on Linux (rust:1.88). fmt and clippy are clean on both versions.
  • Shell: every shell test file passes on macOS bash 5 and Ubuntu 26.04, including session and delta-cmd; the touched files also pass on /bin/bash 3.2.
  • Lint: clean.

@catalan-adobe catalan-adobe left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Round 2 · since round 1

11 fixed · 4 still open · 5 new (5 in the new commits) · open blocking: 7 (was 13) · loop: early

Approach

What it does: Completes D2’s seven planned PR actions: ask an agent, open a shell, page the delta, edit a finding, open or copy the URL, and mute the PR.

Fit with the repo: Both round 1 concerns are resolved. a, w, and e now use lib/session.sh, which validates the worktree and holds the same two locks as a review until the program exits. A same-PR preview cannot reset the checkout mid-session. The author clarified that “edits don't survive the next round or preview,” and both READMEs document that limit. Listing, adding, and removing mute entries now run through worker effects in dash/src/cli.rs, so config I/O no longer blocks input or drawing.

Strongest case for the approach as built: The base dashboard design calls for terminal handover, not a built-in editor or diff viewer. Four actions share dash/src/handover.rs, and d reuses pick_delta in lib/delta.sh. Rust manages the terminal; the CLI decides what changed between rounds.

Alternatives: Keep the shared review worktree. A separate user-owned checkout would earn its extra setup and cleanup only if edits needed to survive a later round.

Questions for the author: None.
Missing context: None.

Approach: Sound

Strengths

  • lib/session.sh:92–109 takes the same two locks, in the same order, as a review and holds them while the program runs. tests/session.sh:92–140 checks contention and cleanup, including a child that catches Ctrl-C and takes time to exit.
  • dash/src/ignore.rs:34–59 puts the entire read–modify–rename operation under a stable lock. The concurrent-writer test at dash/src/ignore.rs:384 checks the resulting entries, not just the writers’ exit codes.
  • dash/tests/pty.rs:239–266 checks two things a render snapshot cannot: that Ctrl-C spares another process in the dashboard’s group, and that a killed child does not leave the next shell without echo or canonical input. I ran the 12 action tests and the PTY test on macOS from a temporary copy; all 13 passed.

Issues

🚨 Critical (Must Fix Before Merge)

  • F1 · lib/delta.sh:338 — An inherited Git setting can still leave a broken textconv ref in the clone. The new flags protect ordinary diffs, and the new overrides protect range-diffs against settings in config files. But GIT_CONFIG_PARAMETERS, inherited from a parent Git command’s -c options, takes precedence over GIT_CONFIG_COUNT. I verified with a read-only config query that the effective cachetextconv value is still true in that case. On a rebase, the internal git log -p can therefore write the notes ref to the clone while its commit goes into the temporary object directory deleted at lib/delta.sh:298. The regression test explicitly unsets GIT_CONFIG_PARAMETERS.
    • Clear the inherited parameters before discovering and overriding drivers, as lib/guard.sh:41 already does, or run the comparison in a repository that owns its refs as well as its temporary objects. Include inherited command-line config in the ref-integrity test.

⚠️ Important (Should Fix)

  • F3 · dash/src/actions_app.rs:333 — The editor’s file is verified before the session locks the worktree. Static symlinks out of the checkout are now refused. But e resolves an absolute path from cached status and passes it to a session that independently re-reads pr.json. If a preview used another --clone since the last refresh, the old worktree can still exist: the session locks the new clone while the editor opens the old file. A preview finishing between verification and lock acquisition can also replace a previously regular path with a symlink.

    • Pass the relative finding path into the session. Resolve it and check containment against the locked worktree immediately before launching the editor. Test with cached status naming one worktree and pr.json naming another.
  • F7 · dash/src/actions.rs:100 — A shell case pattern still breaks placeholder quoting inside command substitution. The reported $(cat {brief}) case is fixed. In agent "$(case md in md) cat {brief};; esac)", however, the lexer mistakes the pattern’s ) for the end of $(). It emits ${GH_PR_REVIEW_BRIEF} unquoted inside cat. I checked the resulting expansion with dash: a value of two words becomes two arguments.

    • Either parse this context correctly or reject it explicitly and direct users to a wrapper script. Keep the environment-variable transport; the remaining bug is where the reference is quoted.
  • F8 · dash/src/actions.rs:15 — The default agent can still load PR-authored system instructions. --no-context-files fixes the AGENTS.md and CLAUDE.md case. Pi 1.7.0 discovers .pi/SYSTEM.md and .pi/APPEND_SYSTEM.md separately (dist/core/resource-loader.js:492,961–975). If the user already trusts the worktree or its parent, a later PR revision can supply either file without a new trust decision. The brief is then not the only source of project instructions, contrary to dash/README.md:237–242.

    • Add --no-approve to the built-in command to force untrusted-project mode. Leave trusting the checkout as an explicit custom-command choice, and test the already-trusted-parent case.
  • dash/src/config.rs:143 — Rejecting an agent template can launch a different agent instead. A config containing claude 'Read {brief}' fails the new validation, but load at line 159 replaces the whole dashboard config with defaults. After the startup warning expires, pressing a runs Pi rather than refusing the action; unrelated settings such as max_jobs and model are lost too. The refusal test sets the command directly on an already-loaded app, so it misses the production path.

    • Preserve the other settings and retain the agent validation error so a shows it and launches nothing. Test through config::load.
  • dash/src/handover.rs:134 — The parent can take foreground ownership away from the child’s own job. The pre-exec hook already gives the terminal to the child before it runs. The parent gives it to that same group again after spawn() returns. If the parent is descheduled and the child meanwhile foregrounds a different process group, the second call undoes that transfer. The foreground job can then stop on its next terminal read while the dashboard waits for the launcher.

    • Perform the initial transfer once, in the pre-exec hook, and propagate tcsetpgrp failure rather than returning Ok(()) unconditionally. Keep the parent’s transfers for reclaim and explicit resume.
  • dash/src/main.rs:267 — Quitting can silently discard a confirmed mute or unmute. Confirmation now queues an effect. If confirmation and q are in the same input batch, the loop breaks before dispatching it. If the worker has started but is waiting on the config lock, shutdown does not wait for it either. The dashboard can exit successfully with the config unchanged.

    • Track outstanding config writes. On quit, dispatch and finish confirmed writes, or tell the user the edit is pending and let them choose whether to abandon it. Cover both a same-batch quit and a held config lock.

💡 Minor (Nice to Have)

  • dash/src/cli.rs:412 — A cancelled delta can leave its spool file behind on quit. Cleanup depends on the event loop receiving the result or finishing the handover. Cancel followed by quit can drop the receiver or its queued message, leaving a private but potentially large diff on disk. Pass an already-unlinked file descriptor to the pager, or give the spool an owner that handles shutdown as well as ordinary completion.
  • dash/tests/pty.rs:269 — Later redraw checks can match the first shell’s output. wait_for searches the entire transcript, and the exit-code-4 message was already present at line 246. The waits at lines 269 and 279 therefore do not establish that those handovers have returned before the next key is sent. Record the transcript offset before each handover and match only newly written output.
Fixed since the last round (11)
  • F2 — The production session takes the PR and clone locks before running the program and releases them on exit.
  • F4 — The child gets a separate foreground process group; Ctrl-C no longer reaches a sibling in the dashboard’s group.
  • F5 — The dashboard saves cooked termios and restores it before re-entering raw mode.
  • F6 — A pause timeout reopens the input gate and aborts the handover.
  • F9 — Delta stdout goes directly to a file as bytes; JSON commands retain strict UTF-8 decoding.
  • F10 — A stable sibling lock serializes config edits across atomic renames.
  • F11 — Listing, adding and removing ignore entries run in workers; a dismissed list stays closed.
  • F12 — An explicit null is refused without rewriting the config.
  • F13 — A dangling config symlink is detected and left intact.
  • F14 — Refresh clamps the stored cursor, and rendering and editing use the same index rule.
  • F15 — Inserting ignore into an empty object preserves its existing whitespace.

Recommendations

Add one integration test that crosses the dashboard-to-real-session boundary rather than testing each half with matching fixtures. Start with stale dashboard status, then assert which worktree is locked and which file the editor actually receives. For config edits, make the equivalent assertion after the dashboard process exits: inspect the file, not just the queued effect.

Assessment

Ready to merge? No

Reasoning: Eleven earlier findings are fixed, including the common-case session locking and terminal restoration problems. A read-only delta can still damage a clone ref, and the editor and default agent still have paths around their intended safeguards.


Review generated by gh pr-review · model: azure-openai-direct/gpt-6.2-astra

…anks GIT_CONFIG_COUNT), so an inherited -c textconv driver writes no ref into the clone; tests/delta-cmd.sh: the inherited driver
@catalan-adobe

Copy link
Copy Markdown
Owner Author

Thanks for round 2. Under this PR's rule, only critical findings get fixed after round 2, and then it merges. The 6 important and 2 minor findings are in #37.

Critical

  • F1, lib/delta.sh:338 (an inherited git -c textconv driver): fixed in 49a3a52. delta_no_drivers now drops GIT_CONFIG_PARAMETERS before it finds and overrides drivers, as the reviewer's git already does in lib/guard.sh. A driver that only a parent's -c named is gone, and one in the config files gets the overrides.
    • New checks in tests/delta-cmd.sh: with GIT_CONFIG_PARAMETERS="'diff.up.textconv'='tr a-z A-Z <' 'diff.up.cachetextconv'='true'" and a rebase, the range-diff doesn't use the driver, the clone's refs are byte-identical with no refs/notes/, and fsck --connectivity-only is clean.
    • The ref and fsck checks failed before the fix: the notes ref was written into the clone.

Checks on 49a3a52:

  • delta-cmd: 25 checks pass on bash 5 and /bin/bash 3.2, and delta.sh passes.
  • Lint: clean.
  • CI: run 46720991289 passed: lint, 2376 shell checks with 0 failures, and all 193 Rust tests.

@catalan-adobe
catalan-adobe merged commit 177c903 into main Dec 1, 2026
2 checks passed
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