Repository navigation
fix(naming): lead workspace and tab names with the work-item identifier - #8238
Conversation
Auto-generated workspace names, branch-rename display names, and tab titles now lead with the referenced PR/MR/issue/ticket — e.g. `PR 1033 - Review` instead of a paraphrase like "Review community pr 1094" that buried or dropped the number. Identifiers are the highest- signal, most searchable token, so leading with them makes the sidebar and tabs scannable and disambiguates same-verb work items. - New shared `work-item-reference.ts` extracts the identifier from the raw prompt: URLs are validated by path structure (owner/repo/pull/N, GitLab's `/-/` marker) so GitHub Enterprise / self-hosted GitLab still resolve while stray `/pull/<n>` paths (CDN, docs) do not; a ticket- prefix denylist keeps `SHA-256` / `UTF-8` / `ISO-8601` from being read as Jira/Linear keys. - Reconciles the existing create-from-work-item naming (was action-first `Review PR 1033`) with the first-work auto-rename onto one identifier- first format via a shared `formatIdentifierFirst`, so the two paths can't drift. - Fixes a pre-existing tab-title bug where markdown punctuation was stripped before URLs, splitting a GitLab `merge_requests` URL at its underscore and leaking "requests" into the title.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughAdds shared parsing for work identifiers from provider URLs, textual references, ticket keys, and numeric references. Updates generated agent tab titles to place extracted identifiers before cleaned descriptions. Changes workspace intent names and auto-renamed workspace display names to use identifier-first formatting, action words from branch slugs, and collision suffixes. Updates related tests for issue, PR, MR, URL, ticket, and fallback naming cases. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
The URL/markdown strip reorder left the tab-title URL strip anchored on \b, which fails when a URL is wrapped in markdown emphasis (_...pull/5_) and leaked URL fragments into the title. Drop the \b anchor and trim trailing markdown emphasis (*_~) in the URL identifier parser, keeping interior underscores (merge_requests) intact. Adds regression tests. Co-authored-by: Orca <[email protected]>
AmethystLiang
left a comment
There was a problem hiding this comment.
Thanks Trevin — solid, well-tested change. Verified the identifier-first output across the sidebar, tab titles, and create-from-linked-item, plus the parser's path-structure URL validation (GHE/self-hosted GitLab safe) and the ticket denylist keeping SHA-256/RFC-2616 off the ticket path.
One fix on review, pushed as a follow-up commit: a markdown-emphasis-wrapped URL (_…/pull/5_) was leaking URL fragments into the tab title after the URL/markdown strip reorder — the \b anchor in the tab-title URL strip fails when the URL is preceded by _. Dropped the anchor and extended the URL parser's trailing-trim to markdown emphasis (*_~), keeping interior underscores (merge_requests) intact. Added two regression tests (both fail on revert).
Validation: typecheck + lint clean, 66 unit tests green, and a perf pass confirmed the tab-title hot path stays within the 512/4096-char scan bounds with no ReDoS risk.
* fix: work-item naming, usage % rounding, and terminal/delete copy Address prod-release-scan P2s: - #8238: recognize Bitbucket Server (/projects|users/.../repos/.../pull-requests/N) and Azure DevOps (/_git/REPO/pullrequest/N) PR URL shapes in work-item-reference, alongside Bitbucket Cloud; graceful fallback preserved. - #7574: getDisplayedUsagePercentage now rounds the used value before taking the `remaining` complement, so the compact status bar (raw usedPercent) and tooltip (pre-rounded clampUsedPercent) can no longer disagree by 1% at a .5 fraction. clampUsedPercent moves to the shared module as the single rounding source. - #7459: mixed remote+local batch delete confirm no longer claims the whole batch is a permanent "remote host" delete — it now states remote items are permanent while local items move to the Trash/Recycle Bin. - #8322: right-click-to-paste settings copy is platform-aware — "Control-click" on macOS, "Ctrl+right-click" on Windows/Linux — matching the ctrlKey gate. Localization catalog synced (also picks up pre-existing UsagePercentageDisplayChangeNotice drift). * Fix NaN% usage bar and label for non-finite provider values Non-finite usedPercent inputs (NaN/Infinity) propagated through Math.round/min/max into the CSS bar width (`NaN%`) and displayed copy. clampUsedPercent now short-circuits to 0 in that case, with a test covering the divergence from getDisplayedUsagePercentage for the 'remaining' case.
* fix(naming): remove identifier-first name post-processing Workspace display names and tab titles were being rewritten after generation by prompt-scanning heuristics from #8238 — a stray "#1" in prose became a workspace named "#1 - Fix", and the rewrite ran downstream of generation so user naming instructions couldn't override it. Per the same principle as #9088, naming defaults stay minimal and user overrides own the style. - Delete work-item-reference.ts and display-name-from-work.ts (+tests). - Auto-rename display names return to the humanized branch slug; tab titles return to the cleaned first prompt clause. - Explicit create-from-work-item naming returns to action-first ("Review PR 1234"). - Keep #8238's URL-before-markdown strip-order bugfix in tab titles, with regression tests adjusted to the natural expectations. * test(naming): pin incidental marker regression
…er (stablyai#8238) * fix(naming): lead workspace and tab names with the work-item identifier Auto-generated workspace names, branch-rename display names, and tab titles now lead with the referenced PR/MR/issue/ticket — e.g. `PR 1033 - Review` instead of a paraphrase like "Review community pr 1094" that buried or dropped the number. Identifiers are the highest- signal, most searchable token, so leading with them makes the sidebar and tabs scannable and disambiguates same-verb work items. - New shared `work-item-reference.ts` extracts the identifier from the raw prompt: URLs are validated by path structure (owner/repo/pull/N, GitLab's `/-/` marker) so GitHub Enterprise / self-hosted GitLab still resolve while stray `/pull/<n>` paths (CDN, docs) do not; a ticket- prefix denylist keeps `SHA-256` / `UTF-8` / `ISO-8601` from being read as Jira/Linear keys. - Reconciles the existing create-from-work-item naming (was action-first `Review PR 1033`) with the first-work auto-rename onto one identifier- first format via a shared `formatIdentifierFirst`, so the two paths can't drift. - Fixes a pre-existing tab-title bug where markdown punctuation was stripped before URLs, splitting a GitLab `merge_requests` URL at its underscore and leaking "requests" into the title. * fix(naming): keep emphasis-wrapped URLs intact in generated names The URL/markdown strip reorder left the tab-title URL strip anchored on \b, which fails when a URL is wrapped in markdown emphasis (_...pull/5_) and leaked URL fragments into the title. Drop the \b anchor and trim trailing markdown emphasis (*_~) in the URL identifier parser, keeping interior underscores (merge_requests) intact. Adds regression tests. Co-authored-by: Orca <[email protected]> --------- Co-authored-by: Jinjing <[email protected]> Co-authored-by: Orca <[email protected]>
* fix: work-item naming, usage % rounding, and terminal/delete copy Address prod-release-scan P2s: - stablyai#8238: recognize Bitbucket Server (/projects|users/.../repos/.../pull-requests/N) and Azure DevOps (/_git/REPO/pullrequest/N) PR URL shapes in work-item-reference, alongside Bitbucket Cloud; graceful fallback preserved. - stablyai#7574: getDisplayedUsagePercentage now rounds the used value before taking the `remaining` complement, so the compact status bar (raw usedPercent) and tooltip (pre-rounded clampUsedPercent) can no longer disagree by 1% at a .5 fraction. clampUsedPercent moves to the shared module as the single rounding source. - stablyai#7459: mixed remote+local batch delete confirm no longer claims the whole batch is a permanent "remote host" delete — it now states remote items are permanent while local items move to the Trash/Recycle Bin. - stablyai#8322: right-click-to-paste settings copy is platform-aware — "Control-click" on macOS, "Ctrl+right-click" on Windows/Linux — matching the ctrlKey gate. Localization catalog synced (also picks up pre-existing UsagePercentageDisplayChangeNotice drift). * Fix NaN% usage bar and label for non-finite provider values Non-finite usedPercent inputs (NaN/Infinity) propagated through Math.round/min/max into the CSS bar width (`NaN%`) and displayed copy. clampUsedPercent now short-circuits to 0 in that case, with a test covering the divergence from getDisplayedUsagePercentage for the 'remaining' case.
) * fix(naming): remove identifier-first name post-processing Workspace display names and tab titles were being rewritten after generation by prompt-scanning heuristics from stablyai#8238 — a stray "stablyai#1" in prose became a workspace named "stablyai#1 - Fix", and the rewrite ran downstream of generation so user naming instructions couldn't override it. Per the same principle as stablyai#9088, naming defaults stay minimal and user overrides own the style. - Delete work-item-reference.ts and display-name-from-work.ts (+tests). - Auto-rename display names return to the humanized branch slug; tab titles return to the cleaned first prompt clause. - Explicit create-from-work-item naming returns to action-first ("Review PR 1234"). - Keep stablyai#8238's URL-before-markdown strip-order bugfix in tab titles, with regression tests adjusted to the natural expectations. * test(naming): pin incidental marker regression
Summary
Auto-generated names now lead with the PR/MR/issue/ticket they reference. Before, first-work auto-rename and tab titles ran the prompt through a summarizer that buried or dropped the identifier: a prompt like "review this community PR …/pull/1094" became
Review community pr 1094as a workspace name andReview this community PRas a tab title (number gone). The identifier is the highest-signal, most searchable token, so the sidebar and tabs now lead with it — and stay consistent across every surface.Review community pr 1094PR 1094 - ReviewReview PR 1234(action-first)PR 1234 - ReviewReview this community PR(number lost)PR 1094 - Review this communityFix Issue 2635ENG-456 - FixDecisions a reviewer should weigh:
src/shared/work-item-reference.ts) extracts the identifier from the raw prompt. URLs are validated by path structure (owner/repo/pull/N, GitLab's/-/marker, Bitbucketpull-requests/N) rather than hostname — matching the existinggithub-links.ts/gitlab-links.tsapproach, so GitHub Enterprise and self-hosted GitLab keep working while a straycdn.example.com/assets/pull/2023/…path no longer mis-reads as a PR.SHA-256,UTF-8,ISO-8601,RFC-2616) aren't mistaken for Jira/Linear keys — a real hazard in a coding tool. It keeps scanning past a denylisted token, soAES-256 … ENG-99still resolvesENG-99.Review PR 1234; first-work auto-rename now produces identifier-firstPR 1234 - Review. Both route through a sharedformatIdentifierFirstso they can't drift (they had already diverged). This changes the branch/folder seed for create-from-linked-item (review-pr-1234→pr-1234-review); no code depends on the old seed._) was stripped before URLs, so a GitLab…/merge_requests/42URL split at its underscore and leakedrequestsinto the title. URLs are now stripped first.Inherent limits (best-effort, user can rename): a PR mentioned as context rather than the subject ("following PR 1033, build X") still leads with
PR 1033, and multiple identifiers in one prompt resolve to the first by precedence.Screenshots
No visual/layout change. The change is the generated name text in the sidebar and on tabs — see the before/after table above. Auto-generation is prompt-driven and not meaningfully screenshot-able as a static image; the behavior is pinned by unit tests instead.
Testing
pnpm lint— passes for everything this PR touches (oxlint, oxfmt, max-lines ratchet, reliability gates all clean). The only failure is a pre-existing, unrelatedja.jsonlocalization-parity mismatch (components.native-chat.composer.uploadingAttachments); this PR touches no locale catalogs or native-chat code.pnpm typecheck— full (node + cli + web), clean.pnpm test— all affected suites green (117 tests):work-item-reference,display-name-from-work,agent-tab-title,workspace-name,branch-name-from-work,agent-generated-tab-title,launch-work-item-direct,github-work-item-background-create. Full suite runs in CI.pnpm build— not run locally; the full three-project typecheck stands in as the compile check.work-item-reference.test.tsanddisplay-name-from-work.test.ts; updated tab-title, workspace-name, and work-item caller tests to the new format.AI Review Report
Ran a multi-agent review (three independent reviewers — reuse, quality, efficiency — over two rounds) plus manual analysis. Risks checked and outcomes:
github-links.ts/gitlab-links.tscan't be imported fromsrc/shared(dependency direction), so the shared parser mirrors their path-structure validation; consolidating the renderer pickers onto it is noted as follow-up.SHA-256/UTF-8; added the denylist and host-structure URL validation (rejects CDN/doc lookalikes).<id> - <detail>format hand-written in three places (root cause of the action-vs-identifier-first inconsistency); centralized informatIdentifierFirst..toUpperCase()no-op and a redundant capitalize call.Cross-platform (macOS/Linux/Windows): explicitly checked. Pure string/regex logic in
src/shared+src/main— no filesystem paths, no shell/child-process execution, no keyboard shortcuts ormetaKey/accelerators, nonavigator/UA branching, no Electron platform APIs. Nothing platform-dependent was touched.Security Audit
The parser consumes untrusted prompt text. Reviewed:
RegExpinstripWorkIdentifierEcho— built only from identifier tokens that are controlled lowercase-alphanumeric strings (pr/mr/digits/ticket keys), never raw user text, so no injection.new URL()on arbitrary substrings — wrapped in try/catch; failures fall through.slugify/sanitizeBranchSlugsanitizers, so nothing new reaches git refs unsanitized.No command execution, path handling, auth, secrets, dependency, or IPC surface is involved. No follow-up required.
Notes
review-pr-1234→pr-1234-review) as a consequence of the identifier-first reconciliation. Cosmetic; no code depends on the old seed string.github-links.ts/gitlab-links.tspickers onto the sharedwork-item-reference.tsparser to remove the remaining path-parsing overlap (left out here to limit blast radius; ~11 importers).