8000 feat(heartbeat): every command that works before it prints says so by dominikwozniak · Pull Request #90 · dominikwozniak/dw-mc · GitHub
[go: up one dir, main page]

Skip to content

feat(heartbeat): every command that works before it prints says so - #90

Merged
dominikwozniak merged 6 commits into
mainfrom
refactor/78-progress-turn
Sep 18, 2026
Merged

dominikwozniak merged 6 commits into
mainfrom
refactor/78-progress-turn

Conversation

@dominikwozniak
Copy link
Copy Markdown
Owner

dw-mc status spends five seconds reaching GitHub before its first row, and shows a blank screen for every one of them. So does the picker, so does a sweep on its own, and so does every command that reads a pull request's guards live. A first clone of a large repository is minutes of the same nothing. A terminal that says nothing for five seconds is one I stop trusting, so each of these says what it is doing and how far it has got, on one line it wipes when the work is done.

What changes

  • src/adapters/heartbeat.ts — the line, the clock and the single-line rewrite. What it counts is the caller's: a review counts tools, a sweep counts pull requests, a command reading two guards counts nothing. It paints the moment the wording changes rather than at the next frame, because a sweep gets further than once per frame.
  • src/cli/sweep.ts — the pass reports how far it has got, and status, the picker and sweep turn one line over it. The two stages are told apart: nothing counts towards a total the searches have not answered yet.
  • src/cli/pr.ts — reading puts the live guard reads of merge, rebase, rerun, resolve, comments and fix under that line.
  • src/adapters/git.ts — a clone says whether it is arriving for the first time or being fetched, and a worktree says it is being cut. Cutting a worktree now talks to the screen, so it asks for a Terminal.
  • src/cli/cleanup.ts — the walk that weighs the disk says so, which matters most exactly when there is most to take back.
  • CONTEXT.md, ADR 0007 — Heartbeat joins the glossary under Screen, and the record now describes the line as every command's rather than a review's.

Test plan

  • pnpm check — pass, on main at fbf8721 after a clean rebase over feat(terms): the layer the glossary lives in #89
  • 695 tests, up from 690. No existing expectation needed editing: the scripted terminal keeps what is drawn only where a test asks for it, so a heartbeat is invisible to a test that asserts on what was printed.
  • src/adapters/heartbeat.test.ts — five cases, including work that counts nothing and work with no aside, which is what keeps a pipe byte-identical.
  • src/adapters/git.test.ts — a first clone says cloning, a warm one says only fetching.
  • by hand: dw-mc status and dw-mc comments AirHelp/ahplus-rails#7783 under a sized pty — the line counted 0 of 2 repositories through 7 of 7 pull requests, then wiped. Piped, both printed zero heartbeat bytes and zero escape sequences.

Risk

Nothing on disk and nothing on GitHub: this only draws. If the line is wrong it is wrong on a screen that wipes it a moment later, and where there is no width to draw in nothing is drawn at all.

Closes #78
Closes #79
Closes #80
Closes #81
Closes #82

🤖 Generated with Claude Code

dominikwozniak and others added 6 commits September 18, 2026 08:12
The one line that says work is still going was shaped for a review run and
nothing else: it held the count itself, and that count was tools and subagents.
A sweep counts pull requests, and a command reading two guards counts nothing,
so neither could reach for it.

The count moves out to whoever is counting. What stays is what only this module
can know: when the work started, how to rewrite one line in place, and what to
do where there is no screen to measure.

It is a Heartbeat in CONTEXT.md rather than a Turn, because a turn is already
one turn of an agent session here and one word cannot be both.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A sweep is the longest wait in a normal day and it said nothing while it ran.
`dw-mc status` sat on a blank screen for five seconds against two repositories,
and `dw-mc` and `dw-mc sweep` sat on the same silence, because all three start
with the same pass.

The pass now reports how far it has got and the three commands turn one
heartbeat over it. The two stages are told apart: how many pull requests there
are to read is what the searches answer, so nothing counts towards that total
until they come back.

The heartbeat paints the moment the wording changes rather than at the next
frame, which a sweep is fast enough to make visible: a pull request that lands
in less than a frame would otherwise show a count already out of date.

Nothing goes out as an aside, so a piped `dw-mc status` prints what it always
printed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Six commands read their guards live before they can print a word, and every one
of them spent that read on a blank screen. Reading live is the point - a guard
off the last sweep is a stale verdict on a write no reflog undoes - so the reads
stay and the silence goes.

There is nothing worth counting here. Two or three calls, and a number counting
to three says less than the words do, so the line is what is being read and how
long it has taken.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The longest silence in the tool is the one nobody measures, because it happens
once: a clone is made the first time and fetched on every run after that, and a
first clone of a large repository is minutes of nothing on the screen. Cutting
the worktree is its own wait, because it checks out a whole tree.

The stages are named apart. A `cloning` that sits there for two minutes is a
large repository arriving once, not a tool that has hung, and the line is the
only thing that can say which.

Cutting a worktree now talks to the screen, so it asks for one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Taking the inventory is a walk over every clone and every worktree, weighing
each one. The whole reason to run the command is that those directories have
grown large, so the blank screen got blanker the more there was to take back.

The line is gone before the blocks it was waiting for, so the prompt is never
asked beside it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dominikwozniak
dominikwozniak merged commit ebba848 into main Sep 18, 2026
1 check passed
@dominikwozniak
dominikwozniak deleted the refactor/78-progress-turn branch September 18, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant

0