Skip to content

The agent that grows with you

chore(desktop): drop the dead PR-comment fetch IPC

DavidMetcalfe4279932cac12
diff --git a/apps/desktop/electron/git-ipc.ts b/apps/desktop/electron/git-ipc.ts
index 105307d03ed..a30922618f0 100644
--- a/apps/desktop/electron/git-ipc.ts
+++ b/apps/desktop/electron/git-ipc.ts
@@ -13,7 +13,6 @@ import {
reviewCommitContext,
reviewCreatePr,
reviewDiff,
- reviewFetchPrComment,
reviewList,
reviewPrList,
reviewPush,
@@ -101,9 +100,6 @@ export function registerGitIpc({ resolveGitBinary, resolveGhBinary }: GitIpcDeps
ipcMain.handle('hermes:git:review:prList', async (_event, repoPath, branches, numbers) =>
reviewPrList(repoPath, resolveGhBinary(), branches, numbers)
)
- ipcMain.handle('hermes:git:review:fetchPrComment', async (_event, repoPath, url) =>
- reviewFetchPrComment(repoPath, resolveGhBinary(), url)
- )
ipcMain.handle('hermes:git:review:createPr', async (_event, repoPath) =>
reviewCreatePr(repoPath, resolveGitBinary(), resolveGhBinary())
)
diff --git a/apps/desktop/electron/git-review-ops.ts b/apps/desktop/electron/git-review-ops.ts
index 95cdfba7ca3..393ede5f85a 100644
--- a/apps/desktop/electron/git-review-ops.ts
+++ b/apps/desktop/electron/git-review-ops.ts
@@ -618,77 +618,6 @@ const prPayload = pr => ({
url: String(pr.url || '')
})
-// A GitHub review-comment / issue-comment URL, as pasted from the browser.
-// Captures owner, repo, PR number, and the comment kind + id. Review threads
-// deep-link as `#discussion_r<id>`; conversation-tab comments as
-// `#issuecomment-<id>`.
-const PR_COMMENT_URL_RE =
- /^https:\/\/github\.com\/([^/\s]+)\/([^/\s]+)\/pull\/(\d+)(?:\/[^#\s]*)?#(discussion_r|issuecomment-)(\d+)$/
-
-function parsePrCommentUrl(url) {
- const match = PR_COMMENT_URL_RE.exec(String(url || '').trim())
-
- if (!match) {
- return null
- }
-
- const [, owner, repo, prNumber, kind, id] = match
-
- return { id, kind: kind === 'discussion_r' ? 'review' : 'issue', owner, prNumber: Number(prNumber), repo }
-}
-
-// Resolve a pasted PR comment URL into the structured context the composer
-// attaches: author, body, and — for review comments — the file, line range,
-// and the diff hunk the comment anchors to. Reads only; any failure (gh
-// missing, unauthenticated, private repo, deleted comment) yields null and the
-// paste falls back to being a plain URL.
-async function reviewFetchPrComment(repoPath, ghBin, url) {
- const parsed = parsePrCommentUrl(url)
-
- if (!parsed) {
- return null
- }
-
- let cwd
-
- try {
- cwd = resolveRequestedPathForIpc(repoPath, { purpose: 'Review comment fetch' })
- } catch {
- return null
- }
-
- const endpoint =
- parsed.kind === 'review'
- ? `repos/${parsed.owner}/${parsed.repo}/pulls/comments/${parsed.id}`
- : `repos/${parsed.owner}/${parsed.repo}/issues/comments/${parsed.id}`
-
- const res = await runGh(['api', endpoint], cwd, ghBin)
-
- if (!res.ok) {
- return null
- }
-
- try {
- const data = JSON.parse(res.stdout)
-
- return {
- author: String(data?.user?.login || ''),
- body: String(data?.body || ''),
- diffHunk: parsed.kind === 'review' ? String(data?.diff_hunk || '') : '',
- kind: parsed.kind,
- // `line` is the comment's anchor in the current diff; null once the code
- // moved on (outdated comment) — `original_line` still says where it was.
- line: data?.line ?? data?.original_line ?? null,
- path: parsed.kind === 'review' ? String(data?.path || '') : '',
- prNumber: parsed.prNumber,
- startLine: data?.start_line ?? data?.original_start_line ?? null,
- url: String(data?.html_url || url)
- }
- } catch {
- return null
- }
-}
-
// The PR for each of the given branches, keyed by branch. Asks GitHub about the
// branches we actually have sessions on rather than listing the repo's newest
// PRs and hoping ours are in the page — on a busy repo they are not. One
@@ -891,7 +820,6 @@ export {
reviewCommitContext,
reviewCreatePr,
reviewDiff,
- reviewFetchPrComment,
reviewList,
reviewPrList,
reviewPush,
diff --git a/apps/desktop/electron/preload.ts b/apps/desktop/electron/preload.ts
index f30f203b8e1..bdc375f3c86 100644
--- a/apps/desktop/electron/preload.ts
+++ b/apps/desktop/electron/preload.ts
@@ -422,7 +422,6 @@ contextBridge.exposeInMainWorld('hermesDesktop', {
shipInfo: repoPath => ipcRenderer.invoke('hermes:git:review:shipInfo', repoPath),
prList: (repoPath, branches, numbers) =>
ipcRenderer.invoke('hermes:git:review:prList', repoPath, branches, numbers),
- fetchPrComment: (repoPath, url) => ipcRenderer.invoke('hermes:git:review:fetchPrComment', repoPath, url),
createPr: repoPath => ipcRenderer.invoke('hermes:git:review:createPr', repoPath)
}
},
diff --git a/apps/desktop/src/global.d.ts b/apps/desktop/src/global.d.ts
index 89ef4c4d048..ebf15fe9ac3 100644
--- a/apps/desktop/src/global.d.ts
+++ b/apps/desktop/src/global.d.ts
@@ -481,10 +481,6 @@ declare global {
// number — for badging a list of sessions in one request instead of
// one `pr view` per checkout.
prList: (repoPath: string, branches: string[], numbers?: number[]) => Promise<HermesRepoPullRequests>
- // A pasted PR review/issue comment URL resolved to its structured
- // context (author, body, file + line anchor, diff hunk). Null when
- // gh can't answer — the paste stays a plain URL.
- fetchPrComment: (repoPath: string, url: string) => Promise<HermesPrComment | null>
createPr: (repoPath: string) => Promise<{ url: string }>
}
// Repo-first discovery: scan bounded roots for git repos (depth-capped).
@@ -1460,21 +1456,6 @@ export interface HermesRepoPullRequests {
prs: HermesBranchPullRequest[]
}
-// A PR review/issue comment resolved from a pasted GitHub URL — the composer's
-// review-comment attachment context. `path`/`line`/`diffHunk` are empty for
-// conversation-tab (issue) comments; `line` is null when the comment is
-// outdated and only `original_line` remained.
-export interface HermesPrComment {
- author: string
- body: string
- diffHunk: string
- kind: 'issue' | 'review'
- line: null | number
- path: string
- prNumber: number
- startLine: null | number
- url: string
-}
// gh availability/auth + the current branch's PR — drives the review pane's PR
// button (disabled when gh isn't ready, "Open PR" vs "Create PR" otherwise).
export interface HermesReviewShipInfo {
diff --git a/apps/desktop/src/lib/desktop-git.ts b/apps/desktop/src/lib/desktop-git.ts
index 98e4fee7179..42982147497 100644
--- a/apps/desktop/src/lib/desktop-git.ts
+++ b/apps/desktop/src/lib/desktop-git.ts
@@ -97,10 +97,6 @@ const remoteGit: GitBridge = {
prList: (repoPath, branches, numbers) =>
gitPost<HermesRepoPullRequests>('review/pr-list', { branches, numbers: numbers ?? [], path: repoPath }),
- // Remote gateways have no PR-comment route yet; resolve to null so the
- // paste degrades to a plain URL instead of throwing mid-paste.
- fetchPrComment: async () => null,
-
createPr: repoPath => gitPost('review/create-pr', { path: repoPath })
},