Skip to content

Add repo mention type to workbenches - #3971

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

Add repo mention type to workbenches#3971
michaeljguarino wants to merge 9 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

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.
@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 introduces a repository mention type (@repo) into the AI workbench chat input autocomplete system, enabling users to reference Git repositories in workbench prompts with stylized chip rendering. The feature fetches candidate repository URLs from two sources — the agent runtime's allowedRepositories list and a new agentRunRepositories GraphQL query — with workbench-level configuration taking precedence when it explicitly supplies a list.

Beyond the core feature, the PR bundles several related improvements and fixes:

  • Floating dropdown fix for job search: The WorkbenchJobsSearch dropdown is migrated from absolute CSS positioning to a proper FloatingPortal-backed floating UI, preventing z-index and overflow clipping issues.
  • Agent run message streaming: Introduces output streaming for agent run messages.
  • Workbench-level permission enforcement on jobs: Jobs now respect workbench-level access controls.
  • Insight → Workbench routing fix: Insights now route directly to the relevant workbench when one is present, instead of going through a generic flow.
  • Helm values refactoring: The service Helm values fetching logic is refactored for clarity and correctness.
  • Jitter improvements: Expiration jitter is made more robust.
  • Flash fix: Corrects a UI flash issue in the workbench.

Commits

Commit Summary
53dc60e Introduces the @repo mention type for workbench chat inputs: adds RepositoryChipAttrs, a repositoryMention.ts data model, chip renderers, and wires a new agentRunRepositories GraphQL query into useMentionDataSources with workbench/runtime precedence logic.
f29e5c4 Fixes a CI failure introduced by the previous commit.
a74d51e Addresses review feedback: refines repository mention logic, adds unit tests for repositoryMention and insightWorkbenchPrompt, and tightens the autocomplete hook integration.
6be895d Refactors Helm values fetching in the service settings components (ServiceHelmSettings, ServiceUpdateHelmValues) for cleaner data flow.
dce95bb Adds output streaming for agent run messages in the workbench.
2ad4a1e Enforces workbench-level permissions on workbench jobs, ensuring job creation and execution respect workbench access controls.
7d441b5 Improves expiration jitter logic to reduce cache thundering-herd risk.
7fa5f36 Routes insight 'send to workbench' actions directly to the associated workbench when one is present, bypassing the generic flow picker.
da0dd78 Fixes a UI flash in the workbench, likely caused by a rendering order issue during initial load or state transition.

Deploy in Soffi


Updated: 2026-08-06 03:59 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

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.

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