fix(webui): triage follow-ups, the Stop hook waits for the transcript, the workflows read drops system-only templates, first-render focus leaves an open drawer alone (#1873) #1986

Merged
jason.woltje merged 4 commits from triage-followups into refactor 2026-11-16 22:33:46 +00:00
Owner

What changes

Three small fixes left over from the Triage lanes.

  • Unslop Stop hook. Claude Code can run the Stop hook before it writes the turn to the transcript. The hook then read the last turn's reply and logged it again, so a clean turn could carry a false "1 reply flagged" note. The hook now reads the transcript again every 25 ms, for up to 2 s, until its last reply matches last_assistant_message. If it never matches, the hook checks last_assistant_message alone and logs late: true. This is the cause of the red claude-session.test.mjs "row 66" test noted in #1985.
  • Workflows read. The server drops system-only templates from the workflows read, so it no longer lists triage. It uses the organization vocabulary's existing system-only list. The client filter stays.
  • First-render focus. The page no longer moves focus to the heading when the first render ends if focus is already inside an open drawer, dialog or the narrow-screen menu. Before, a drawer opened early lost focus and Esc did not close it.

How

  • tools/unslop-hook/claude-hook.js, its README and test-unslop-check.js.
  • packages/webui/src/cli.mjs, packs-http.mjs, public/bus.js, public/workflows.js (comment only).
  • No schema, vocabulary, policy or HTTP route change. cli.mjs keeps route: null.

Tests

  • Each fix red before its change: two hook tests (a transcript written 300 ms late, one that never catches up), one packs-http test, one Triage drawer test and one agent drawer test.
  • Lane gate on b39d5e2ff: 227 files (webui 197, harness 30), 2014 pass, 0 fail, 4 skipped (org-quick-live).
  • Lead check on b39d5e2ff in a clean environment: 11 files (both harness session files, the five Triage files, packs-http, agent drawer, workflows, unified workspace), 188 pass, 0 fail. claude-session.test.mjs row 66 passes. tools/unslop-hook/test-unslop-check.js 30/30.

Review

One fresh claude-opus-5-5 reviewer: approve, no P1 or P2, three P3s, all handled in the last commit. That last commit was not read by a second reviewer.

Left for later

  • Two stale cases remain in the Stop hook: an input with no last_assistant_message, and a reply whose text equals the last turn's last reply. Either can log the last turn's replies again. A full fix records the last prompt the hook checked.
  • A Stop hook can now wait up to 2 s when the transcript lags. When it gives up, earlier replies of that turn go unchecked.
  • The cli.mjs supplier filter has no test of its own; the packs-http handler filter is the tested one.
## What changes Three small fixes left over from the Triage lanes. - **Unslop Stop hook.** Claude Code can run the Stop hook before it writes the turn to the transcript. The hook then read the last turn's reply and logged it again, so a clean turn could carry a false "1 reply flagged" note. The hook now reads the transcript again every 25 ms, for up to 2 s, until its last reply matches `last_assistant_message`. If it never matches, the hook checks `last_assistant_message` alone and logs `late: true`. This is the cause of the red `claude-session.test.mjs` "row 66" test noted in #1985. - **Workflows read.** The server drops system-only templates from the workflows read, so it no longer lists `triage`. It uses the organization vocabulary's existing system-only list. The client filter stays. - **First-render focus.** The page no longer moves focus to the heading when the first render ends if focus is already inside an open drawer, dialog or the narrow-screen menu. Before, a drawer opened early lost focus and Esc did not close it. ## How - `tools/unslop-hook/claude-hook.js`, its README and `test-unslop-check.js`. - `packages/webui/src/cli.mjs`, `packs-http.mjs`, `public/bus.js`, `public/workflows.js` (comment only). - No schema, vocabulary, policy or HTTP route change. `cli.mjs` keeps `route: null`. ## Tests - Each fix red before its change: two hook tests (a transcript written 300 ms late, one that never catches up), one `packs-http` test, one Triage drawer test and one agent drawer test. - Lane gate on b39d5e2ff: 227 files (webui 197, harness 30), 2014 pass, 0 fail, 4 skipped (`org-quick-live`). - Lead check on b39d5e2ff in a clean environment: 11 files (both harness session files, the five Triage files, packs-http, agent drawer, workflows, unified workspace), 188 pass, 0 fail. `claude-session.test.mjs` row 66 passes. `tools/unslop-hook/test-unslop-check.js` 30/30. ## Review One fresh claude-opus-5-5 reviewer: approve, no P1 or P2, three P3s, all handled in the last commit. That last commit was not read by a second reviewer. ## Left for later - Two stale cases remain in the Stop hook: an input with no `last_assistant_message`, and a reply whose text equals the last turn's last reply. Either can log the last turn's replies again. A full fix records the last prompt the hook checked. - A Stop hook can now wait up to 2 s when the transcript lags. When it gives up, earlier replies of that turn go unchecked. - The `cli.mjs` supplier filter has no test of its own; the `packs-http` handler filter is the tested one.
jason.woltje added 4 commits 2026-11-16 22:33:42 +00:00
Claude Code 2.1.319, 2.1.322 and 2.1.325 can run the Stop hook before they
write the turn to the transcript. The hook then read the last turn's reply,
logged it a second time, and missed this turn's reply. That made
claude-session.test.mjs row 66 red in most runs.

The hook now reads the transcript again, for up to 2 s, until its last reply
matches last_assistant_message. If it never does, it checks
last_assistant_message alone with an empty entryId, never the last turn
again. (#1873, lane triage-followups)
The workflows read listed the triage template, which only the client hid.
The read handler now drops every template the organization vocabulary marks
system-only, and the Console's read supplier in cli.mjs drops them too. The
client filter stays. (#1873, lane triage-followups)
jason.woltje merged commit b39d5e2ff3 into refactor 2026-11-16 22:33:46 +00:00
Sign in to join this conversation.