Skip to content

Add repo mention type to workbenches - #3971

Open
michaeljguarino wants to merge 10 commits into
masterfrom
repo-mention-wb
Open

Add repo mention type to workbenches#3971
michaeljguarino wants to merge 10 commits into
masterfrom
repo-mention-wb

Conversation

@michaeljguarino

@michaeljguarino michaeljguarino commented Aug 5, 2026

Copy link
Copy Markdown
Member

This provides some basic logic for a stylized repo mention, fetching repo urls from either the agent runtimes history list or the allowed repositories in the wb.

Test Plan

Test environment: https://console.plrldemo.onplural.sh/cd/clusters/a1748282-ce8b-48ab-ae7e-326e74fce04e/services/f3f89a54-d1a7-4bc8-9152-daa07ede918d/components

Checklist

  • I have added a meaningful title and summary to convey the impact of this PR to a user.
  • If required, I have updated the Plural documentation accordingly.
  • I have added tests to cover my changes.
  • I have deployed the agent to a test environment and verified that it works as expected (required only when changing agent code).

Plural Flow: console

@michaeljguarino
michaeljguarino requested a review from a team August 5, 2026 19:59
@michaeljguarino michaeljguarino added the enhancement New feature or request label Aug 5, 2026
@soffi-ai

soffi-ai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Soffi AI Summary

This PR adds a repository mention type to the AI workbench chat input, enabling users to reference Git repositories inline when composing prompts. The feature fetches candidate repository URLs from two sources — the workbench's configured coding repositories (configuration.coding.repositories) and the agent runtime's allowedRepositories history — with workbench-level configuration taking precedence over runtime history when both are present.

Key changes include:

  • A new RepositoryChipAttrs mention kind and repositoryMention.ts module that defines how repo mentions are rendered, parsed, and displayed as styled chips in the markdown renderer.
  • Extended useMentionDataSources to query agentRunRepositories and merge/filter against workbench-allowed repositories, surfacing them in the @ autocomplete dropdown.
  • The "Send to Workbench" insight flow and AISuggestFix now pass the selected workbench's repository source context so the correct repositories appear in autocomplete.
  • The workbench jobs search dropdown was migrated from absolute CSS positioning to @floating-ui/react (FloatingPortal + useFloatingDropdown) so it renders in a portal above stacking contexts and doesn't get clipped.
  • Agent run message output streaming improvements and better expiration jitter for background jobs.
  • Workbench-level permission enforcement on jobs.
  • Insights for resources that have an associated workbench are now routed directly to that workbench rather than requiring manual selection.
  • Mantle routing support added to the AI proxy.
  • Helm values fetching in the service settings UI was refactored for correctness and consistency.

Commits

Commit Summary
9d91237 Introduces the core repository mention feature: new RepositoryChipAttrs type, repositoryMention.ts module, autocomplete data source integration, and styled chip rendering in the markdown renderer.
98b9e5e CI fix — minor correction to unblock the pipeline after the initial feature commit.
1794a22 Addresses review feedback: refines repository source precedence logic (workbench config overrides runtime), adds unit tests for repositoryMention parsing and insightWorkbenchPrompt, and cleans up component prop threading.
980f8b1 Refactors Helm values fetching in service settings to remove duplication and improve consistency between the settings panel and update dialog.
c533233 Adds streaming output support for agent run messages in the workbench, improving real-time feedback during job execution.
8122a45 Enforces workbench-level permissions on job creation, preventing unauthorized users from triggering workbench jobs.
51027b2 Improves expiration jitter for background job scheduling to reduce thundering-herd effects on token/session expiry.
73bad5d Automatically routes insights that have an associated workbench directly to that workbench, skipping the manual workbench-selection step.
b9aaa11 Fixes a UI flash/flicker issue in the workbench or insight send flow.
3174dbc Adds Mantle routing support to the AI proxy, extending the set of LLM providers it can route to.

Deploy in Soffi


Updated: 2026-08-06 15:46 UTC

@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds repository mentions to workbench rich-text prompts, deriving suggestions from configured repository allowlists or prior agent-run history and rendering provider-specific chips.

  • Extends mention schemas, serialization, autocomplete results, and Markdown rendering with a repository kind.
  • Passes workbench repository configuration into job prompt inputs and updates relevant GraphQL fragments and generated artifacts.
  • Moves workbench job search results into a floating portal.

Confidence Score: 4/5

This PR should not merge until the global repository-history disclosure and the prompt-form outlet-context crashes are fixed.

The repository fallback can expose URLs from unrelated agent runs, while three existing form route families render the updated prompt component without the outlet context it now requires.

Files Needing Attention: assets/src/components/ai/chatbot/input/autocomplete/useMentionDataSources.ts; assets/src/components/workbenches/workbench/WorkbenchPromptRichInput.tsx

Important Files Changed

Filename Overview
assets/src/components/ai/chatbot/input/autocomplete/useMentionDataSources.ts Adds configured and historical repository suggestions, but the history fallback exposes globally unscoped repository records.
assets/src/components/workbenches/workbench/WorkbenchPromptRichInput.tsx Sources repository configuration from outlet context, causing callers outside the Workbench outlet to crash during rendering.
assets/src/components/ai/chatbot/input/autocomplete/mentionTypes.ts Adds the repository mention kind, attributes, labels, and chip schema consistently.
assets/src/components/ai/chatbot/input/autocomplete/repositoryMention.ts Normalizes repository URLs and derives provider and display metadata for supported SCM hosts.
assets/src/components/ai/chatbot/input/autocomplete/PlrlChipMdRenderers.tsx Adds repository chip rendering with provider-specific icons and a generic fallback.
assets/src/components/workbenches/workbench/WorkbenchJobsSearch.tsx Ports the search dropdown to the shared floating positioning and portal infrastructure without an accepted defect.
assets/src/graph/workbench.graphql Fetches repository allowlists needed by workbench and job prompt autocomplete paths.

Reviews (1): Last reviewed commit: "Add repo mention type to workbenches" | Re-trigger Greptile

Comment on lines +120 to +122
} = useAgentRunRepositoriesQuery({
variables: { q: throttled || undefined },
skip: !wantsAt || !workbenchId || allowedRepositories !== 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.

P1 security Global repository history leaks

When both workbench and runtime repository lists are null, this fallback sends only q to a resolver that reads the global repository-history table without workbench, user, or tenant filtering, exposing unrelated repository URLs in autocomplete. How this was verified: The query path was traced to AgentRunRepository.ordered() with no row-level scope applied.

syncKey?: string
wrapperStyles?: ComponentProps<typeof ChatInputSimple>['wrapperStyles']
}) {
const { workbench } = useOutletContext<WorkbenchOutletContext>()

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.

P1 Sibling form routes lose context

When cron schedule, chatbot, or webhook trigger forms render this input, they are sibling routes rather than children of the context-providing Workbench outlet, so destructuring the undefined outlet context crashes the form.

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot

plural-copilot Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

GitOps deployment PR: https://github.com/pluralsh/plrl-up-demos/pull/2535

It updates the console image tag to sha-ab1e24c for PR #3971 head.

@michaeljguarino
michaeljguarino force-pushed the repo-mention-wb branch 2 times, most recently from ef1ba25 to a74d51e Compare August 5, 2026 21:04
@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot

plural-copilot Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Deployment GitOps PR: https://github.com/pluralsh/plrl-up-demos/pull/2541 — pins the demo console image to sha-6be895d for this PR.

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot

plural-copilot Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Demo GitOps deployment PR has been created: https://github.com/pluralsh/plrl-up-demos/pull/2542

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot

plural-copilot Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Deployment GitOps PR: https://github.com/pluralsh/plrl-up-demos/pull/2543

It pins console to sha-90e44fc from this PR head and is ready for review/merge.

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot

plural-copilot Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

The deploy GitOps PR has been created: https://github.com/pluralsh/plrl-up-demos/pull/2544

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot

plural-copilot Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

GitOps PR https://github.com/pluralsh/plrl-up-demos/pull/2545 deploys console PR #3971 head 7fa5f36 to demo.

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@plural-copilot plural-copilot 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.

Deployment follow-up: the demo GitOps update is tracked in https://github.com/pluralsh/plrl-up-demos/pull/2546. It deploys image tag sha-da0dd78.

This provides some basic logic for a stylized repo mention, fetching repo urls from either the agent runtimes history list or the allowed repositories in the wb.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant