Skip to content

fix(gitlab): find issues and #N in the new-workspace gitlab source - #32005

Merged
AmoabaKelvin merged 3 commits into
mainfrom
gitlab-new-workspace-issues
Oct 22, 2026
Merged

AmoabaKelvin merged 3 commits into
mainfrom
gitlab-new-workspace-issues

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​47 $\color{#cf222e}{\Huge{\mathbf{−}}}$​12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​35
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​139 $\color{#cf222e}{\Huge{\mathbf{−}}}$​99 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​40

ELI5

In the new-workspace dialog, the GitLab source only ever found merge requests. Typing a word or #23 never found issues. It now finds both, like the GitHub source next to it.

What Changed

  • Before: the GitLab source listed typed queries with the MR-only listMRs, so a project with issues and no matching MRs showed an empty list. Only a pasted issue URL found an issue.
  • After: the dialog uses the existing combined listWorkItems (MRs + issues, merged and sorted by update time). It goes through the same gitLabApiFor routing, so local, SSH and paired-runtime repos all work. Cmd-J and mobile already use this query. The MR-only renderer helper is gone; listMRs itself stays for the Tasks page.
  • #23 now finds issue 23. GitLab's REST search param matches title and description text only (on gitlab-org/cli, search=#1000 returns 13 issues and none of them is [Feature]: Support idempotent distros #1000; iids[]=1000 returns it). So fetchIssuesAsWorkItems sends a #N query as iids[]=N. That's GitLab's own issue reference syntax. MRs keep the text search, which still surfaces MRs that mention #23.
  • The Merged chip still skips issues (listWorkItems drops the issue fetch for merged), and the hook still cuts the merged list to RESULT_LIMIT.

Why

Root cause: use-smart-workspace-gitlab-search.ts called the MR-only list, and GitLab's text search can't match an issue number. Swapping the call fixes words. The #N rule lives in main's issue fetch, the one place the dialog, Cmd-J and mobile all reach, so they all get it.

Compatibility: no new IPC/RPC method or field. gitlab.listWorkItems has existed since #2452, so a new desktop works with older paired servers. An older server just text-searches #N.

Remote names: listMRs had a cwd glab mr list fallback for local repos where no origin/upstream GitLab project resolves, for example a GitLab remote named gitlab. listWorkItems had no such fallback, so on its own the swap would have lost those MRs. I didn't move the cwd fallback: the dialog shows the GitLab source for every repo when glab is installed, so it spawned glab mr list on every debounced query for every GitHub repo, and moving it would bring that to Cmd-J and mobile. The fix is in project detection instead. When origin and upstream don't resolve, getIssueProjectRef tries the repo's other remotes through the same cached getProjectRefForRemote probe. A remote named gitlab goes first, matching glab's own remoteNameSortScore. Every caller of the default issue source gets this: the dialog, Cmd-J, mobile, issue details and updates. It adds no glab spawn for GitHub repos. The remote list is cached, the extra remotes reuse the per-host auth memo that origin already filled, and SSH repos list no remotes here, which is what the old fallback did too. I moved the preference resolver out of gitlab-project-ref-resolution.ts into gitlab-issue-source-resolution.ts to keep that file under the 300-line limit.

Linked Issue

Fixes #31218

Linear: STA-11422

Visual Proof

Real dev build against the public gitlab-org/cli project (local clone, glab 1.124.0), GitLab source, Open chip.

BEFORE (main) AFTER
release before-release.png after-release-scrolled.png
#8644 before-hash8644.png after-hash8644.png

release before: 12 rows, all MRs (the shot is scrolled to the end of the list). After: 6 MRs, then issues #8651, #8649, #1165, #7675, #8644, #7859. #8644 before: empty. After: the issue.

Testing

  • I manually tested these changes locally: hidden dev build on macOS over CDP, BEFORE on main's files and AFTER on this branch, with real glab against gitlab.com. Word search returns MRs and issues; #8644 returns the issue; the Merged chip returns 12 rows, all MRs.
  • Automated tests added/updated: new client-work-items.test.ts case pins #N to iids[] (fails without the fix). The source-lookup routing tests now pin listWorkItems over runtime RPC and local IPC. New gl-utils.test.ts cases: a GitHub origin with GitLab remotes a-fork and gitlab resolves gitlab (fails without the fix, and fails without the gitlab-first order), and a GitHub-only repo with an extra remote adds no glab probe.

SSH and Windows were not run by hand. The issue fetch already runs on the owning host (glabRepoExecOptions / glabHostnameArgs), and the request path already carries ? and &, so iids[] adds no new quoting.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Follow-ups, not in this PR: !N (GitLab's MR reference) still text-searches MRs. Project detection doesn't expand SSH host aliases (git@gitlab-work:group/repo.git with an ~/.ssh/config alias). The old cwd fallback let glab expand them, so the dialog loses MR results for those checkouts, the same as Cmd-J and mobile today.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • 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)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@AmoabaKelvin
AmoabaKelvin marked this pull request as ready for review October 22, 2026 21:58
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

The new-workspace GitLab search now lists work items instead of only merge requests. Exact numeric issue references use the GitLab iids[] filter, while other nonempty queries use text search. Issue-source resolution now handles upstream and origin preferences and searches other remotes when needed.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: 🟡 Moderate · up to cf246

GitLab work-item search cannot find a project through a connection, including when a GitLab remote is available. Connection-aware remote discovery should be fixed before merging unless that limitation is explicitly accepted.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: GitLab now finds issues and #N references in the new-workspace source.
Description check Passed The description is complete and aligned with the template. It explains the user impact, implementation, rationale, linked issue, visual proof, testing, compatibility considerations, follow-ups, and ch…
Linked Issues check Passed Issue #31218 requires GitLab typed searches to return merge requests and issues, including exact #N searches, while preserving existing routing and the Merged behavior. The hook now calls `listWorkI…
Out of Scope Changes check Passed The project-resolution changes remain connected to issue #31218. They preserve GitLab source resolution after replacing the MR-only query and support repositories whose GitLab remote is not named `ori…
Full details: Description check

Explanation

The description is complete and aligned with the template. It explains the user impact, implementation, rationale, linked issue, visual proof, testing, compatibility considerations, follow-ups, and checklist status.

Full details: Linked Issues check

Explanation

Issue #31218 requires GitLab typed searches to return merge requests and issues, including exact #N searches, while preserving existing routing and the Merged behavior. The hook now calls listWorkItems through gitLabApiFor. listWorkItems skips issue reads for merged. issueSearchParam maps an exact #N query to iids[]=N and uses text search for other queries. The tests cover #N encoding and runtime RPC and local IPC routing. No new IPC or RPC method is added.

Full details: Out of Scope Changes check

Explanation

The project-resolution changes remain connected to issue #31218. They preserve GitLab source resolution after replacing the MR-only query and support repositories whose GitLab remote is not named origin or upstream. The tests cover GitLab remote preference and the absence of an extra glab probe for GitHub-only repositories. The remaining changes are focused on the linked search behavior and its routing.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0cb74413-c73c-4599-aeaf-8a406c849340
📥 Commits

Reviewing files that changed from the base of the PR and between 4dd97f0 and cf24635.

📒 Files selected for processing: 9
  • src/main/gitlab/client-work-items.test.ts
  • src/main/gitlab/gitlab-issue-source-resolution.ts
  • src/main/gitlab/gitlab-project-ref-resolution.ts
  • src/main/gitlab/gl-utils.test.ts
  • src/main/gitlab/gl-utils.ts
  • src/main/gitlab/work-item-queries.ts
  • src/renderer/src/components/new-workspace/use-smart-workspace-gitlab-search.ts
  • src/renderer/src/lib/gitlab-work-item-source-lookup.test.ts
  • src/renderer/src/lib/gitlab-work-item-source-lookup.ts
💤 Files with no reviewable changes: 1
  • src/main/gitlab/gitlab-project-ref-resolution.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@AmoabaKelvin
AmoabaKelvin merged commit c69e831 into main Oct 22, 2026
59 checks passed
@AmoabaKelvin
AmoabaKelvin deleted the gitlab-new-workspace-issues branch October 22, 2026 22:37
OrcaWin added a commit that referenced this pull request Nov 8, 2026
… sign-in probe and onboarding trust prompt

- setup-script-import: imported setups are saved from the Review setup
  script dialog since #37937.
- github-url-smart-input-transition: the GitLab source lists through
  gitlab:listWorkItems since #32005, so stub that channel.
- structured-chat-tabs-open-close: the Claude catalog probe also sends an
  initialize request for sign-in discovery since #37191.
- golden-core-flows: onboarding launches the chosen agent in the fresh ~
  workspace (#37898), whose first launch asks the per-repo agent folder
  trust question (#38946); answer it before adding a project.
OrcaWin added a commit that referenced this pull request Nov 8, 2026
… sign-in probe and onboarding trust prompt (#39983)

- setup-script-import: imported setups are saved from the Review setup
  script dialog since #37937.
- github-url-smart-input-transition: the GitLab source lists through
  gitlab:listWorkItems since #32005, so stub that channel.
- structured-chat-tabs-open-close: the Claude catalog probe also sends an
  initialize request for sign-in discovery since #37191.
- golden-core-flows: onboarding launches the chosen agent in the fresh ~
  workspace (#37898), whose first launch asks the per-repo agent folder
  trust question (#38946); answer it before adding a project.

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
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.

[Bug]: New-workspace GitLab search only searches merge requests, never issues

1 participant