Skip to content

fix(hub): repair mention search, prompt copying, and Inbox checks - #322

Open
arniebradfo wants to merge 7 commits into
build/hub/newfrom
fix/hub/review-and-kickoff
Open

arniebradfo wants to merge 7 commits into
build/hub/newfrom
fix/hub/review-and-kickoff

Conversation

@arniebradfo

Copy link
Copy Markdown
Collaborator

Why

Review mentions could miss collaborators outside the first batch. Viewing a repository was not enough to copy a prototype prompt, even though copying writes nothing. Live review and Inbox also made more GitHub permission requests than they needed.

Addresses #318, #317, and #315.

What changes

Mention suggestions search for the login you type and ignore older responses. Signed-in repository viewers can copy a kickoff prompt from Create or a saved template. If the fresh GitHub write-permission check prevents a Copilot handoff, viewers who still have repository access keep their brief and can copy it.

Hub shares overlapping GitHub permission checks for the same user and repository without caching the result. Opening or updating one Inbox notice checks only its repository. The Inbox list still verifies access and returns the total unread count, even when a badge refresh overlaps a read change.

Storybook screenshots

Components/Mention input — Matching Collaborator (Light, 1440 × 900)

Only the matching collaborator appears for the typed login.

Hub/Pages/Repositories/Create — Copy Prompt As Viewer (Light, 1440 × 900)

A repository viewer can copy a brief without opening Copilot.

Hub/Pages/Replica Browse — Copy Template Prompt As Viewer (Light, 1440 × 900)

A repository viewer can copy a prepared brief from a saved template.

Hub/Pages/Repositories/Create — Copy After Handoff Denied (Light, 1440 × 900)

Create keeps the brief and offers Copy prompt after the handoff is denied.

Hub/Pages/Replica Browse — Copy Template After Handoff Denied (Light, 1440 × 900)

The template stays open with the brief and a Copy prompt action after denial.

Hub/Pages/Notifications — Cached Refresh (Light, 1440 × 900)

The Inbox still shows the remaining unread count after marking one notice read.

Existing mention and local Create states

Components/Mention input — People (Light, 1440 × 900)

Typing an at sign opens a list of eligible collaborators.

Components/Mention input — Plain Text (Light, 1440 × 900)

A comment with no mention query shows only the text field.

Hub/Pages/Repositories/Create — Local (Light, 1440 × 900)

Local Create still offers Copy prompt.

arniebradfo and others added 7 commits November 19, 2026 20:14
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@arniebradfo
arniebradfo requested review from a team and nshki as code owners November 20, 2026 04:45
Copilot AI adaptive review requested due to automatic review settings November 20, 2026 04:45

Copilot AI 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.

🟡 Changes recommended

Required canvas extension assets were not rebuilt, and unresolved mention filtering and Enter handling can insert the wrong collaborator or submit unfinished replies.

9 open issues
What changed in this PR

Repairs Hub’s mention search, prompt-copying flow, and Inbox permission checks, addressing #318, #317, and #315.

Changes:

  • Searches mentions using the typed login and ignores outdated responses.
  • Lets repository viewers copy kickoff prompts, including after a denied Copilot handoff.
  • Shares overlapping GitHub permission checks, scopes single-notice operations, and updates Inbox count handling.
File Description
hub/​server/​routes/​api/​review-comments/​create-review-realtime-access/​index.ts Rechecks the session after authorization.
hub/​server/​routes/​api/​review-comments/​collaboration.db.test.ts Covers scoped Inbox checks and access revocation.
hub/​server/​routes/​api/​repositories/​templates/​index.ts Offers prompt copying to repository viewers.
hub/​server/​routes/​api/​repositories/​templates/​index.db.test.ts Covers viewer access and handoff fallback.
hub/​server/​routes/​api/​product/​create-product-route-dependencies/​index.ts Uses read checks and rechecks repository visibility.
hub/​server/​repositories/​review-comments/​inbox-queries/​index.ts Filters repository checks by notice ID.
hub/​server/​integrations/​github/​create-review-directory/​types.ts Defines the read-permission check.
hub/​server/​integrations/​github/​create-review-directory/​index.ts Shares in-progress permission checks.
hub/​server/​integrations/​github/​create-review-directory/​index.test.ts Covers shared checks, revocation, and renamed users.
hub/​server/​domains/​review-comments/​create-review-inbox/​index.ts Scopes notice operations to their repository.
hub/​docs/​websockets.md Documents overlapping permission checks.
hub/​docs/​review-collaboration.md Documents mention search and Inbox responses.
hub/​docs/​frontend.md Documents viewer copying and handoff fallback.
hub/​client/​utils/​notification/​schemas.ts Makes update-response unread counts optional.
hub/​client/​utils/​notification/​read-updates.ts Adds timing to read-change events.
hub/​client/​pages/​replica-browse-page/​stories.tsx Adds viewer-copy and denied-handoff stories.
hub/​client/​pages/​replica-browse-page/​index.tsx Offers template prompt copying after denial.
hub/​client/​pages/​replica-browse-page/​index.test.tsx Covers template prompt-copy fallback.
hub/​client/​pages/​notifications-page/​stories.tsx Updates the Inbox response fixture.
hub/​client/​pages/​new-prototype-page/​types.ts Adds copy-specific prompt instructions.
hub/​client/​pages/​new-prototype-page/​stories.tsx Adds viewer-copy and denied-handoff stories.
hub/​client/​pages/​new-prototype-page/​index.tsx Preserves briefs and offers copy fallback.
hub/​client/​pages/​new-prototype-page/​index.test.tsx Covers copying after handoff denial.
hub/​client/​hooks/​use-notification-inbox/​index.ts Coordinates read updates and count refreshes.
hub/​client/​hooks/​use-notification-inbox/​index.test.tsx Covers overlapping count and read responses.
hub/​client/​hooks/​use-mention-source/​context.ts Adds query and cancellation arguments.
hub/​client/​hooks/​use-copilot-handoff/​index.ts Supports an explicit copy fallback.
hub/​client/​components/​mention-input/​stories.tsx Adds a matching-collaborator story.
hub/​client/​components/​mention-input/​index.tsx Loads suggestions for the current query.
hub/​client/​components/​mention-input/​index.test.tsx Covers later collaborators and stale responses.
hub/​client/​application/​hub/​view-models/​product-new-data/​index.ts Separates Copilot and copy instructions.
hub/​client/​application/​hub/​screens/​prototype-screen/​index.tsx Sends mention queries and cancellation signals.
hub/​client/​application/​hub/​screens/​prototype-screen/​index.test.tsx Verifies query forwarding to the API.
hub/​client/​application/​hub/​routes/​product-new/​index.tsx Enables copy fallback for Create.
hub/​client/​application/​hub/​routes/​product-browse/​index.tsx Enables copy fallback for templates.
hub/​client/​application/​hub/​requests/​authorize-copilot-handoff/​index.ts Recognizes explicitly authorized copy fallback.
hub/​client/​application/​hub/​requests/​authorize-copilot-handoff/​index.test.ts Covers fallback authorization boundaries.
hub/​client/​application/​hub/​requests/​acknowledge-inbox-activity/​index.ts Includes read-start timing in notifications.

Review effort: Max (adaptive)

Comment on lines +56 to +59
void source.load(query, request.signal).then(
(candidates) => {
if (!request.signal.aborted)
setResult({ source, query, retry, candidates, failed: false })
Comment on lines +68 to +69
url.searchParams.set("q", query)
const { candidates } = await requestJson(url, MENTION_CANDIDATES_SCHEMA, { signal })
Comment on lines +39 to +42
const current =
result?.source === source && result.query === query && result.retry === retry ? result : null
const failed = current?.failed
const waiting = current === null
result?.source === source && result.query === query && result.retry === retry ? result : null
const failed = current?.failed
const waiting = current === null
const suggestions = current?.candidates.slice(0, 8) ?? []
Comment on lines +53 to +56
const request = new AbortController()
const timer = window.setTimeout(() => {
setLoading(true)
void source
.load()
.then(
(people) => {
if (active) setResult({ source, candidates: people, failed: false })
},
() => {
if (active) setResult({ source, candidates: [], failed: true })
},
)
.finally(() => {
if (active) setLoading(false)
})
setResult(null)
void source.load(query, request.signal).then(
Comment on lines +192 to +195
const delta = current?.read === saved.read ? 0 : saved.read ? -1 : 1
const count = updateCount
? (saved.unreadCount ?? Math.max(0, unreadCount + delta))
: unreadCount
}

describe("NewPrototypePage()", () => {
it("offers a deliberate copy when fresh authorization denies Copilot but still allows viewing", async () => {
<HubToast title={copy.copiedLabel} />
{handoffUnavailable && !submissionDisabled ? (
<HubAlert
title="Copilot isn’t available for this repository. You can still copy the prompt."
Comment on lines 258 to +259
permission.mockResolvedValue("write")
expect(await (await read()).json()).toMatchObject({
expect(await (await read("/create/permission")).json()).toMatchObject({ canCreate: true })
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.

2 participants