Findings from a multi-agent review panel (23 confirmed after two-lens
adversarial verification), grouped by root cause:
Lifecycle identity
- Thread a monitor generation through monitor commands, events, and the
projected monitor state; reject updates/ends whose generation is not
the active one, and make every registry removal generation-conditional
so a delayed lifecycle event cannot delete a newer monitor
- Re-validate registration, projected monitor status, archive state,
generation, and claim at the wake send boundary (after the fresh fetch,
not before it)
Event loss
- Diff before the readiness exit: actionable activity now wins over
ending as ready, so a bot comment landing in the same poll as green CI
is never discarded
- Persist non-actionable cursor transitions so resolved→reopened is
still detectable
- Acknowledge the cursor only if the wake claim still exists, so a
user-turn release is not overwritten
Readiness
- Collapse reviews to each reviewer's latest opinionated review, so an
approval supersedes that reviewer's earlier changes-requested
- Re-include pre-monitor review threads once they are edited or reopened
Snapshot integrity
- Final terminal/head revalidation after pagination, with one bounded
refetch on head change
- Fetch the last 10 comments per review thread and track per-thread
updatedAt so edits to non-final comments are visible
- Reopened threads wake regardless of self-authorship
- Include the changes-requested review body in the wake prompt
Lifecycle events
- Archive atomically emits thread.monitor-ended before thread.archived,
mirroring settle
- Treat a queued-but-unadopted user turn as busy at the send boundary
- Boot reconciliation isolates per-thread failures (Bugbot)
UI
- Gate ready-state PR actions on the checkout PR matching the monitored
PR number
- Wake snoozed threads on monitor ready/needs-attention/session-ended
- Legacy sidebar renders the ready payoff and a needs-attention state;
session failure outranks Monitoring
- Reset merge confirmation when PR or monitor status changes
- endThreadMonitor honors a caller-provided endedAt
Co-Authored-By: Claude Fable 5 <[email protected]>
Threads can now formally monitor a PR after creating it. The agent calls a
new monitor_start MCP tool; a dedicated PullRequestMonitor service polls
GitHub every 30s, diffs review comments / reviews / check runs against a
per-thread cursor, and wakes the thread with a self-contained prompt when
there is something to address. The server — never the agent — declares the
PR ready from head-SHA-anchored GitHub state.
- GitHub monitor snapshot fetch (reviews, threads, check runs, mergeability)
with pure cursor-diff and readiness modules
- thread.monitor.start/update/end domain events through decider/projector,
monitor state on the thread shell, migration 034 (monitor_json)
- Wake dispatch protocol: claim → fresh terminal revalidation at the send
boundary → dispatch → cursor ack only after accepted start; user turns
always win and rewind in-flight wake cursors so events re-diff; 10-wake
circuit breaker ends as needs-attention
- Monitoring holds the thread unsettled; user settle ends the monitor;
session teardown ends it as session-ended
- UI: steady cyan Monitoring pill (never masks approval/input/failed),
blockers sub-line, header MonitorStrip with Stop, emerald Ready-to-merge
state with confirm dialog; clients can only end a monitor as "stopped"
Co-Authored-By: Claude Fable 5 <[email protected]>
- Replace attachment and favicon routes with signed asset URLs
- Harden workspace and attachment asset resolution
- Update browser preview components and shared contracts
Adds a desktop-only browser preview that lives in the right panel slot
alongside plan/diff. Lets the user point an Electron <webview> at any
URL — typed into a chrome-style URL bar, clicked from the empty-state
list of detected localhost dev servers, or auto-opened by a project
script with `previewUrl` set. Single-tab per thread.
Server (Effect/Layers):
- PreviewManager: per-(thread, tab) session metadata via SynchronizedRef
+ PubSub<PreviewEvent>; survives WS reconnect via `list`/replay.
- PreviewPortScanner: lsof on macOS/Linux, TCP probe fallback on
Windows; reference-counted polling so we only scan when subscribed.
- WS RPC + streams (`preview.open|navigate|refresh|close|list|reportStatus`,
`subscribePreviewEvents`, `subscribeDiscoveredLocalServers`).
Desktop:
- PreviewViewManager owns Chromium WebContents per tab, mediates
navigation/zoom/devtools/clear-storage. registerWebview gates by
webContents.getType() === "webview" and host-window match.
- IPC channels for create/close/register/navigate/back/forward/refresh/
zoom/hardReload/openDevTools/clearCookies/clearCache/getBrowserPartition.
- Forwards app-level shortcuts (mod+shift+J, mod+K, mod+,, mod+W) from
the webview back to the main window.
- Persisted browser session partition (cookies, cache).
Web:
- PreviewPanel/PreviewView/PreviewWebview render the surface; chrome row
with back/forward/refresh + URL input + Open-in-browser + 3-dot menu
(Hard reload, DevTools, Zoom −/+/reset, Clear cookies/cache).
- usePreviewSession subscribes to server events; usePreviewBridge
mirrors desktop state into the store and forwards Loading→Success/
LoadFailed back to the server.
- previewStateStore: per-thread snapshot + desktopOverlay + recently-
seen URLs (Zustand).
- rightPanelStore arbitrates plan vs. preview vs. diff; ChatView's
toggles strip the `?diff=1` URL hint when switching to preview and
vice versa so the panels are mutually exclusive.
- Top-nav Globe toggle in ChatHeader (desktop builds only) and a
`mod+shift+J` keybinding routed via a typed previewActionBus.
- PreviewEmptyState lists detected localhost servers (scanner +
configured project URLs + recently-seen) with live "listening" pulse.
- PreviewUnreachable: theme-aware port of Chromium's "site can't be
reached" page.
- Resizable inline panel (RightPanelResizeHandle + useResizableWidth);
width persists to localStorage on drag-end.
- Terminal link "Open in preview" context-menu integration for loopback
URLs.
Contracts:
- preview.ts schemas (PreviewSessionSnapshot, PreviewNavStatus,
PreviewEvent, RPC inputs/results, DiscoveredLocalServer).
- ProjectScript schema gains optional `previewUrl` + `autoOpenPreview`.
- New keybinding commands: preview.toggle/refresh/focusUrl/zoomIn/Out/
resetZoom; new `when:` contexts `previewFocus` / `previewOpen`.
Shared:
- @t3tools/shared/preview: normalizePreviewUrl, isPreviewableUrl,
isLoopbackHost, newPreviewTabId, LSOF_LOCAL_HOST_TOKENS.
Tests:
- contracts: schema decode tests for all preview events/snapshots/inputs.
- shared: URL normalization coverage.
- server: PreviewManager (open/navigate/reportStatus/refresh/close,
multi-subscriber isolation, idempotency); PortScanner (lsof parsing
including IPv6, TCP probe, reference-counted polling).
- web: previewStateStore (per-tab event application, dedupe,
reconnect recovery); rightPanelStore arbitration.