Skip to content

fix(workspaces): recognize pasted Linear issue URLs - #14190

Merged
nwparker merged 6 commits into
mainfrom
nwparker/clipboard-paste-linear-URL
Aug 13, 2026
Merged

nwparker merged 6 commits into
mainfrom
nwparker/clipboard-paste-linear-URL

Conversation

@nwparker

@nwparker nwparker commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Pasting a Linear, GitHub, GitLab, or Jira issue/PR URL now does two things:

  1. If you already have a worktree linked to that issue or PR, Cmd+J selects it so Enter jumps there.
  2. If you don't, Cmd+J shows a create preview. Linear still looks the issue up; GitHub/GitLab/Jira hand the raw URL to the create dialog so it can ask "Switch project?" when needed.

In Smart Entry, a pasted Linear URL still selects that issue automatically. You can still pick "use this as a workspace name" if you want the URL as text instead.

What Changed

  • Parse only canonical linear.app/<org>/issue/<key>[/slug] URLs as decisive issue intent.
  • Resolve the exact issue in the organization named by the URL, including remote/folder workspace source ownership.
  • Also probe saved API-key / legacy Linear workspaces that omit organizationUrlKey. Accept the result only when the fetched issue URL is in the same org. This is why https://linear.app/stably/issue/STA-4052/... failed against a "Saved Linear workspace".
  • Select the resolved Linear row immediately in Smart Entry, with no ArrowDown required.
  • Keep the "Use … as workspace name" row visible (unfocused) when a Linear URL owns Smart Entry. Linear-tab mode stays Linear-only.
  • Keep Enter inert while an unmistakable URL is still resolving; if lookup misses or fails, restore the existing arbitrary-name path.
  • Cmd+J treats pasted Linear / GitHub / GitLab / Jira issue or PR URLs as exclusive search, not substring text.
  • If a worktree is already linked to that issue/PR, it is listed first and selected. Create stays available underneath.
  • Linear create still previews the looked-up issue. GitHub issue/PR URLs resolve the title in Cmd+J (#14198 Agent terminals…) and still hand the raw URL to the composer so Cmd+N cross-project detection runs. GitLab/Jira stay parse-only.
  • Bound both entry points to their existing 2 KiB query limits and fence stale/replaced lookups.
  • Block Enter immediately while resolving Linear, but delay visible loading feedback by 200 ms and expose busy/live status to assistive technology.
  • Avoid unrelated GitHub, GitLab, and branch queries while an exact Linear URL owns Smart Entry; preserve explicit-provider and mobile arbitrary-name behavior.

Why

A pasted issue/PR URL is unambiguous. Smart Entry previously armed the arbitrary-name row, and Cmd+J treated the URL as plain text — so GitHub issue/PR pastes did not preview, and existing linked worktrees were invisible because a full URL never matched #14198 or STA-4052. This makes the obvious intent the default: jump if you already have that worktree, create if you don't.

Follow-up on review: legacy API-key workspaces often have no stored org key, so lookup never called Linear. And exclusive Linear-only results hid the typed-name fallback.

Linked Issue

No linked issue — reported directly during this worktree task. STA-4084 is fixture/example data only. STA-4052 was the URL used to reproduce the legacy-workspace miss. GitHub examples: https://github.com/stablyai/orca/issues/14198 and https://github.com/stablyai/orca/pull/12789.

Visual Proof

Smart Entry: exact issue selected after paste

Smart Entry with the pasted Linear URL and exact issue selected

Cmd+J: resolved Linear preview selected

Cmd+J showing the resolved Linear issue preview

Linked composer after Enter

Create worktree composer with the Linear issue linked

GitHub/GitLab/Jira Cmd+J preview + existing-worktree selection is covered by focused Vitest (no new screenshots).

Testing

  • I manually tested these changes locally through rendered Electron/Playwright flows.
  • Automated tests added/updated.

Validated on macOS:

  • 3 Electron E2E scenarios: pending paste→Enter guard and exact selection (use-name visible but unfocused), lookup-miss arbitrary-name fallback, and Cmd+J preview→linked composer.
  • Focused Vitest: Linear URL lookup (including legacy workspace without org key), Cmd+J Linear + GitHub URL preview, existing linked-worktree selection, task-URL search matching, Smart Entry source rows / command value, IME Enter, and Linear link parsing.
  • Runtime/folder/SSH source-context behavior is covered in focused tests; no wire, filesystem, Git, or persisted-state contract changed.

AI Disclosure

Implemented with OpenAI Codex assistance and reviewed with parallel Codex agents. Follow-up fixes (legacy lookup + typed-name fallback, Cmd+J GitHub/existing-worktree matching) implemented with Claude Code.

Review

Reviewed for strict URL handling, stale async results, lookup failure recovery, cross-platform paste modifiers, remote/folder workspace ownership, query bounds, mixed-version Linear status data, and legacy workspaces that omit organizationUrlKey. GitHub URL create still defers resolution to the composer. No dependencies or wire contracts changed.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • Focused tests, typechecks, lint/quality, build-backed E2E, and localization gates pass locally; full-suite CI will cover repository-wide gates

Author

@nwparker
nwparker requested a review from brennanb2025 as a code owner August 13, 2026 04:07
@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds Linear and GitHub task URL parsing, organization-aware lookup, stale-status refresh, and worktree matching. Updates the workspace composer and Cmd+J palette with asynchronous previews, delayed loading feedback, stale-request protection, linked-worktree selection, repository context, and task metadata. Adds a dedicated creation row, localization strings, unit tests, component tests, and end-to-end coverage.

Mergeability Score: 🟡 Moderate · up to 413c3

Pasted issue URLs now select existing workspaces or open creation previews, but non-English users can still receive English-only preview and accessibility labels, while editing a pasted URL may trigger repeated provider lookups and one focus test may be timing-sensitive. Merge should wait for these bounded issues to be fixed or explicitly accepted by the owner.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and clearly describes the primary Linear URL recognition change.
Description check ✅ Passed The description is detailed and covers the change, rationale, testing, visual proof, review, and checklist; it explicitly notes that no linked issue exists.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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: 3

🧹 Nitpick comments (1)
src/renderer/src/lib/linear-issue-url-lookup.test.ts (1)

72-73: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the refreshed workspace ID that the second lookup used.

workspaceId: 'stably-workspace' is a constant of the issue() fixture, so it does not prove which workspace the refresh path queried. The call-count assertion is the only real evidence. Add an explicit assertion on the second call arguments.

♻️ Proposed assertion
     ).resolves.toMatchObject({ workspaceId: 'stably-workspace' })
     expect(fetchLinearIssue).toHaveBeenCalledTimes(2)
+    expect(fetchLinearIssue).toHaveBeenLastCalledWith('STA-4084', 'remote-stably-workspace', {
+      sourceContext: null
+    })

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 593161f4-6191-4a0a-bfff-194c6be572b4

📥 Commits

Reviewing files that changed from the base of the PR and between d3a2bf3 and 3fc9d08.

📒 Files selected for processing (17)
  • src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx
  • src/renderer/src/components/WorktreeJumpPalette.tsx
  • src/renderer/src/components/cmd-j/PaletteCreateWorktreeRow.tsx
  • src/renderer/src/components/new-workspace/SmartWorkspaceNameField-source-boundaries.test.ts
  • src/renderer/src/components/new-workspace/SmartWorkspaceNameField.ime-enter.test.tsx
  • src/renderer/src/components/new-workspace/SmartWorkspaceNameField.tsx
  • src/renderer/src/components/new-workspace/smart-workspace-command-value.test.ts
  • src/renderer/src/components/new-workspace/smart-workspace-source-results.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/cmd-j-linear-issue-intent.test.ts
  • src/renderer/src/lib/linear-issue-url-lookup.test.ts
  • src/renderer/src/lib/linear-issue-url-lookup.ts
  • src/shared/linear-links.ts
  • src/shared/new-workspace/smart-workspace-linear-intent.ts
  • src/shared/new-workspace/smart-workspace-source-query.ts
  • src/shared/new-workspace/smart-workspace-source-results.ts
  • tests/e2e/linear-url-workspace-entry.spec.ts

Comment on lines +509 to +515
await act(async () => {
issueLookup.resolve(makeLinearIssue())
await issueLookup.promise
await new Promise((resolve) => window.setTimeout(resolve, 50))
})

expect(document.activeElement).toBe(focusTarget)

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

🧩 Analysis chain

🌐 Web query:

Does Vitest expect.poll support a timeout option?

💡 Result:

Yes, Vitest's expect.poll supports a timeout option [1][2][3]. You can provide a timeout in milliseconds as an option to expect.poll to specify how long Vitest should retry the assertion before failing [1][2][3]. Usage example: await expect.poll( => condition, { timeout: 2000 }).toBe(true); Key details regarding the timeout option: - Default Value: The default timeout is 1000ms, which can also be configured globally via the Vitest config [4][1][3]. - Functionality: The timeout applies to the entire polling operation, which includes the execution of the polling callback and any associated asynchronous matcher execution [2]. - AbortSignal: The callback function provided to expect.poll can receive an AbortSignal as an argument, which is triggered when the specified timeout is reached [2]. This allows the polling callback to abort its own internal operations (like long-running requests) if the poll timeout has elapsed [2][5].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx"
printf '%s\n' '--- relevant test ---'
sed -n '450,535p' "$file"

printf '%s\n' '--- focusFallbackSurface references ---'
rg -n -C 5 "focusFallbackSurface|requestAnimationFrame|activeElement" src/renderer/src/components src/renderer/src -g '*.ts' -g '*.tsx' | head -240

printf '%s\n' '--- Vitest configuration and versions ---'
rg -n -C 3 '"vitest"|expect\.poll|testTimeout|fakeTimers' package.json pnpm-lock.yaml yarn.lock package-lock.json vitest.config.* src -g '*' 2>/dev/null | head -240

Repository: stablyai/orca

Length of output: 29796


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '--- locate focusFallbackSurface ---'
rg -n -C 8 --hidden --glob '!node_modules' --glob '!dist' --glob '!build' "focusFallbackSurface" . || true

printf '%s\n' '--- locate nested animation-frame focus scheduling ---'
rg -n -C 8 --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  "requestAnimationFrame.*requestAnimationFrame|requestAnimationFrame" \
  src/renderer/src/components/WorktreeJumpPalette* \
  src/renderer/src/components 2>/dev/null | head -300

printf '%s\n' '--- test setup and timer configuration ---'
sed -n '1,120p' src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx
rg -n -C 4 --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  "useFakeTimers|useRealTimers|stubGlobal.*requestAnimationFrame|setTimeout" \
  src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx \
  src/renderer/src/components/WorktreeJumpPalette* 2>/dev/null || true

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path

source = Path("src/renderer/src/components/WorktreeJumpPalette.tsx").read_text()
test = Path("src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx").read_text()

start = source.index("const focusFallbackSurface = useCallback")
end = source.index("const handleCloseAutoFocus", start)
implementation = source[start:end]

assert implementation.count("requestAnimationFrame") >= 2
assert "resolvePaletteFocusRestoreTarget(preferredTarget ?? null)?.focus" in implementation
assert "setTimeout(resolve, 50)" in test
assert "useFakeTimers" not in test

print("focusFallbackSurface uses nested requestAnimationFrame callbacks")
print("test uses a fixed 50 ms setTimeout")
print("test does not configure fake timers")
PY

printf '%s\n' '--- exact implementation ---'
sed -n '2120,2134p' src/renderer/src/components/WorktreeJumpPalette.tsx

printf '%s\n' '--- existing expect.poll usage ---'
rg -n -m 5 "expect\.poll\(" src/renderer/src --glob '*.test.ts' --glob '*.test.tsx'

Repository: stablyai/orca

Length of output: 240


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path

source = Path("src/renderer/src/components/WorktreeJumpPalette.tsx").read_text()
test = Path("src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx").read_text()

start = source.index("const focusFallbackSurface = useCallback")
end = source.index("const handleCloseAutoFocus", start)
implementation = source[start:end]

assert implementation.count("requestAnimationFrame") >= 2
assert "resolvePaletteFocusRestoreTarget(preferredTarget ?? null)?.focus" in implementation
assert "window.setTimeout(resolve, 50)" in test
assert "useFakeTimers" not in test

print("nested_raf_focus=True")
print("fixed_50ms_wait=True")
print("fake_timers_in_test=False")
PY

sed -n '2122,2131p' src/renderer/src/components/WorktreeJumpPalette.tsx
sed -n '500,518p' src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx
rg -n -m 5 "expect\.poll\(" src/renderer/src --glob '*.test.ts' --glob '*.test.tsx'

Repository: stablyai/orca

Length of output: 240


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- timer references in the test file ---'
rg -n -C 2 "useFakeTimers|useRealTimers|setTimeout|requestAnimationFrame" \
  src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx || true

printf '%s\n' '--- focus scheduling implementation ---'
sed -n '2122,2132p' src/renderer/src/components/WorktreeJumpPalette.tsx

printf '%s\n' '--- target test ---'
sed -n '495,520p' src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx

printf '%s\n' '--- repository expect.poll examples ---'
rg -n -m 5 "expect\.poll\(" src/renderer/src --glob '*.test.ts' --glob '*.test.tsx'

Repository: stablyai/orca

Length of output: 3052


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- lifecycle hooks and first fake-timer test ---'
sed -n '200,285p' src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx

printf '%s\n' '--- test boundaries around the target and later fake-timer test ---'
sed -n '430,585p' src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx

printf '%s\n' '--- all timer lifecycle calls in this file ---'
rg -n -C 3 "beforeEach|afterEach|useFakeTimers|useRealTimers" \
  src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx

Repository: stablyai/orca

Length of output: 10007


Poll for the focus target instead of sleeping for 50 ms. focusFallbackSurface uses two nested requestAnimationFrame callbacks, so the fixed delay can expire before focus is restored under CI load.

Comment on lines +1668 to +1731
const linearIssueUrlIntent = useMemo(
() => (isWorktreePaletteQueryTooLarge(query) ? null : parseLinearIssueUrlIntent(query)),
[query]
)
const createWorktreeName = linearIssueUrlIntent ? query.trim() : deferredCreateWorktreeName
const showCreateAction = deferredShowCreateAction || linearIssueUrlIntent !== null
const prioritizeLinearCreateAction = linearIssueUrlIntent !== null

// Why: arm the lookup before Enter can target the newly rendered Linear row.
useLayoutEffect(() => {
const generation = ++linearIssueLookupGenerationRef.current
linearIssueLookupRef.current = null
if (!visible || !linearIssueUrlIntent) {
setLinearIssuePreview(null)
return
}

const state = useAppStore.getState()
const workspaceTarget = getComposerDefaultWorkspaceTarget(state)
const initialRepoId = workspaceTarget?.repoId ?? null
const sourceContext = workspaceTarget
? buildTaskSourceContextFromRepo({
provider: 'linear',
projectId: workspaceTarget.projectId,
repo: workspaceTarget.repo,
projectHostSetupId: workspaceTarget.projectHostSetupId
})
: null
const pendingPreview: CmdJLinearIssuePreview = {
query: createWorktreeName,
issue: null,
loading: true,
initialRepoId,
sourceContext
}
setLinearIssuePreview(pendingPreview)

const promise = lookupLinearIssueUrl({
intent: linearIssueUrlIntent,
knownStatus: state.linearStatus,
sourceContext,
fetchLinearIssue: state.fetchLinearIssue
})
.catch(() => null)
.then(
(issue): CmdJLinearIssuePreview => ({
...pendingPreview,
issue,
loading: false
})
)
linearIssueLookupRef.current = { query: createWorktreeName, promise }
void promise.then((preview) => {
if (linearIssueLookupGenerationRef.current === generation) {
setLinearIssuePreview(preview)
}
})

return () => {
if (linearIssueLookupGenerationRef.current === generation) {
linearIssueLookupGenerationRef.current += 1
}
}
}, [createWorktreeName, linearIssueUrlIntent, visible])

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.

🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy lift

Key the lookup effect on the parsed intent, not the raw query.

createWorktreeName is query.trim(), and linearIssueUrlIntent is a new object for every distinct query. Both are effect dependencies. Every keystroke inside an already-valid Linear URL therefore re-runs the effect, clears linearIssueLookupRef, and starts a new lookupLinearIssueUrl call. Editing the slug tail of a pasted URL issues one Linear provider request per character, and each request can also trigger a readLinearStatus refresh.

The parsed identifier and organization key are what the lookup actually depends on. Derive a stable key from them, use that key as the effect dependency, and store the key in the preview so the staleness comparisons at Line 1734, Line 2435, and Line 2437 stay meaningful.

♻️ Proposed direction
   const createWorktreeName = linearIssueUrlIntent ? query.trim() : deferredCreateWorktreeName
   const showCreateAction = deferredShowCreateAction || linearIssueUrlIntent !== null
   const prioritizeLinearCreateAction = linearIssueUrlIntent !== null
+  // Why: the lookup only varies by identifier and organization, so slug edits must not refetch.
+  const linearIssueLookupKey = linearIssueUrlIntent
+    ? `${linearIssueUrlIntent.organizationUrlKey.toLowerCase()}/${linearIssueUrlIntent.identifier}`
+    : null

Then replace the createWorktreeName / linearIssueUrlIntent dependencies with linearIssueLookupKey, and record lookupKey: linearIssueLookupKey on CmdJLinearIssuePreview and on linearIssueLookupRef.current in place of the raw query.

Comment on lines +16 to +28
async function fetchMatchingLinearIssue(
intent: LinearIssueUrlIntent,
workspaceId: string,
sourceContext: TaskSourceContext | null,
fetchLinearIssue: FetchLinearIssue
): Promise<LinearIssue | null> {
try {
const issue = await fetchLinearIssue(intent.identifier, workspaceId, { sourceContext })
return issue && isLinearIssueUrlResolutionMatch(intent, issue) ? issue : null
} catch {
return null
}
}

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.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check whether the Linear renderer client and store action bound their IPC requests.
set -euo pipefail

fd -t f 'runtime-linear-client' --exec ast-grep outline {} --items all
fd -t f 'runtime-linear-client' --exec rg -n -C4 'timeout|Timeout|AbortController|withTimeout'

# fetchLinearIssue store action definition and any timeout wrapper around it.
ast-grep run --pattern 'fetchLinearIssue: async ($$$) => { $$$ }' --lang typescript src/renderer/src || true
rg -n -C6 --type=ts 'fetchLinearIssue\s*[:=]' src/renderer/src/store

Repository: stablyai/orca

Length of output: 18560


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- target files ---'
fd -t f 'linear-issue-url-lookup|WorktreeJumpPalette|runtime-linear-client|linear\.ts$' src/renderer/src src/main

printf '%s\n' '--- lookup and status symbols ---'
rg -n -C12 --type ts 'fetchMatchingLinearIssue|readLinearStatus|fetchLinearIssue|linearStatus|lookup\.promise|handleCreateWorktree' \
  src/renderer/src/lib src/renderer/src/components src/renderer/src/runtime src/renderer/src/store

printf '%s\n' '--- Linear IPC registrations/handlers ---'
rg -n -C8 --type ts 'linear\.(status|getIssue)|linearStatus|linearGetIssue|ipcMain\.handle|handle.*Linear' src/main src/preload src/renderer/src

printf '%s\n' '--- timeout primitives ---'
rg -n -C4 --type ts 'callRuntimeRpc|timeoutMs|withTimeout|AbortController|Promise\.race' src/renderer/src/runtime src/renderer/src/lib src/renderer/src/store src/main | rg -i 'linear|runtime|timeout|abort|promise'

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- exact files ---'
fd -t f . src/renderer/src src/main src/preload | rg '/(linear-issue-url-lookup\.ts|WorktreeJumpPalette\.tsx|runtime-linear-client\.ts|linear\.ts)$'

printf '%s\n' '--- target symbol locations ---'
rg -n 'fetchMatchingLinearIssue|readLinearStatus|fetchLinearIssue|linearStatus|lookup\.promise|handleCreateWorktree' \
  src/renderer/src/lib/linear-issue-url-lookup.ts \
  src/renderer/src/components \
  src/renderer/src/runtime/runtime-linear-client.ts \
  src/renderer/src/store/slices/linear.ts

printf '%s\n' '--- focused source excerpts ---'
python3 - <<'PY'
from pathlib import Path
needles = (
    'fetchMatchingLinearIssue', 'readLinearStatus', 'fetchLinearIssue',
    'linearStatus', 'lookup.promise', 'handleCreateWorktree',
)
files = []
for root in ('src/renderer/src', 'src/main', 'src/preload'):
    p = Path(root)
    if p.exists():
        files.extend(p.rglob('linear-issue-url-lookup.ts'))
        files.extend(p.rglob('WorktreeJumpPalette.tsx'))
        files.extend(p.rglob('runtime-linear-client.ts'))
        files.extend(p.rglob('linear.ts'))
for path in sorted(set(files)):
    lines = path.read_text(errors='replace').splitlines()
    hits = [i for i, line in enumerate(lines) if any(n in line for n in needles)]
    if not hits:
        continue
    ranges = []
    for i in hits:
        lo, hi = max(0, i-10), min(len(lines), i+20)
        if not ranges or lo > ranges[-1][1]:
            ranges.append([lo, hi])
        else:
            ranges[-1][1] = max(ranges[-1][1], hi)
    print(f'--- {path} ---')
    for lo, hi in ranges:
        for i in range(lo, hi):
            print(f'{i+1}:{lines[i]}')
        print()
PY

printf '%s\n' '--- local Linear API and handler references ---'
rg -n -C5 'linear\.status|linear\.getIssue|linear\.searchIssues|linearStatus|linearGetIssue|linearSearchIssues' \
  src/main src/preload src/renderer/src | head -n 400

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- fetchLinearIssue implementation ---'
sed -n '880,985p' src/renderer/src/store/slices/linear.ts

printf '%s\n' '--- handleCreateWorktree continuation ---'
sed -n '2407,2495p' src/renderer/src/components/WorktreeJumpPalette.tsx

printf '%s\n' '--- local Linear IPC module ---'
sed -n '1,260p' src/main/ipc/linear.ts

printf '%s\n' '--- local runtime Linear methods ---'
rg -n -C12 'async linearStatus|linearStatus\(|async linearGetIssue|linearGetIssue\(|linearSearchIssues|linear\.status|linear\.getIssue' \
  src/main/runtime src/main/ipc src/preload | head -n 500

printf '%s\n' '--- API declarations and timeout-capable provider calls ---'
rg -n -C8 'linear:\s*\{|status:\s*\(|getIssue:\s*\(|searchIssues:\s*\(|timeoutMs|withTimeout' \
  src/preload src/main/ipc src/main/providers src/main | rg -i 'linear|timeout|status|getIssue|searchIssues' | head -n 500

Repository: stablyai/orca

Length of output: 50369


Bound local Linear lookups before opening the composer

The environment runtime path has a timeout, but local window.api.linear.status() and window.api.linear.getIssue() calls do not. A stalled local IPC call leaves Enter waiting indefinitely in handleCreateWorktree. Add a timeout around the issue and status lookups, and treat expiry as null so the name-only composer fallback opens.

Source: Learnings

nwparker and others added 5 commits August 12, 2026 21:36
Saved API-key Linear workspaces often omit organizationUrlKey, so pasted
issue URLs never called fetchLinearIssue. Probe those unknown-org
workspaces and accept only a matching issue URL.

Keep "Use … as workspace name" visible in Smart Entry when a Linear URL
owns the results. sourceIntent still focuses the issue row.

Co-authored-by: Orca <[email protected]>
Cmd+J now treats GitHub, GitLab, Jira, and Linear issue/PR URLs as
decisive search, so pasting one lists already-linked worktrees first
and keeps a create preview underneath. GitHub/GitLab/Jira still hand
the raw URL to the composer for cross-project detection.

Co-authored-by: Orca <[email protected]>
Pasted GitHub issue/PR URLs now fetch the title for the create preview,
same as Linear. Existing linked worktrees stay selected first so Enter
jumps; create still hands the raw URL to the composer.

Co-authored-by: Orca <[email protected]>
Pasting a GitHub issue/PR URL into Cmd+J already previewed the title, but
Enter still opened the composer with the raw URL. Await the in-flight
lookup and hand the linked work item through, matching Linear and Task
page create. Also fix CI type, lint, and focus-routing source checks.

Co-authored-by: Orca <[email protected]>
Unblock PR CI localization catalog checks and make the Linear lookup-miss
e2e wait out the resolving state before advancing to the agent field.

Co-authored-by: Orca <[email protected]>
@nwparker
nwparker merged commit c61f296 into main Aug 13, 2026
47 checks passed
@nwparker
nwparker deleted the nwparker/clipboard-paste-linear-URL branch August 13, 2026 06:24

@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: 2

🧹 Nitpick comments (3)
src/renderer/src/lib/cmd-j-github-url-lookup.test.ts (1)

32-72: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the omitted-host branch.

The module spreads host conditionally so that a slug without a host does not send host: undefined. No test exercises that branch. Add a case with slug: { owner, repo } and assert the forwarded argument has no host key.

♻️ Proposed addition
     lookupGitHubWorkItemByOwnerRepoForSource.mockRejectedValue(new Error('offline'))
     expect(
       await lookupCmdJGitHubUrlWorkItem({
         link,
         repo: { id: 'repo-1', path: '/repos/repo-1' },
         sourceContext: null
       })
     ).toBeNull()
+
+    lookupGitHubWorkItemByOwnerRepoForSource.mockReset()
+    lookupGitHubWorkItemByOwnerRepoForSource.mockResolvedValue(item)
+    await lookupCmdJGitHubUrlWorkItem({
+      link: { slug: { owner: 'stablyai', repo: 'orca' }, type: 'issue' as const, number: 14198 },
+      repo: { id: 'repo-1', path: '/repos/repo-1' },
+      sourceContext: null
+    })
+    expect(lookupGitHubWorkItemByOwnerRepoForSource.mock.calls[0]?.[0]).not.toHaveProperty('host')
   })
src/renderer/src/components/cmd-j/PaletteCreateWorktreeRow.tsx (1)

67-76: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consolidate the two delayed-loading implementations.

This component now owns a 200 ms delay for the task-URL preview. The parent already owns an identical 200 ms delay for the Linear preview and passes the result down as showLinearLoadingFeedback (WorktreeJumpPalette.tsx, Lines 1827-1842). The same debounce and the same constant now exist in two places for two branches of one row.

Pick one owner. Moving the Linear delay into this component keeps the loading policy next to the markup that renders it and removes the showLinearLoadingFeedback prop.

src/renderer/src/lib/worktree-palette-task-url-match.test.ts (1)

93-180: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add GitLab and Jira worktree-matching tests.

matchWorktreePaletteTaskUrl has four provider branches. This suite covers GitHub and Linear only. worktreeMatchesGitLabUrl and worktreeMatchesJiraUrl are untested, and both contain normalization that a regression would break silently: GitLab lowercases host and path and discriminates mr from issue on the same number; Jira compares jiraIdentifier case-insensitively and then requires origin and sitePath to agree.

These matchers place rows above the create action, so a false positive sends Enter to the wrong workspace. Mirror the GitHub type-collision case for GitLab.

💚 Proposed additions
+  it('matches a GitLab MR URL and does not match the same issue number', () => {
+    const intent = parseCmdJTaskSourceUrl('https://gitlab.com/acme/orca/-/merge_requests/17')
+    expect(
+      matchWorktreePaletteTaskUrl({ worktree: makeWorktree({ linkedGitLabMR: 17 }), intent: intent! })
+    ).toMatchObject({ matchedField: 'pr', supportingText: { labelKind: 'mr' } })
+    expect(
+      matchWorktreePaletteTaskUrl({
+        worktree: makeWorktree({ linkedGitLabIssue: 17 }),
+        intent: intent!
+      })
+    ).toBeNull()
+  })
+
+  it('matches a Jira URL by identifier and rejects another site', () => {
+    const intent = parseCmdJTaskSourceUrl('https://company.atlassian.net/browse/ORCA-123')
+    expect(
+      matchWorktreePaletteTaskUrl({
+        worktree: makeWorktree({
+          linkedWorkItem: {
+            provider: 'jira',
+            type: 'issue',
+            number: 123,
+            title: 'Fix',
+            url: 'https://company.atlassian.net/browse/ORCA-123',
+            jiraIdentifier: 'orca-123'
+          }
+        }),
+        intent: intent!
+      })
+    ).toMatchObject({ supportingText: { text: 'ORCA-123' } })
+    expect(
+      matchWorktreePaletteTaskUrl({
+        worktree: makeWorktree({
+          linkedWorkItem: {
+            provider: 'jira',
+            type: 'issue',
+            number: 123,
+            title: 'Fix',
+            url: 'https://other.atlassian.net/browse/ORCA-123'
+          }
+        }),
+        intent: intent!
+      })
+    ).toBeNull()
+  })

The lowercase jiraIdentifier in the first case also probes whether worktreeMatchesJiraUrl normalizes both sides; it currently uppercases only the stored value.

As per coding guidelines, "Source-control and review changes must support GitLab and other supported providers, keep provider-specific behavior behind explicit checks, and avoid GitHub-only generic terminology."

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ba1051a-5a47-46fb-8712-72d59f0801ab

📥 Commits

Reviewing files that changed from the base of the PR and between 0a34b94 and 413c3d1.

📒 Files selected for processing (13)
  • src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx
  • src/renderer/src/components/WorktreeJumpPalette.tsx
  • src/renderer/src/components/cmd-j/PaletteCreateWorktreeRow.tsx
  • src/renderer/src/components/cmd-j/palette-activation-focus-routing.test.ts
  • src/renderer/src/components/worktree-jump-palette-source-context-boundary.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/cmd-j-github-url-lookup.test.ts
  • src/renderer/src/lib/cmd-j-github-url-lookup.ts
  • src/renderer/src/lib/worktree-palette-search.test.ts
  • src/renderer/src/lib/worktree-palette-search.ts
  • src/renderer/src/lib/worktree-palette-task-url-match.test.ts
  • src/renderer/src/lib/worktree-palette-task-url-match.ts
  • tests/e2e/linear-url-workspace-entry.spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/i18n/locales/en.json
  • tests/e2e/linear-url-workspace-entry.spec.ts

Comment on lines +16 to +24
it('attaches a resolved GitHub URL entity and leaves GitLab/Jira as raw URLs', () => {
// Why: GitHub create reuses the Cmd+J preview (lookup lives in the effect,
// not Case 1). GitLab/Jira still hand the raw URL to the composer.
const githubLinkSection = sourceBetween(
'// Case 1: user pasted a GH issue/PR URL.',
'// Case 1: user pasted a GH/GitLab/Jira URL.',
'// Case 2: user typed a raw issue number.'
)
expect(githubLinkSection).toContain('linkedWorkItem')
expect(githubLinkSection).toContain('initialGitHubWorkItem: item')

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

Assert the GitLab/Jira half that the title claims.

The test name states that GitLab and Jira stay raw URLs. Both assertions only cover the GitHub attachment. The GitLab/Jira guarantee is unverified, so a future change that attaches an entity for those providers would still pass.

Add an assertion that the GitLab/Jira branch passes only prefilledName.

💚 Proposed addition
     expect(githubLinkSection).toContain('linkedWorkItem')
     expect(githubLinkSection).toContain('initialGitHubWorkItem: item')
+    // Why: GitLab/Jira must reach the composer as a raw name, with no resolved entity attached.
+    const taskUrlSection = sourceBetween(
+      'if (taskUrlCreatePreview) {',
+      '// Case 2: user typed a raw issue number.'
+    )
+    expect(taskUrlSection).toContain('prefilledName: trimmed')
+    expect(taskUrlSection).not.toContain('linkedWorkItem')

Comment on lines +120 to +158
export function getCmdJTaskUrlCreatePreview(
intent: CmdJTaskSourceUrl
): CmdJTaskUrlCreatePreview | null {
if (intent.provider === 'linear') {
return null
}
if (intent.provider === 'github') {
const { slug, number, type } = intent.link
const repo = `${slug.owner}/${slug.repo}`
const kindLabel = type === 'pr' ? 'GitHub pull request' : 'GitHub issue'
return {
provider: 'github',
identifier: `#${number}`,
subtitle: repo,
kindLabel,
createLabel: `Create worktree from ${kindLabel} ${repo}#${number}`
}
}
if (intent.provider === 'gitlab') {
const { slug, number, type } = intent.link
const project = `${slug.host}/${slug.path}`
const kindLabel = type === 'mr' ? 'GitLab merge request' : 'GitLab issue'
const identifier = type === 'mr' ? `!${number}` : `#${number}`
return {
provider: 'gitlab',
identifier,
subtitle: project,
kindLabel,
createLabel: `Create worktree from ${kindLabel} ${project}${identifier}`
}
}
return {
provider: 'jira',
identifier: intent.parsed.issueKey,
subtitle: intent.parsed.origin.replace(/^https?:\/\//, ''),
kindLabel: 'Jira issue',
createLabel: `Create worktree from Jira issue ${intent.parsed.issueKey}`
}
}

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 | 🟠 Major | 🏗️ Heavy lift

Localize the preview labels.

getCmdJTaskUrlCreatePreview returns English-only kindLabel and createLabel. Both reach the UI unchanged. PaletteCreateWorktreeRow sets aria-label={previewLabel} from createLabel, and it interpolates kindLabel into the translated hint Create worktree from {{value0}}. A non-English user therefore sees a translated sentence with an English provider label inside it, and a fully English accessible label.

Return translation keys or provider tokens here, and resolve the display text in the row component with translate().

♻️ Proposed direction
 export type CmdJTaskUrlCreatePreview = {
   provider: 'github' | 'gitlab' | 'jira'
   identifier: string
   subtitle: string
-  createLabel: string
-  kindLabel: string
+  // Why: the row localizes these; keeping them as tokens stops English leaking into translated hints.
+  kind: 'github-issue' | 'github-pr' | 'gitlab-issue' | 'gitlab-mr' | 'jira-issue'
   loading?: boolean
 }

Then derive kindLabel and createLabel inside PaletteCreateWorktreeRow with translate(), and apply the resolved-title suffix there as well.

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix(workspaces): recognize pasted Linear issue URLs

* fix(workspaces): resolve legacy Linear URLs and keep typed-name fallback

Saved API-key Linear workspaces often omit organizationUrlKey, so pasted
issue URLs never called fetchLinearIssue. Probe those unknown-org
workspaces and accept only a matching issue URL.

Keep "Use … as workspace name" visible in Smart Entry when a Linear URL
owns the results. sourceIntent still focuses the issue row.

Co-authored-by: Orca <[email protected]>

* fix(workspaces): jump to existing worktrees from pasted task URLs

Cmd+J now treats GitHub, GitLab, Jira, and Linear issue/PR URLs as
decisive search, so pasting one lists already-linked worktrees first
and keeps a create preview underneath. GitHub/GitLab/Jira still hand
the raw URL to the composer for cross-project detection.

Co-authored-by: Orca <[email protected]>

* fix(workspaces): resolve GitHub issue titles in Cmd+J URL paste

Pasted GitHub issue/PR URLs now fetch the title for the create preview,
same as Linear. Existing linked worktrees stay selected first so Enter
jumps; create still hands the raw URL to the composer.

Co-authored-by: Orca <[email protected]>

* fix(workspaces): attach resolved GitHub items from Cmd+J create

Pasting a GitHub issue/PR URL into Cmd+J already previewed the title, but
Enter still opened the composer with the raw URL. Await the in-flight
lookup and hand the linked work item through, matching Linear and Task
page create. Also fix CI type, lint, and focus-routing source checks.

Co-authored-by: Orca <[email protected]>

* fix(workspaces): add Cmd+J task-URL locale keys

Unblock PR CI localization catalog checks and make the Linear lookup-miss
e2e wait out the resolving state before advancing to the agent field.

Co-authored-by: Orca <[email protected]>

---------

Co-authored-by: Orca <[email protected]>
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.

1 participant