Skip to content

fix(project-view): route 'Use PR' launches through submit-after-ready waiter#7946

Open
branben wants to merge 4 commits into
stablyai:mainfrom
branben:fix/project-view-use-pr-submits-prompt
Open

fix(project-view): route 'Use PR' launches through submit-after-ready waiter#7946
branben wants to merge 4 commits into
stablyai:mainfrom
branben:fix/project-view-use-pr-submits-prompt

Conversation

@branben

@branben branben commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Problem

Project-view "Use PR" / "open task" actions called launchWorkItemDirect without promptDelivery, defaulting to 'draft'. The draft path pastes the work item URL into the agent but never submits it (the startup draftPrompt delivery 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 both launchWorkItemDirect call sites in ProjectViewWrapper.tsx (lines ~664 and ~948). This routes the launch through the fixed pasteDraftWhenAgentReady waiter (PR #7862, draftPasteReadySignal: 'process-ready') which pastes AND submits. PullRequestPage.tsx already 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

Test plan

  • pnpm run test src/renderer/src/components/github-project/project-view-wrapper-source-context-boundary.test.ts
  • Manual: open a PR from the GitHub project view, confirm Hermes receives and runs the prompt

Brandon Bennett added 4 commits July 8, 2026 18:29
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.
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds a process-ready mode to DraftPasteReadySignal, applies it to the Hermes agent config, and updates the draft-paste-ready scanner and pasteDraftWhenAgentReady logic to skip DECSET 2004/marker detection for this signal, immediately arming the quiet-window timer or triggering timeout/fallback. It also adds promptDelivery: 'submit-after-ready' to two launchWorkItemDirect call sites in ProjectViewWrapper.tsx. Corresponding unit and regression tests were added for both changes.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the main change: routing project-view PR launches through submit-after-ready.
Description check ✅ Passed It covers Summary, Fix, Verification, and Test plan, so the main template content is present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3b316bc1-a736-476a-a9f2-8cb02ba3eda6

📥 Commits

Reviewing files that changed from the base of the PR and between 8adfef4 and 23404b6.

📒 Files selected for processing (6)
  • src/renderer/src/components/github-project/ProjectViewWrapper.tsx
  • src/renderer/src/components/github-project/project-view-wrapper-source-context-boundary.test.ts
  • src/renderer/src/lib/agent-paste-draft.test.ts
  • src/renderer/src/lib/agent-paste-draft.ts
  • src/shared/draft-paste-ready-scanner.ts
  • src/shared/tui-agent-config.ts

Comment on lines +42 to +47
* - `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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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.

Suggested change
* - `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`).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants