Skip to content

Dashboard D2a: run rounds and previews as jobs (r, p), the Jobs view, the log, toasts - #30

Merged
catalan-adobe merged 22 commits into
mainfrom
dash-d2a-jobs
Dec 1, 2026
Merged

catalan-adobe merged 22 commits into
mainfrom
dash-d2a-jobs

Conversation

@catalan-adobe

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

Copy link
Copy Markdown
Owner

Dashboard phase D2a: the dashboard runs review rounds as jobs. r runs a round and p a preview, through the inline launcher. This PR also adds the Jobs view, the log view and toasts. D2b adds the other actions (a, w, d, e, o, y, x); the design is in docs/superpowers/specs/2026-11-26-review-dashboard-design.md ("Jobs", "Screens › Jobs").

r and p

  1. The dashboard first runs gh pr-review <URL> --check --json -u <login> for the account that listed the PR, and shows the loop check in a dialog. The dialog says "As on ". If gh has no stored login for that account, nothing starts; the dialog says why. The round runs with that same -u. Since -u is a login of the PR URL's host for the review run, --check and gc (fixes #29) #32, the CLI looks -u up on the PR URL's host.
  2. What the dialog offers depends on the check:
    • Run (or a warning): [Start].
    • Stop (exit 3): the reason and the suggested move, with [Run anyway] (--force-round). Cancel is selected first.
    • No new commits (exit 5): says so, with [Run anyway].
    • A failed check: the error.
  3. The job's command is gh pr-review <URL> -y -u <login> [--model <dash.model>] [--no-post] [--force-round]. The dialog shows it, with the buttons always on screen, and accepts Start only once the whole text has been seen. It also says that r posts what it writes and p previews without posting.

p runs the loop check too: it's how the dashboard knows which account works, and a -y preview would stop at exit 3 or 5 anyway.

Jobs

  • Files: each job has <state>/jobs/<id>.json (kind, PR, URL, account, argv, start time, PID, process group), .log (stdout and stderr) and .exit. The folder is 0700, the files 0600, and the JSON is written to a temporary file and renamed.

  • State folder: found with the CLI's own rule; a contract test runs lib/state.sh's functions under seven environment cases and compares the paths.

  • Launcher: /bin/sh -c WRAPPER <exit-file> <argv…> runs in a new session (setsid), with stdin /dev/null. The wrapper runs the command only once the job's record is saved, writes the exit code atomically, and survives a SIGTERM, so a stopped job still gets its code.

  • A worker owns the jobs: it handles the jobs folder, the processes, the exit files, launching, saving, logs and stopping, and reports through the event channel, so the UI thread does no I/O for jobs. Admission runs under a lock in the jobs folder, so dashboards that share the folder share dash.max_jobs and the one-job-per-PR rule.

  • Lost: a job without an .exit file whose PID is gone is marked lost.

  • Limits: at most dash.max_jobs (default 3) run at once; more wait in a FIFO queue. One job per PR: r and p refuse when that PR already has one.

  • Progress: the header counts running and queued jobs, the PR row shows a mark, and the detail's Overview shows the job's last log line.

  • The end: the .exit file is checked on each tick. When a job ends, the PR's status and detail are refreshed and a toast is shown:

    Exit Toast
    0 "Round 3 posted · #823 · blocking 5 (was 6) · converging", with the numbers from a status read after the round
    3 the loop check stopped it
    5 no new commits
    1, 4 failed, see the log
    6 the rounds changed while it ran
    stopped, lost one each

    dash.notify: toast (the default), bell, or desktop (OSC 9).

  • Quitting with jobs running: the dashboard asks, then leaves them running. On the next start, it reads their files: finished jobs get their toast once, running ones are followed, and dead ones are marked lost. Queued jobs live in memory only, and the quit dialog says so.

Jobs view (J)

  • Columns: running, queued and finished jobs, each with its kind, PR, start time, duration and state.
  • enter: opens the log full screen, following while the job runs (F toggles following, G jumps to the end).
  • K: stops a running job that this dashboard started (SIGTERM to its process group, SIGKILL after 5 s), after you confirm. The signal goes through the dashboard's unreaped child, so it can't reach a reused process group. A job restored from an earlier session is shown but not stopped; K names its process group so you can stop it yourself. On a queued job, K asks before removing it. A quit finishes the stops under way.
  • c: clears finished jobs and deletes their files.

Config

dash.max_jobs, dash.notify, and dash.model. With no dash.model, jobs use the CLI's default model.

Notes

  • No new crates: kill and setsid are declared in a new sys.rs, as D1 already did for kill.
  • Unix only: the crate now fails to compile elsewhere; CI runs on Ubuntu.
  • Toasts: they queue, and a job's end is marked shown once its toast is on screen. A round's toast gives numbers only for the one round posted while the job ran, else "Round posted · #N".
  • Follow-ups: Dashboard jobs: admission, toasts, stops and cleanup edge cases (from #30 round 2) #35 has round 2's important and minor findings: admission and stops under contention, toast acknowledgement timing, round matching, zombies, a cleared job recreated by another dashboard, and the folder being unavailable.

Tests

  • Unit: job states from .exit files, including lost; the queue and the one-job-per-PR limit; the keymap; the toast texts.
  • End to end, through the real launcher with a fake gh-pr-review: a job's end gives a toast and a refresh; a job outlives the dashboard and its toast shows once on the next start; K stops the whole process group; a lost job.
  • Render snapshots:
    • 8 new: the Jobs view, the log, the dashboard with jobs and toasts, and the round dialog for run, stop and no new commits.
    • 12 changed: the footer and help now list the new actions.
  • Results on macOS: cargo passes 80 unit, 5 contract, 6 jobs, 34 render, 1 sequence and 1 stop-all tests, with the contract test required. fmt, clippy and the shell lint are clean.
  • Results on Linux: the jobs, render and lifecycle tests pass in a Rust 1.88 container.

@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: r and p run the CLI’s loop check, then launch a confirmed round or preview. The Jobs view follows its log and reports the outcome even after the dashboard restarts.

Fit with the repo: Jobs belong in dash/. Two choices need adjustment. First, the base dash/src/app.rs sends I/O through worker effects; jobs_app.rs now starts processes, saves records, and reads logs on the UI thread’s 200 ms tick. Slow storage can stall input and drawing. Second, the PR says a reused PID “still shows as running.” That is more than a display issue: K can then signal an unrelated process group using the saved PGID.

Strongest case for the approach as built: docs/superpowers/specs/2026-11-26-review-dashboard-design.md calls for this inline launcher and its three files (.json, .log, .exit). They let a round outlive the terminal without a daemon. All 40 changed files are under dash/; the CLI still decides whether to run and what to post.

Alternatives: Keep the launcher and file format. (1) Give a jobs worker ownership of Store and the child handles, reporting changes through the existing event channel. That adds messages but keeps disk latency off the UI thread. (2) Let restored jobs show logs and completion, but enable K only for a child the dashboard still owns. That costs stop-after-restart; a way to verify the original wrapper’s identity would justify restoring it.

Questions for the author: Is r an explicit exception to the design’s “confirm dialog that shows the exact text”? The same design says r runs and posts after confirmation. This PR implements the latter: the user sees the command, not the review it will post.

Missing context: No PR discussion resolves that confirmation rule.

Approach: Questionable

Strengths

  • dash/src/jobs_app.rs:372 builds the command shown in the dialog from the same argv used to launch the job. dash/src/launcher.rs:219 passes those arguments separately rather than interpolating them into shell code.
  • dash/src/jobs_app.rs:263 accounts for a status refresh that was already running when a round ended. The test at dash/tests/jobs.rs:162 verifies that the toast uses the new blocker count, not the one visible before the round.
  • dash/tests/contract.rs:331 compares state-directory resolution with the actual Bash implementation. I ran the full Rust suite with the contract required and the build directory outside the checkout: 127 tests passed.

Issues

🚨 Critical (Must Fix Before Merge)

  • dash/src/jobs_app.rs:593 — K can terminate an unrelated process group. Restored records have no owned child handle, but line 216 treats an existing numeric PID as a running job. If a wrapper died without writing .exit and its PID was reused as another process-group leader, confirming Stop sends TERM and then KILL to that unrelated group. Keep restored jobs observable, but refuse to signal them without verified process identity. For owned jobs, retain that ownership through signal delivery.

  • dash/src/cli.rs:125 — The account shown for an Enterprise round can differ from the account that posts it. CheckAnswer records the requested -u login as the effective account. Unlike show (lib/show.sh:102), the real review command calls use_gh_user "$GH_USER" without the PR host (gh-pr-review:226), which looks up the login on github.com. If the login exists there but a different account is active on the Enterprise host, the check can succeed, the dialog can say “As alice,” and the review can post as the other account. Make the review/check path select and preflight credentials for the target host, as show does, or refuse launches where identity cannot be established. Cover a non-active Enterprise login with the real CLI and stub gh.

⚠️ Important (Should Fix)

  • dash/src/cli.rs:341 — Quitting can abandon a confirmed stop before SIGKILL. The five-second escalation runs in a detached Rust thread. If the user confirms K, then quits during the grace period, the thread ends with the dashboard while a TERM-resistant job or descendant survives. stop_requested does not resume escalation on restart. Track pending stops and finish them before normal shutdown, without waiting for jobs the user chose to leave running.

  • dash/src/jobs_app.rs:238 — Two open dashboards can bypass both job limits. Each loads records once at startup and then admits jobs from its own in-memory list. With max_jobs: 1, two dashboards opened before either launch can run two different PRs simultaneously; on the same PR, both can accept the job rather than refusing the second. Serialize admission against the shared store, or allow only one dashboard per state directory to manage jobs. The CLI’s per-PR lock does not enforce the overall limit.

  • dash/src/launcher.rs:228 — A round can outlive the dashboard without a discoverable job record. The detached wrapper starts before the JSON is saved. If the dashboard exits between spawn and rename, the round can continue and post, but the next dashboard scans only .json files and cannot follow it or report its result. Gate execution on successful record publication; if the parent disappears before releasing the gate, the wrapper should exit without running the command. Reap the child on the save-error path as well.

  • dash/src/jobs_app.rs:525 — K removes a queued job without confirmation. This immediately drops the only copy of the queued request. The log-view path at line 576 does the same and leaves the user viewing a job that no longer exists. Use one ID-bound confirmation path for unqueueing; if the job starts while the dialog is open, do not reinterpret confirmation to unqueue as permission to kill it.

  • dash/src/ui/jobs.rs:253 — A round can be confirmed while its command and buttons are off-screen. The popup clamps its height, but the paragraph does not scroll, and the command and buttons come last. In a short terminal, or with a long diagnosis and CLI path, Enter still starts a normal round even though the user cannot inspect the command. Keep the buttons visible and make the entire confirmation text accessible before accepting Start.

  • dash/src/jobs_app.rs:331 — Restored completions can be marked notified without ever showing their toast. For example, if four previews finish while the dashboard is closed, startup pushes all four toasts before the first draw. The fourth evicts the first, but all four records have notified: true. Queue excess notifications rather than dropping them, and acknowledge them when presented.

  • dash/src/jobs.rs:231 — A completion toast can attribute somebody else’s round to the job. If the detached job posts round 3 and someone posts round 4 before the dashboard restarts, rounds.last() makes the toast say that this job posted round 4, with round 4’s blocker counts. Match the job to its posted round before reporting numbers; use the existing generic “Round posted” message when the match cannot be established.

💡 Minor (Nice to Have)

  • dash/src/ui/jobs.rs:176 — Long preview lines are unreadable beyond the right edge. The log renders without wrapping or horizontal scrolling, so an ordinary Markdown paragraph can be cut off with no key to reveal the rest. Add wrapping with visual-row scrolling, horizontal navigation, or a way to open the complete log in a pager.

  • dash/src/launcher.rs:146 — Clearing jobs reports success even when deletion fails. On a read-only filesystem, c forgets every finished job and says it cleared them, but they reappear on restart. A partial deletion can instead leave a log with no JSON record through which to retry cleanup. Return per-job deletion results, remove the record last, and report which jobs could not be cleared.

Recommendations

Add a lifecycle test with an actual dashboard process boundary. The current restart test drops an App inside the test process; it cannot detect a stop worker disappearing when the executable exits. Keep storage waits off the input loop when implementing the launch and cleanup fixes, particularly the synchronous sync_all in dash/src/launcher.rs:111.

Assessment

Ready to merge? No.

Reasoning: The normal single-dashboard path is well tested, but posting under the wrong account and signaling an unrelated process group are merge blockers. The shutdown and persistence gaps also undermine the promise that confirmed jobs remain trackable and controllable across sessions.


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

…while it ran, else no numbers

rounds.last() could be another reviewer's round, posted after the job's and before the status was read: the toast then gave that round's number and blocking counts as the job's. The round whose posting time falls in the job's run (start to end, a minute of clock skew) is the job's; none or several: "Round posted · #N". The CLI's "Posted →" line names the PR, not the review, so the time is what tells.
…; r says it posts what it writes

The loop check's answer took the -u login asked for as the account, though a login gh does not store makes the check (and the job) run without -u, as whatever account gh uses on the PR's host. The answer now names who the job runs as and where: the -u login (which the CLI looks up on the PR's host, issue #29), or the account gh uses there without one, asked of gh (gh api user --hostname <host>, in the job's environment; the gh that runs the extension). When gh can't say, the check fails and nothing starts. The record keeps that login.

The r dialog says the round posts the review it writes, and that p previews it without posting: the review does not exist before the round runs.
… UI thread does no I/O for jobs

Starting a job, saving its record, reaping it, reading its exit file and its log, signalling it: all of it ran on the UI thread's 200 ms tick, so a slow or stalled jobs folder stalled the keys and the drawing. A worker thread (jobs_worker.rs) now owns the Store and the child handles, as D1's workers own the CLI calls: the app sends it commands (enqueue, unqueue, stop, notified, clear, watch a log, shutdown) and keeps what it reports on the event channel (the jobs after each change, their ends, the open log, admissions, warnings). The stop's SIGTERM-then-SIGKILL runs in the worker without blocking it. Job IDs number the jobs of the process, so that two dashboards in one process don't collide.

The behaviour is the same otherwise; the review's other findings follow.
… wrapper

A restored record whose wrapper died without an exit file, and whose PID another process-group leader took since, showed as running, and K sent SIGTERM then SIGKILL to that unrelated group. The record now keeps the wrapper's process identity, read at launch: its PID, its group (the same number: it leads its session) and its start time (ps -o pgid= -o lstart=, in UTC and the C locale; macOS and Linux). Before any signal (TERM or KILL, a job started here or found at start) the leader is verified to be that process; else K refuses ("can't verify this job's process; not stopping it"), and a job whose PID is gone or taken is lost. A job's liveness is the same check (a found job's, at most once a second). A job started here keeps its child unreaped while its stop is under way, so that its PID can't be reused before SIGKILL; SIGKILL follows once the wrapper has recorded the end, or after 5 s.
… waits at a gate

The wrapper started the command at once, and the record was saved after: a dashboard that exited in between left a round running (and posting) that no later dashboard could find. The wrapper's stdin is now a pipe from the dashboard, and the wrapper reads "go" from it before it runs anything (the command's stdin is /dev/null). The dashboard reads the wrapper's identity, saves the record, then writes "go". A dashboard that dies before that, or can't save the record, closes the pipe unopened: the wrapper exits (125, no exit file) without running the command, and removes its log when no record names it. On the save-error path the wrapper is reaped.
The SIGTERM-to-SIGKILL escalation of K ran in a detached thread: quitting during the grace period ended it with the dashboard, and a job (or a child) that ignores SIGTERM kept running; a record with stop_requested was not acted on later. The jobs worker now tracks the stops under way. A quit (and an app dropped without one) finishes them, SIGKILL included, in at most 5 s in all, before the process exits; jobs the user leaves running are not waited for. The quit dialog says so, and the terminal says it is stopping them. At start, a record that asks for a stop, whose process is verified to be its wrapper still and has no exit file, gets SIGTERM again and SIGKILL after the grace.
… one-job-per-PR rule

Each dashboard admitted jobs from its own list, read once at start: two dashboards could run more than max_jobs jobs, and both could run a job on the same PR. Admission now takes the jobs folder's lock (flock(2) on <state>/jobs/.lock, declared in sys.rs like kill and setsid; released if the process dies), reads the records under it, counts the running jobs (this dashboard's as it knows them, the others' verified by their process identity), refuses a queued job whose PR has a job running from another dashboard, and starts queued jobs while fewer than the limit run. Queued jobs try again at most once a second.
… that started meanwhile

K on a queued job dropped it at once, the only copy of the request, and the log view of it stayed open on a job that no longer existed. Stop and unqueue now share one dialog, bound to the job's ID and to what it was when asked (Remove for a queued job, Stop for a running one). Confirming the removal of a job that started while the dialog was open does not stop it: the dialog asks again, to stop it, Cancel selected. The worker checks again when it takes the command: a job that is no longer queued is not removed. A log whose job goes from the list closes, with a message ("Took the job of #2 off the queue: its log closed").
…s toast is on screen

At most three toasts show; a fourth evicted the first, though every one's record was marked notified: four jobs that ended while no dashboard ran showed three toasts, and the next start showed none of the fourth. Toasts now queue: one shows when there is room (a toast on screen goes after 8 s), with its bell or desktop notification then, and its job's record is marked notified at that moment, not before.
A preview's Markdown paragraph ran past the right edge with no way to read the rest. The log view now wraps each line to the screen's width (by display width, characters whole) and scrolls by those rows: j/k, ctrl+d/u, gg, G and F work on rows, and follow mode keeps the last row in view.
…t has been on screen

The popup was clamped to the screen, the text did not scroll, and the command and the buttons came last: in a short terminal, or with a long diagnosis, Enter started a round whose command the user could not see. The buttons now take the dialog's last row and a line above them says when there is more; the text above scrolls (j/k, the arrows, space, page keys, G). Start and Run anyway are taken only once every row of the text has been on screen (drawn: an answer and a key in one batch of events is not seen); else the dialog stays and says to scroll.
… last

Clearing ignored every deletion error: on a read-only folder it forgot the finished jobs and said it cleared them, and they came back on the next start; a partial deletion could leave a log with no record to clear it from. Store::remove now deletes the exit and log files first and the record last, stopping at the first error (a file already gone is none), and says how it went. The worker keeps the jobs it could not clear listed, and the message names them with the error ("Cleared 0 finished jobs; could not clear the preview of #2 (Permission denied …)").
…er, the gate, process identity, the folder's lock, stops on quit, toasts in turn
@catalan-adobe

Copy link
Copy Markdown
Owner Author

Thanks for round 1. Both critical findings, the approach points and all the other findings are fixed in 13 commits (450dea8…915aaf1). main is merged in, including #32, which the account fix depends on. Each new test failed on its parent commit; where a test needs new API, a version that compiles against the parent was run there.

Approach

  • Job I/O on the UI thread: fixed in 2c75d7f. A jobs worker owns the jobs folder, the child handles, the exit-file polling, launching, saving, reading logs and stopping. It reports through the existing event channel, so the UI thread does no file or process work for jobs. Test: with a jobs folder that blocks, the parent's enable_jobs hung for 5 s; now keys and drawing go on.
  • r's confirmation: fixed in d6f2331. The design's "exact text" confirmation is for shepherd drafts (D3). A round's review doesn't exist before it runs, and p (--no-post) shows it first. The dialog says "Posts the review it writes; p previews it without posting", and so does dash/README.md.

Critical

  • jobs_app.rs:593 (K on a reused PID): fixed in c72fa10. At launch the job records its wrapper's PID, process group and start time. Before any signal, owned or restored, the dashboard checks the group leader is still that process. Otherwise it refuses, or marks the job lost when the PID is gone. Test: on the parent, K sent SIGTERM to an unrelated group leader that had reused the PID; now it is left alone. A restored job whose identity matches is still stopped.
  • cli.rs:125 (the account shown vs the account that posts): fixed in d6f2331, together with -u is a login of the PR URL's host for the review run, --check and gc (fixes #29) #32 (now merged), which makes the review run and --check look -u up on the PR URL's host.
    • The check's answer carries the login and the host.
    • When the check falls back to running without -u, one gh api user --hostname <host> names the account; if that fails, nothing starts.
    • The dialog reads "As X on host". Test with the fake CLI on a GHE PR: the account in the dialog is the one the job posts as.

Important

  • cli.rs:341 (stops on quit): fixed in db78394. A quit finishes the stops under way, TERM then KILL within 5 s in total; jobs left running aren't waited for. At the next start, a record with stop_requested whose process checks out resumes its escalation.
  • jobs_app.rs:238 (two dashboards): fixed in 0c700d1. A job is admitted under a lock in the jobs folder, after reading the records again, so dash.max_jobs and one-job-per-PR hold across dashboards. Test: two apps on one folder with max_jobs: 1; on the parent the second started its job.
  • launcher.rs:228 (record before run): fixed in 6d7b334. The wrapper waits at a gate and runs the command only once its record is saved. If the dashboard dies first, the command never runs, and the child is reaped when saving fails. On the parent, the command ran without a record.
  • jobs_app.rs:525 (unqueue without asking): fixed in cd9826c. One dialog, bound to the job's ID, for Remove and Stop. If the job started while the dialog was open, it asks again to stop it, with Cancel selected. A removed job's log closes with a message.
  • ui/jobs.rs:253 (dialog content off-screen): fixed in 53d55b0. The buttons always show and the text above scrolls. Start is accepted only once the whole text has been on screen. There is a snapshot at 80×24 with a long diagnosis.
  • jobs_app.rs:331 (toasts on restore): fixed in c575a75. Toasts wait their turn, and a job's end is marked shown when its toast is on screen. On the parent, four restored completions were all marked while only three toasts showed.
  • jobs.rs:231 (which round the job posted): fixed in 450dea8. The toast's numbers come from the one round posted while the job ran, from its start to its end plus 60 s; otherwise it says only "Round posted · #N". The CLI's "Posted →" line has the PR's URL, not the review's id, so it can't be used.

Minor

  • ui/jobs.rs:176 (long log lines): fixed in b5d38b0. Lines wrap, and the log scrolls by screen rows.
  • launcher.rs:146 (clear reports failures): fixed in 2be7841. c deletes a job's record last and names the jobs it couldn't clear. On the parent, in a read-only folder, it said "Cleared 1 finished job".

Checks: on 915aaf1, CI was green: 89 unit, 5 contract, 17 jobs, 36 render, 1 sequence and 1 stop-all tests, and the shell suite. I'm re-running it on af53662, which adds #31 and #32 from main.

@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

5 fixed · 6 still open · 9 new (9 in the new commits) · open blocking: 13 (was 9) · loop: early

Approach

Unchanged since round 1: dash/src/jobs_worker.rs takes job I/O off the UI thread, but for restored jobs dash/src/launcher.rs checks the wrapper with ps and then signals a numeric process group that can be reassigned between those calls.

Approach: Questionable

Strengths

  • The launch gate at dash/src/launcher.rs:331 fixes the untracked-posting window: the wrapper cannot run the CLI until its JSON record has been published. The process-boundary test at dash/src/launcher.rs:654 verifies that losing the dashboard before that point runs nothing.
  • Queue removal is now bound to both the job ID and the action the user confirmed. dash/tests/jobs.rs:744 verifies that confirming “Remove” does not kill a job that started while the dialog was open.
  • I ran the Rust suite in a temporary copy with the CLI contract required: 149 tests passed. I also exercised the event-ordering and two-dashboard cases called out below. The review checkout remained unchanged.

Issues

🚨 Critical (Must Fix Before Merge)

  • F1 · dash/src/launcher.rs:407 — A restored job can still signal an unrelated process group. The new start-time check rejects a PID that was already reused when ps ran. It does not hold the process identity across the subsequent kill(-pgid, …). If the original group exits and its number is reassigned between those calls, TERM or KILL goes to the replacement. Keep restored jobs observable, but refuse K unless the signal can be delivered through an identity held across delivery; an owned, unreaped child provides that guarantee for locally launched jobs.

  • dash/src/cli.rs:139 — The fallback login shown at confirmation is not bound to the job. This is separate from F2’s stored-login host lookup, which is fixed. After a successful check without -u, the dashboard reads the active login, but dash/src/jobs_app.rs:492 still builds a command without -u. I confirmed with the fake CLI that a dialog naming Alice produced a job that posted as Bob after the active login changed. A queued round makes that interval potentially minutes long. Bind the verified identity to the actual invocation, or have the CLI refuse to post if its effective login differs from the confirmed one. Do not persist a token in the job record.

⚠️ Important (Should Fix)

  • F3 · dash/src/jobs_worker.rs:450 — A contended admission lock can still interrupt a confirmed stop on quit. The worker now owns escalation, but that same worker blocks in flock while retrying a queued job. With a TERM-resistant job, a queued job, and the folder lock held by another manager, I observed shutdown_jobs() time out with the stopped job still alive. dash/src/main.rs:131 warns and proceeds to exit. Make admission retry without blocking stop deadlines or shutdown processing.

  • F4 · dash/src/jobs_worker.rs:466 — Two dashboards can still accept queued jobs for the same PR. The lock protects the count of running records, but the clash check cannot see another dashboard’s in-memory queue. With max_jobs = 1 and PR #1 running, I confirmed that both dashboards accepted a preview of PR #2. If the first preview finishes between the second dashboard’s polls, both run. Reserve the PR across managers for the entire queued-or-running interval, or give one manager exclusive admission authority per state folder.

  • F7 · dash/src/jobs_app.rs:537 — Scrolling can authorize Start before the command is drawn. The buttons are now visible, but the key handler sets seen_all when the requested offset reaches the bottom. I confirmed that G followed by Enter in one event batch launched a round while the last rendered frame still showed only the diagnosis. Update visibility from completed frames, not key events; track the rendered rows if the guarantee is that all text has appeared.

  • F8 · dash/src/jobs_app.rs:432 — A completion is still acknowledged before its toast is displayed. The FIFO fixes eviction of the fourth toast. However, moving a toast into the visible list immediately sends Notified. I confirmed that handling a restored completion and then q before the next draw persisted notified: true without drawing the toast once. Acknowledge after a successful frame that actually contains the notification; until then it must remain eligible on restart.

  • F9 · dash/src/jobs.rs:252 — A timestamp match can still attribute another reviewer’s round to the job. The window is better than rounds.last(), but it extends a minute beyond job exit and supplies no identity. For example, if the job’s review loses its generated marker before restart, a colleague’s round posted 30 seconds after exit is now the sole match. Even when the right round is matched, line 283 appends the current PR label, which can belong to a later round. Match against evidence from the CLI’s posted result, use the matched round’s label, and keep the generic toast when there is no reliable match.

  • dash/src/jobs_worker.rs:341 — A restored stop can leave a TERM-resistant descendant running. If the foreground command dies on TERM, the wrapper writes .exit and exits. Once the wrapper is reaped, this branch drops the pending stop without sending KILL, even if a background member of the group ignored TERM. The job is reported as stopped. Have a supervisor that retains ownership finish the group stop, or refuse a restored stop that cannot be completed safely; do not fix this by signaling an unverified PGID.

  • dash/src/jobs_worker.rs:296 — A normally completed wrapper can remain a zombie for the dashboard’s lifetime. If try_wait() sees a live child and the wrapper publishes .exit before the file read, the worker marks the job finished. Subsequent polls visit only Running jobs, so nobody waits on that child again, even after c. Sweep owned children independently of display state, retaining only the intentional pending-stop exception.

  • dash/src/jobs_worker.rs:383 — A stale notification can recreate a job another dashboard cleared. Notified rewrites the entire cached record without checking that it still exists. I confirmed that dashboard A could clear all three files and dashboard B’s delayed acknowledgement would then recreate just the JSON. The next restart sees a lost job instead of a cleared one. Serialize clear and record updates, reread under the lock, and update only the intended field of an existing record.

  • dash/src/jobs_app.rs:609 — Quitting during admission skips the running-jobs confirmation. quit() counts published running and queued jobs, but not admitting. I confirmed that Enter followed by q while admission waited on the folder lock exited without a dialog; the worker then launched the job before processing shutdown. Include pending admissions in the quit decision and tell the user whether they will start or be cancelled.

  • dash/src/jobs_worker.rs:193 — Failure to open the jobs folder leaves confirmed requests permanently “starting.” On this path the worker warns once, then discards every command except Shutdown. The UI still enables r and p. With an unusable state path, I confirmed that a launch produced no job and a retry reported that the PR already had a round starting. Send an explicit unavailable state that disables launch, or answer every Enqueue with a refusal that clears admitting.

  • dash/src/jobs_app.rs:354 — A restored round can wait for a status reply that already arrived. Asynchronous restoration can finish after the initial fresh status. refresh_after() then returns refresh_done, but the job is appended to awaiting, which only drains on a subsequent status reply. I confirmed that the finished round remained silent until a manual refresh. If a successful completed epoch already covers the round, use its status immediately; otherwise wait for an outstanding or newly requested refresh.

💡 Minor (Nice to Have)

  • dash/src/launcher.rs:171 — Partial cleanup can erase a finished job’s outcome. The deletion error is now reported correctly, but .exit is deleted before .log. If log deletion fails, the retained JSON restores as “lost” rather than “done.” Preserve the outcome until the other fallible cleanup has succeeded, or record that cleanup is pending.
  • dash/src/ui/jobs.rs:167 — Every redraw rewraps and allocates the entire log tail. An unchanged log can be up to 512 KiB, yet a tick or keypress rebuilds every visual row to display a few of them. Cache wrapping by log revision and viewport width.
Fixed since the last round (4)
  • F2 — The real CLI now selects stored -u credentials on the PR URL’s host at gh-pr-review:229; tests/flow.sh:532 covers posting with the non-active Enterprise login.
  • F5 — dash/src/launcher.rs:331 saves the record before opening the execution gate and aborts the wrapper on save failure.
  • F6 — dash/src/jobs_app.rs:595 treats unqueue and stop as separate confirmations, including when the job starts while the dialog is open.
  • F10 — dash/src/ui/jobs.rs:167 wraps long preview lines, and scrolling now uses visual rows.
Fixed finding with a distinct follow-up (1)
  • F11 — dash/src/jobs_worker.rs:556 retains jobs whose deletion failed and reports the per-job error; the JSON is removed last. Loss of the exit status during partial cleanup is the separate Minor item above.

Recommendations

Keep the new process-boundary tests. Add deterministic cases for three boundaries the current suite mostly exercises separately: input before the next draw, two managers mutating one job record, and stop escalation while admission is blocked. These expose failures that passing single-dashboard lifecycle tests do not.

Assessment

Ready to merge? No.

Reasoning: The launch gate and queued-job confirmation are solid fixes, but the dashboard can still signal the wrong process group or post under a different login than the user confirmed. The reproduced admission, shutdown, and notification races also break the promised behavior across sessions.


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

A job found at start (another dashboard session started it) is followed, never
signalled: a ps check can't hold the process across the kill that follows it, so
its group's number could name another group by then. K refuses it and names its
process group, to stop it by hand. Signals go through the wrapper's child, kept
unreaped (launcher::Owned): while it is, the PID and so the group's number can't
be reused. A stop a restored record asks for is no longer resumed.
When gh stores no login for the PR's account on its host, the check no longer
falls back to running without -u and naming the active account (gh api user):
the job would post as whichever account gh uses when it runs, possibly another
one by then. The dialog says why, with only Close, and nothing starts. Every job
carries -u <login>, the login the dialog names.
@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. Both are fixed by removing code rather than adding it. The 11 important and 2 minor findings are in #35, for D2b or a follow-up.

Critical

  • F1, launcher.rs:407 (a restored job can still signal an unrelated group): fixed in 249cc2c.
    • K now stops only a job this dashboard started. Its unreaped wrapper is held in launcher::Owned, the only way to send kill(-pgid). While the wrapper is unreaped, its PID can't be reused, so the group number can't move to another process.
    • A restored job stays observable (log, state, toast), but K refuses it with "This job was started by another dashboard session (PID N, process group N); stop it with kill -TERM -N if it's still yours".
    • Removed: resuming a stop at start, and every signal to a job this dashboard doesn't own. The identity check now only marks restored jobs lost.
    • Tests, which failed on af53662: a verified restored job is refused and left alone, and a stop found at start sends nothing. Control: an owned job's whole group is stopped.
  • cli.rs:139 and jobs_app.rs:492 (the fallback login not bound to the job): fixed in 6232d44.
    • The check always runs with -u <login>. If gh has no stored login for it, the dialog says "no stored gh login for on : the round could post as another account; run gh auth login --hostname ", shows only [Close], and no job starts.
    • A job's -u is the login the dialog shows, and no token is stored anywhere.
    • Removed: the gh api user fallback lookup.
    • Tests: the fallback case starts no job and makes no posting call (it failed on af53662). Control: with a stored login, the job runs with -u gm and posts as gm.

Checks on 6232d44:

  • dash/: fmt and clippy are clean. cargo test --locked, with the contract test required, passes 149 tests on macOS and on Linux (rust:1.88).
  • Lint: clean.
  • CI: green: lint, the shell suite (2331 ok, 3 skip, 0 FAIL) and dash (149 tests).

@catalan-adobe
catalan-adobe merged commit c8e7d1b 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