fix(project-view): route 'Use PR' launches through submit-after-ready waiter#7946
fix(project-view): route 'Use PR' launches through submit-after-ready waiter#7946branben wants to merge 4 commits into
Conversation
Hermes's prompt_toolkit TUI never emits the DECSET 2004 bracketed-paste handshake that the default draft-paste readiness waiter gates on, so the automation prompt was silently dropped and the agent sat idle (terminal opens, nothing entered). Add a 'process-ready' DraftPasteReadySignal that arms the quiet-window on first PTY output and pastes once the TUI settles, and assign it to the hermes agent config. Adds a Hermes unit test covering the no-handshake path. Design for the follow-up PR/issue review loop lives in docs/design/pr-issue-review-loop.md (not committed; gitignored).
CodeRabbit: the process-ready fallback consulted waitForAgentReady, which compares the foreground process basename via isExpectedAgentProcess. Wrapped interpreter launches surface as 'python3 .../hermes', so the check can never confirm readiness and only drops the paste. process-ready readiness is the PTY-quiet window (handled by waitForAgentDraftInputReady); the process-name fallback is dead for this signal. Skip it and return false on timeout instead.
Guard against a duplicate paste in the no-handshake Hermes path by asserting sendRuntimePtyInputVerified is called exactly once. Addresses the CodeRabbit nitpick on PR stablyai#7862.
… waiter Project-view 'Use' actions (both direct-launch sites in ProjectViewWrapper) called launchWorkItemDirect without promptDelivery, defaulting to 'draft', which pastes the work item URL but never submits it. For TUI agents like Hermes that require Enter to start, the prompt then sits idle in the input box — the exact 'opens terminal, URL inside, does nothing' symptom. Set promptDelivery: 'submit-after-ready' so these launches route through the fixed pasteDraftWhenAgentReady waiter (PR stablyai#7862, process-ready signal) and submit the prompt. PullRequestPage already did this; the project view did not. Adds a regression test asserting every launchWorkItemDirect call site in ProjectViewWrapper requests submit-after-ready.
📝 WalkthroughWalkthroughThis PR adds a 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 3b316bc1-a736-476a-a9f2-8cb02ba3eda6
📒 Files selected for processing (6)
src/renderer/src/components/github-project/ProjectViewWrapper.tsxsrc/renderer/src/components/github-project/project-view-wrapper-source-context-boundary.test.tssrc/renderer/src/lib/agent-paste-draft.test.tssrc/renderer/src/lib/agent-paste-draft.tssrc/shared/draft-paste-ready-scanner.tssrc/shared/tui-agent-config.ts
| * - `process-ready`: no DECSET 2004 handshake and no marker. Used by agents | ||
| * (e.g. Hermes's prompt_toolkit TUI) that never emit bracketed-paste | ||
| * enable. Arms the quiet window on the first PTY output chunk; once the | ||
| * agent's render burst settles (BRACKETED_PASTE_QUIET_MS of silence) the | ||
| * caller pastes. The caller's existing process-ownership fallback is the | ||
| * backstop if output never arrives. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
JSDoc contradicts the agent-paste-draft.ts fallback bypass.
The last sentence says "The caller's existing process-ownership fallback is the backstop if output never arrives," but agent-paste-draft.ts lines 117-119 explicitly bypass that fallback for process-ready — it calls onTimeout?.() and returns false instead. The two files document opposite behaviors for the same signal.
📝 Suggested JSDoc fix
* - `process-ready`: no DECSET 2004 handshake and no marker. Used by agents
* (e.g. Hermes's prompt_toolkit TUI) that never emit bracketed-paste
* enable. Arms the quiet window on the first PTY output chunk; once the
- * agent's render burst settles (BRACKETED_PASTE_QUIET_MS of silence) the
- * caller pastes. The caller's existing process-ownership fallback is the
- * backstop if output never arrives.
+ * agent's render burst settles (BRACKETED_PASTE_QUIET_MS of silence) the
+ * caller pastes. If output never arrives the caller's budget expires,
+ * `onTimeout` fires, and the paste is dropped — no process-ownership
+ * fallback for this signal (see `pasteDraftWhenAgentReady`).📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| * - `process-ready`: no DECSET 2004 handshake and no marker. Used by agents | |
| * (e.g. Hermes's prompt_toolkit TUI) that never emit bracketed-paste | |
| * enable. Arms the quiet window on the first PTY output chunk; once the | |
| * agent's render burst settles (BRACKETED_PASTE_QUIET_MS of silence) the | |
| * caller pastes. The caller's existing process-ownership fallback is the | |
| * backstop if output never arrives. | |
| * - `process-ready`: no DECSET 2004 handshake and no marker. Used by agents | |
| * (e.g. Hermes's prompt_toolkit TUI) that never emit bracketed-paste | |
| * enable. Arms the quiet window on the first PTY output chunk; once the | |
| * agent's render burst settles (BRACKETED_PASTE_QUIET_MS of silence) the | |
| * caller pastes. If output never arrives the caller's budget expires, | |
| * `onTimeout` fires, and the paste is dropped — no process-ownership | |
| * fallback for this signal (see `pasteDraftWhenAgentReady`). |
Problem
Project-view "Use PR" / "open task" actions called
launchWorkItemDirectwithoutpromptDelivery, defaulting to'draft'. The draft path pastes the work item URL into the agent but never submits it (the startupdraftPromptdelivery intentionally omits Enter —src/renderer/src/lib/new-workspace.ts:316). For TUI agents like Hermes that require Enter to start, the prompt then sits idle in the input box — the exact "opens terminal, URL inside, does nothing" symptom.Fix
Set
promptDelivery: 'submit-after-ready'on bothlaunchWorkItemDirectcall sites inProjectViewWrapper.tsx(lines ~664 and ~948). This routes the launch through the fixedpasteDraftWhenAgentReadywaiter (PR #7862,draftPasteReadySignal: 'process-ready') which pastes AND submits.PullRequestPage.tsxalready did this correctly; the project view did not.This depends on #7862 (the waiter fix). Verified live: the project-view path now delivers
^[[200~<url>^[[201~\r(bracketed paste + Enter) into Hermes.Verification
pnpm run typecheckcleanlaunch-work-item-direct.test.ts(11) + new regression test (2) pass...pull/123^[[201~\r)Test plan
pnpm run test src/renderer/src/components/github-project/project-view-wrapper-source-context-boundary.test.ts