Repository navigation
Keep the Approve button visible after the watcher disconnects - #148
Open
jamescbury wants to merge 1 commit into
Open
jamescbury wants to merge 1 commit into
jamescbury wants to merge 1 commit into
Conversation
The Approve / Done Reviewing button was rendered only while an agent watcher was connected (reviewWatcherCount > 0). If the watch process crashed or the server restarted mid-review, the button silently unmounted within one 1.5s poll, leaving the reviewer with no way to hand off — and no explanation. Track whether a watcher has ever been seen for the active document (reviewWatcherSeen, reset on document change) and keep the button rendered once it has. Clicking with no watcher already degrades cleanly: the server reports delivered=false, the existing "undelivered" state explains that no agent is watching, and the button re-arms automatically when a watcher reconnects. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@jamescbury is attempting to deploy a commit to the Lex Team on Vercel. A member of the Team first needs to authorize it. |
jmatthewpryor
added a commit
to jmatthewpryor/roughdraft
that referenced
this pull request
Sep 11, 2026
… bump to 0.1.11-patched.2 Adapts Lex-Inc#149 to a per-watch undici Agent instead of a process-wide singleton: the singleton kept a pooled keep-alive socket to a server that had since restarted, so the next watch in the same process failed with UND_ERR_SOCKET "other side closed". The Agent is now created per watch in both the CLI and the MCP watch tool and closed in a finally. Fixes a pre-existing race in two CLI tests that posted the review event as soon as the watch request had been sent, before the server had registered the waiter; they now poll /api/review-events/status for a watcher first. Documents the new patches, the Lex-Inc#149 adaptation, the merge-conflict notes, and the new "handoff after watcher lost" state in the screenshot guide. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
felciano
added a commit
to felciano/roughdraft
that referenced
this pull request
Oct 31, 2026
…the watcher disconnects From Lex-Inc#148, unmerged upstream as of 2026-10-31. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LXZP8LMTVHbkEsmdNZzjyf
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Approve / Done Reviewing button is rendered only while an agent watcher is connected:
Watcher status is polled every 1.5s, so if the
roughdraft open/watchprocess dies mid-review (agent crash, server restart, or the >5-minute watch timeout addressed in #144), the button silently unmounts while the reviewer is still reading. From the reviewer's side the Approve button just disappears with no explanation, and there is no way to hand the document back.This happened in practice: a reviewer finished commenting on a document, went to approve, and the button was gone because the watching agent's process had died minutes earlier.
Fix
Track whether a watcher has ever been seen for the active document (
reviewWatcherSeen, reset when the document changes) and keep the button rendered once one has. A transient watcher drop no longer hides the handoff affordance.Clicking while no watcher is connected already degrades cleanly through the existing machinery: the server reports
delivered: false, the UI enters theundeliveredstate ("No agent is watching now"), and the existing effect re-arms the button toidlewhen a watcher reconnects — no new states or copy needed.Documents opened without any watcher behave exactly as before (no button).
Testing
pnpm --filter @roughdraft/app test— 225 tests pass.roughdraft watch, opened the document (?path=), confirmed the button renders; killed the watcher process and waited for the server-side waiter to expire (/api/review-events/statusreportingwatcherCount: 0); the button remains visible. Onmainit unmounts within one 1.5s poll.Independent of #144, but the two failures compound: #144 stops the watcher dying at the 5-minute mark, and this PR stops the UI stranding the reviewer whenever a watcher dies anyway.
🤖 Generated with Claude Code