Public: anyone can read this; the crew can change it.

The runners page is live: connected, busy, the run it holds, its log and last seen, updated as they change #18497

opened this

Merged 1h 47m ago, live in production

The runners page now updates in place, but I only tested it here, not on the preview. The tests I ran pass: the new test/runners-live.test.ts, settings-runners, tui-runners, the four checks you named, and the attention budget.

Notes

opened this

The runners page now updates in place, but I only tested it here, not on the preview. The tests I ran pass: the new test/runners-live.test.ts, settings-runners, tui-runners, the four checks you named, and the attention budget. tsc, design-lint and the gate are clean apart from two "similar function" notes on runnersLive and my test's rowOf.

What changed

  • Rows: each runner row shows Connected, Quiet or Never asked, plus Busy or Idle and "Last seen". When it holds a claimed job, it names that run as a link to the run page. It says "a run" with no link when the viewer may not read that run. The facts come from the protocol's heartbeat state and the claimed check_job rows, read in a new src/machines/live_runners.ts.
  • Live updates: the rows are a live region at GET /settings/runners/live. A heartbeat after silence or with a changed state, a claim, and a job's end or lapse each emit a small admin-only event (runner.seen, runner.claimed, runner.released) through src/machines/runner_signal.ts. A runner that just keeps asking emits nothing. /events now carries runner.* events to admins, and the page looks again when the first connected runner would fall quiet.
  • Shared script: I changed liveRegionsJs so a swapped region re-arms its data-live-at timer. This affects other pages that use that attribute.
  • Open row: a row that holds a readable run opens to the last 30 log lines, drawn on the server. New lines arrive over /events as forge:run-log frames and are added as text, never markup, by src/web/runner_tail.ts. The box is a fixed-height window, so nothing moves. Open rows and scroll stay put across swaps.
  • Empty page: it says what a runner is and how to add one: register below, or POST /api/v1/admin/runners.
  • Access: only the forge admin sees any of it. A non-admin gets the plain 404 and no word of any machine. The log is read only if mayReadLogOfRun allows it.
  • Terminal and docs: the terminal Runners screen now says busy or idle and the run held. I also updated docs/features/settings-runners.md.
  • Reused: list and runnerState, getRepoRun and mayReadLogOfRun, readRunLogTail, logBox and logLineJs (now exported), the row fold and fragment.

What I chose not to do

  • No new server-sent stream. I reused the page's one /events connection, so there is no new same-origin surface.
  • I did not add lending.* to the /events repo-less allowlist, though the lending region looks like it needs it.
  • The log is drawn only for the first held run of a runner that holds several. The row shows "and N more".
  • I did not write a test that the SSE stream itself carries runner.seen. The tests check that the event is appended and the fragment re-renders.

How to try it

  1. As an admin, open /settings/runners on the preview.
  2. Send POST /api/v1/runner/heartbeat with a runner token and {"state":"busy"}.
  3. The row flips to Connected and Busy with no reload.
  4. When the runner claims a job, the row links the run and opens to its log.

🤖 Generated with Claude Code

[
  {"go": "/settings/runners", "look": "A runner that has never asked", "expect": "Never asked and Idle badges, 'Has not asked for work', no fold"},
  {"go": "/settings/runners", "look": "After a heartbeat from a runner token (POST /api/v1/runner/heartbeat {\"state\":\"idle\"})", "expect": "The row flips to Connected and Idle with no reload, showing Last seen"},
  {"go": "/settings/runners", "look": "A runner that claimed a job", "expect": "The row says Busy and 'holds run <id> of owner/repo' with a link; opening it shows the run's log, new lines arriving without the box moving", "ask": "Does the open row keep its place when another runner changes?"},
  {"go": "/settings/runners", "look": "With no runner enrolled", "expect": "The page says what a runner is and how to add one (Register below, or POST /api/v1/admin/runners)"}
]

Closes #18458

2 earlier comments · 1 event
commented

The runners page now updates in place, but I only tested it here, not on the preview. The tests I ran pass: the new test/runners-live.test.ts, settings-runners, tui-runners, the four checks you named, and the attention budget. tsc, design-lint and the gate are clean apart from two "similar function" notes on runnersLive and my test's rowOf.

What changed

  • Rows: each runner row shows Connected, Quiet or Never asked, plus Busy or Idle and "Last seen". When it holds a claimed job, it names that run as a link to the run page. It says "a run" with no link when the viewer may not read that run. The facts come from the protocol's heartbeat state and the claimed check_job rows, read in a new src/machines/live_runners.ts.
  • Live updates: the rows are a live region at GET /settings/runners/live. A heartbeat after silence or with a changed state, a claim, and a job's end or lapse each emit a small admin-only event (runner.seen, runner.claimed, runner.released) through src/machines/runner_signal.ts. A runner that just keeps asking emits nothing. /events now carries runner.* events to admins, and the page looks again when the first connected runner would fall quiet.
  • Shared script: I changed liveRegionsJs so a swapped region re-arms its data-live-at timer. This affects other pages that use that attribute.
  • Open row: a row that holds a readable run opens to the last 30 log lines, drawn on the server. New lines arrive over /events as forge:run-log frames and are added as text, never markup, by src/web/runner_tail.ts. The box is a fixed-height window, so nothing moves. Open rows and scroll stay put across swaps.
  • Empty page: it says what a runner is and how to add one: register below, or POST /api/v1/admin/runners.
  • Access: only the forge admin sees any of it. A non-admin gets the plain 404 and no word of any machine. The log is read only if mayReadLogOfRun allows it.
  • Terminal and docs: the terminal Runners screen now says busy or idle and the run held. I also updated docs/features/settings-runners.md.
  • Reused: list and runnerState, getRepoRun and mayReadLogOfRun, readRunLogTail, logBox and logLineJs (now exported), the row fold and fragment.

What I chose not to do

  • No new server-sent stream. I reused the page's one /events connection, so there is no new same-origin surface.
  • I did not add lending.* to the /events repo-less allowlist, though the lending region looks like it needs it.
  • The log is drawn only for the first held run of a runner that holds several. The row shows "and N more".
  • I did not write a test that the SSE stream itself carries runner.seen. The tests check that the event is appended and the fragment re-renders.

How to try it

  1. As an admin, open /settings/runners on the preview.
  2. Send POST /api/v1/runner/heartbeat with a runner token and {"state":"busy"}.
  3. The row flips to Connected and Busy with no reload.
  4. When the runner claims a job, the row links the run and opens to its log.

🤖 Generated with Claude Code

[
  {"go": "/settings/runners", "look": "A runner that has never asked", "expect": "Never asked and Idle badges, 'Has not asked for work', no fold"},
  {"go": "/settings/runners", "look": "After a heartbeat from a runner token (POST /api/v1/runner/heartbeat {\"state\":\"idle\"})", "expect": "The row flips to Connected and Idle with no reload, showing Last seen"},
  {"go": "/settings/runners", "look": "A runner that claimed a job", "expect": "The row says Busy and 'holds run <id> of owner/repo' with a link; opening it shows the run's log, new lines arriving without the box moving", "ask": "Does the open row keep its place when another runner changes?"},
  {"go": "/settings/runners", "look": "With no runner enrolled", "expect": "The page says what a runner is and how to add one (Register below, or POST /api/v1/admin/runners)"}
]
commented

The three failing tests now pass locally, and I pushed the fix. I didn't see the forge's check on the new push.

The causes were all mine:

  • Own script: src/web/pages/runners.ts set its own script without composing behaviorsJs. It now does.
  • Empty-state link: I had given the empty state a #register link, and the rule only allows links to places that exist unscoped. I removed the link. The text still says what a runner is and how to add one.
  • Audit entry: the new /settings/runners/live route had no entry in docs/design/audit.md. I added one.

I ran the three failing tests plus runners-live, settings-runners, attention, empty-states, unused-exports and dup-imports, and all pass. tsc is clean. The full suite was not run.

Everything else in the pull is as described before. The earlier review block still applies.

🤖 Generated with Claude Code

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

I merged main into the branch and pushed. The four listed tests now pass locally, but I never reproduced the failures before the merge. They were probably from the branch being behind main, and the merge was the only change.

The merge brought in other people's changes to main. None of my own code changed. I did not open the pull, and the forge's full check will run on the push.

What I ran after the merge:

  • Tests: test/dup-imports.test.ts, test/unused-exports.test.ts, test/pages-budget.test.ts, test/attention-stamped.test.ts and test/runners-live.test.ts all pass (23 tests).
  • Type check and lint: bun x tsc --noEmit and bun scripts/design-lint.ts are clean.
  • Gate: gate.ts --fix changed no files. It reports four files with comment lines over 100 columns and says the nightly rewrap handles them on main. It also asks, as a question, whether runnersLive and lendingLive in src/web/pages/runners.ts are one implementation, and likewise rowOf in test/runners-live.test.ts and section in test/app-settings-page.test.ts. I left those alone.

What the pull does: the runners page is live. Each runner shows as connected, busy or idle, with the run it holds, its log as it arrives, and when it was last seen. The log and status update over the live route (src/machines/live_runners.ts, src/web/runner_tail.ts).

What I chose not to do: I did not merge the near-duplicate helpers the gate named.

How to try it: open /settings/runners on the preview, https://lab--18497--forge-trevato-apps.open-platform.sh. Start a run on a runner and watch its row and log change without a reload.

[
  {"go": "/settings/runners", "look": "Each runner row shows connected, busy or idle, the run it holds and its last-seen time", "expect": "Rows update without a reload as runners claim and finish runs"},
  {"go": "/settings/runners", "look": "A busy runner's log tail", "expect": "New log lines appear as they arrive, with no layout shift"}
]

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs