Feat/instant pr detection simplified#1305
Open
aryanpatel-ctrl wants to merge 4 commits intogeneralaction:mainfrom
Open
Feat/instant pr detection simplified#1305aryanpatel-ctrl wants to merge 4 commits intogeneralaction:mainfrom
aryanpatel-ctrl wants to merge 4 commits intogeneralaction:mainfrom
Conversation
|
@aryanpatel-ctrl is attempting to deploy a commit to the General Action Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Greptile SummaryThis PR adds event-driven PR status refresh by scanning PTY terminal output for GitHub PR URL patterns and triggering an immediate Key points:
Confidence Score: 3/5
|
| Filename | Overview |
|---|---|
| src/main/services/ptyIpc.ts | Adds maybeEmitPrUrlDetected hooked into all PTY onData handlers including SSH PTYs; SSH paths run the regex unnecessarily and emit IPC messages that are silently discarded by the renderer. |
| src/renderer/hooks/useAutoPrRefresh.ts | New effect subscribes to PTY PR URL events and calls refreshPrStatus(event.cwd), but cwd is the spawn-time directory — may target the wrong task if the user cds inside the terminal before running gh pr create. |
| src/main/services/ptyManager.ts | Adds cwd field to local PTY records at spawn time and exports getPtyCwd; SSH PTY records intentionally omit cwd, which is correctly relied upon by the renderer guard. |
| src/main/preload.ts | Exposes onPtyPrUrlDetected via contextBridge following the same pattern as existing IPC listeners; looks correct. |
| src/renderer/types/electron-api.d.ts | Type declarations added for onPtyPrUrlDetected in both global and ElectronAPI interface; consistent with the implementation. |
| AGENTS.md | Minor: trailing newline removed from the last line of the file. |
Sequence Diagram
sequenceDiagram
participant Terminal as Terminal (PTY)
participant ptyIpc as ptyIpc.ts (main)
participant ptyManager as ptyManager.ts (main)
participant Preload as preload.ts (contextBridge)
participant Hook as useAutoPrRefresh.ts (renderer)
participant Store as prStatusStore.ts (renderer)
Terminal->>ptyIpc: onData(chunk)
ptyIpc->>ptyIpc: maybeEmitPrUrlDetected(id, chunk)
ptyIpc->>ptyIpc: PR_URL_RE.match(chunk)
alt URL match found
ptyIpc->>ptyManager: getPtyCwd(id)
ptyManager-->>ptyIpc: cwd (undefined for SSH PTYs)
ptyIpc->>Preload: safeSendToOwner → pty:pr-url-detected { id, url, cwd }
Preload->>Hook: onPtyPrUrlDetected listener fires
alt cwd is defined (local PTY)
Hook->>Store: refreshPrStatus(event.cwd)
Store->>Store: deduplicate via pending map
Store-->>Hook: PrStatus updated
else cwd is undefined (SSH PTY)
Hook->>Hook: early return (no refresh)
end
end
Last reviewed commit: c78ae73
- Add early return when cwd is undefined to skip SSH PTYs - Add 5-second cooldown per PTY to prevent repeated refreshes
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.
Summary
Instant PR detection when created via CLI (e.g.,
gh pr create) instead of waiting up to 30s for the next poll cycle.Simplified resubmission addressing feedback from #1284.
Changes :->
Watch terminal output for GitHub PR URL patterns
Trigger immediate
refreshPrStatus()when detectedSkip SSH PTYs where
cwdis undefined to avoid wrong task refreshImplementation :->
Simple detection per maintainer's suggestion - no tail buffer or cooldown complexity needed since
refreshPrStatusalready deduplicates.Test plan :->
Run
gh pr createin agent terminalVerify changes panel updates immediately with PR status
Verify SSH terminals don't cause wrong task refresh