Skip to content

Fixes #38796: Let a workflow list the bots whose changes start it - #38797

Open
yan-3005 wants to merge 8 commits into
mainfrom
feature/workflow-triggering-bots
Open

yan-3005 wants to merge 8 commits into
mainfrom
feature/workflow-triggering-bots

Conversation

@yan-3005

@yan-3005 yan-3005 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

⚠️ Merge order: merge the companion Collate PR open-metadata/openmetadata-collate#9027 first. After this PR, the server returns triggeringBots on every trigger (empty when none are listed); without #9027, Collate's Lifecycle page stops reading lifecycle workflows as playbooks and drops a saved bot list on publish. #9027 is a no-op on today's main.

Fixes #38796

Since 2.1 a bot's change never starts a governance workflow and is never held for approval. That keeps ingestion out of review queues, but it blocks automation that exists to propose governed content for people to review. This lets each workflow list, in triggeringBots, the bots whose changes start it. The list is empty by default, so no stored workflow changes behaviour.

Type of change:

  • New feature

High-level design:

Contract: new triggeringBots (bot names, unique) on the eventBasedEntity trigger config.

Who may be listed: only a bot an admin created. Saving a workflow returns 400 for an unknown bot, a system bot (provider: system: ingestion-bot, governance-bot, ...), and an application's bot (the app CONTAINS it; these are stored with provider: user, so the relationship is the only marker). Only names newly added on an update are checked, so a listed bot deleted later never blocks another edit or a migration; it just starts nothing.

Runtime:

  • GovernanceApprovalRegistry: its existing snapshot (epoch-checked every 5 s, invalidated on workflow writes, so cluster-safe) now also carries the lists, resolved to the users the bots write as, by workflow FQN and by entity type. Enforce rules (GatingRule) carry their own list. No new cache.
  • WorkflowEventConsumer: a bot's change is still dropped before Flowable unless some workflow on that entity type lists the bot, so ingestion and unlisted bots cost no process instance. A listed bot's change carries the bot in the triggeringBot process variable. governance-bot (or impersonating as it) never starts a workflow. The automation-proposal exception is unchanged.
  • FilterEntityImpl: a run tagged with a bot starts only if this workflow lists the bot, so listing a bot on workflow A does not leak its changes into workflow B on the same type. No BPMN change, so already-deployed workflows need no redeploy.
  • ApprovalGate (4 call sites): for a bot actor, only the Enforce rules that list the bot gate the edit; otherwise it publishes as before.

UI: a bot picker on the start node next to Approval Mode (core Autocomplete). It lists every bot page and hides system bots and applications' bots. The field round-trips through NodeUtils (load) and WorkflowValidationService (save; a cleared list is saved as cleared). useSyncedListData moved to hooks/ so TriggerConfigSection and the new section share it.

Alternatives rejected:

  • Per-workflow decision only in the trigger filter, with the global drop removed: every ingestion change would start a trigger process per workflow on its type.
  • A separate bot signal: changes signal dispatch for no gain over the cached per-type set.

Decision record: ADR:2026-11-26-a-workflow-lists-the-bots-whose-changes-start-it, plus an amendment to ADR:2026-10-22-agent-glossary-proposals-are-decided-through-the-approval-workflow.

Backport: needed on 2.1 (bots are excluded from 2.1 on). 2.0 never excluded bots (only governance-bot), so no 2.0 port.

Tests:

Use cases covered

  • A listed bot's edit is held for approval by an Enforce workflow.
  • An unlisted bot's edit publishes as before, even when another bot is listed.
  • With two Default workflows on one entity type, a listed bot's change starts only the workflow that lists it.
  • Listing a system bot, an application's bot, or (on update) governance-bot returns 400.
  • governance-bot impersonation never starts a workflow, even if the registry says the user is listed.

Unit tests

  • WorkflowTriggeringBotsTest (new, 7: incl. a bot left behind by an uninstalled app), WorkflowEventConsumerTest (+3), with GovernanceApprovalRegistryTest, FilterEntityImplTest, ApprovalGate*Test, ChangeRequest*Test, WorkflowDefinitionRepository*Test: 230 run, 0 failures, plus 82/0 on the rerun.

  • Review round 2: GovernanceApprovalRegistryTest 60/0 (+8: bot lists, suspended/Enforce/deleted bot, bot epoch, gate admission for listed bots and workflow automation), FilterEntityImplTest 33/0 (+3), WorkflowEventConsumerTest 77/0, WorkflowTriggeringBotsTest 7/0.

Integration tests (local, MySQL + Elasticsearch, parallel lane)

  • WorkflowTriggeringBotsIT (new) 8/0: incl. one workflow listing two bots (both edits held) and the customer flow (a listed bot creates a glossary term → In Review via the seeded GlossaryTermApprovalWorkflow → its held asset link is released on approval), ChangeRequestAdmissionIT 23/0, GlossaryTermAutomationDraftIT 13/0: 42 run, 0 failures.

UI tests

  • TriggeringBotsSection.test.tsx (new, 4), WorkflowValidationService.test.ts (+3 round-trip cases), with the WorkflowBuilder form suites and WorkflowOssRestrictions.test.tsx: 172 passed, 17 suites.
  • TriggeringBotsSection.test.tsx extended: hides a bot left behind by an uninstalled app (fails without the fix), shows a saved bot's display name once loaded. WorkflowBuilder form suites: 134 passed.
  • Playwright: not added; manual UI check with screenshots below.

Manual test steps

  1. Settings → Bots: create a bot (e.g. scraper-bot).
  2. Open a glossary-term workflow, start node → Triggering Bots → pick scraper-bot, save.
  3. Create a glossary term with scraper-bot's token: the workflow runs (the term goes to review).
  4. Do the same with ingestion-bot's token: nothing runs.
  5. Try to save the workflow with ingestion-bot listed (via API): 400 "is a system bot".

Live verification

How bots reach workflows on main today (DevRel, current main, done the way users do it):

Path Recorded as (updatedBy / impersonatedBy) Triggers workflows?
Auto Classification (agent run from the UI) autoclassification-bot / — ❌ no
AI Chat (Collate AI updating an asset) user / aiautomationapplicationbot ✅ yes, as the user's own edit
MCP (Claude connected to the MCP server) user / McpApplicationBot ✅ yes, as the user's own edit
Any bot writing with its own token the bot / — ❌ no

Whoever the request runs as decides it: a person, or a bot impersonating one, triggers workflows; a bot writing as itself never does. This PR changes only the last row, and only for bots a workflow lists.

This PR on a local Collate stack (latest main + this PR, MySQL + Elasticsearch, existing DB from main, no data migration):

Scenario Result
Admin-created bot listed on the workflow edits the table ✅ workflow runs
Admin-created bot not listed edits the table ❌ no run
One workflow lists two bots (A, B); A, B and an unlisted C each edit A and B both run it (stages recorded), C starts nothing
Two workflows on one table, only one lists the bot only the listing workflow runs (checked by recorded stages: Start → RanCheck → EndTrue vs none)
autoClassification-bot / ingestion-bot edits ❌ no run; listing them returns 400 "is a system bot"
governance-bot, AIAutomationApplicationBot listed 400 "is a system bot"
App bot (McpApplicationBot) listed 400 "is an application's bot"
Unknown bot listed 400 "does not exist"
Bot removed from the list 1 run while listed, then 0
Listed bot deleted afterwards workflow still editable (200); a new workflow listing it gets 400
Suspended workflow listing the bot ❌ no run
Enforce mode: listed bot's edit held (202, value unchanged)
Enforce mode: unlisted bot's edit published (200), as before
Unlisted bot impersonating a person runs, recorded as the person (unchanged)
AI Chat / MCP as a user runs (unchanged)
MCP called with a listed bot's token runs, recorded as the bot
Unlisted bot creating an automation glossary term (proposal) still starts workflows (unchanged)

Migration: none needed. triggeringBots is an optional field in the stored trigger JSON; a workflow without it lists no bots, which is the current behaviour. No BPMN change, so no redeploy.

Screenshots (local build):

Start node configuration: the new Triggering Bots field is a multi-select; here the workflow lists two bots, ScraperBot and SyncBot:

Start node with two triggering bots selected

The picker lists only bots an admin created; system bots and application bots (including a leftover bot of an uninstalled application) are hidden:

Triggering Bots dropdown listing only admin-created bots

🤖 Generated with Claude Code

Since 2.1 a bot's change never starts a governance workflow and is never held for approval. That
keeps ingestion out of review queues, but blocks automation that exists to propose content for
people to review.

An eventBasedEntity trigger now lists, in triggeringBots, the bots whose changes start it:
- WorkflowEventConsumer drops a bot's change before Flowable unless a workflow on the entity type
  lists the bot, and tags the change with the bot (triggeringBot variable).
- FilterEntityImpl starts the run only for the workflows that list that bot.
- ApprovalGate holds a listed bot's edit for the Enforce workflows that list it.
- GovernanceApprovalRegistry's snapshot carries the lists, resolved to the users the bots write as.
- Saving a workflow refuses an unknown bot, a system bot and an application's bot; only newly
  listed bots are checked. governance-bot never starts a workflow.
- Workflow builder: a bot picker on the start node, listing only bots an admin created.

The list is empty by default, so no stored workflow changes behaviour.
@yan-3005
yan-3005 requested review from a team as code owners November 26, 2026 07:19
@yan-3005
yan-3005 requested a review from IceS2 November 26, 2026 07:19
@yan-3005 yan-3005 added the To release Will cherry-pick this PR into the release branch label Nov 26, 2026
@yan-3005
yan-3005 requested review from shah-harshit and a balanced review from Copilot November 26, 2026 07:19
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

- A bot left behind by an uninstalled application keeps its "<AppName>Bot" name but loses the
  application's link, so it looked admin-created. Saving a workflow now also refuses a bot named
  for a marketplace or installed application, and the Triggering Bots picker hides it.
- The picker kept showing a saved bot's raw name after the bot list loaded: useSyncedListData now
  relabels the selection when its label function changes.
…gering-bots

# Conflicts:
#	docs/decisions/2026-10-22-agent-glossary-proposals-are-decided-through-the-approval-workflow.md
Copilot AI balanced review requested due to automatic review settings November 26, 2026 18:03

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

…llel

- The decision record now states how an application's bot is recognised: the installed
  application's link, or its "<application name>Bot" name for an installed or marketplace
  application, and why a leftover bot of an uninstalled application must be refused too.
- The Triggering Bots picker fetches installed and marketplace applications concurrently.
Copilot AI balanced review requested due to automatic review settings November 27, 2026 05:43

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

- A workflow lists several bots; a change has one author. The process variable that carries that
  author is now changedByBot (was triggeringBot), and the comments say so.
- WorkflowTriggeringBotsIT: one Enforce workflow listing two bots holds both bots' edits as
  separate change requests.
Copilot AI balanced review requested due to automatic review settings November 27, 2026 06:11

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 27, 2026 06:30

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Comment on lines +97 to +98
private static boolean isApplicationBot(final Bot bot) {
return isLinkedToApplication(bot) || isNamedForApplication(bot.getName());

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.

An application's bot is told apart from an admin-created one by inference: it has a CONTAINS link from an installed app, or its name is <application name>Bot and that name matches an installed app or a marketplace definition. The inference is needed because AppRepository.createNewAppBot stores the bot with provider: USER, the same as a bot an admin creates.

The rule lives in two places: here, and in the picker (fetchApplicationBots / toApplicationBotName in TriggeringBotsSection.tsx:61-100). Some effects:

  • The two copies have to stay in sync by hand. If one drifts, the picker offers a bot the server refuses, or hides one it would accept.
  • The name check relies on the "%sBot" naming convention in createNewAppBot. An application bot that doesn't follow it is treated as admin-created.
  • To filter, the picker pages through every bot, every installed app and every marketplace definition each time the start node opens. A user who can't list applications gets the picker without the filter.

Suggestion: as a follow-up, not in this PR, it might be worth marking the bot when createNewAppBot creates it, plus a migration for the application bots that already exist. Both checks would then become a single field read, on the server and in the UI.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Marking the bot when createNewAppBot creates it, plus a migration for existing application bots, turns both checks into one field read and removes the duplicated server/UI rule and the %sBot dependency. Filed as a follow-up: #38964. Kept out of this PR as you suggested.

@Execution(ExecutionMode.SAME_THREAD)
@Isolated
@ExtendWith(TestNamespaceExtension.class)
class WorkflowTriggeringBotsIT {

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.

The scenario that started this, an admin-created bot creating glossary terms that go through GlossaryTermApprovalWorkflow to In Review, isn't covered. The tests here and the live checks only cover Updated events on glossaries and tables. The create path should behave the same from the code, but it's also the path that releases the held asset links from PR #38239 when the term is approved, so nothing currently checks the end-to-end flow the customer relies on.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Covered now (2b0c069). WorkflowTriggeringBotsIT.listedBotsNewGlossaryTermIsReviewedAndApprovalReleasesItsHeldTag lists an admin-created bot on the seeded GlossaryTermApprovalWorkflow. The bot then creates a term, which goes to In Review. The bot tags a table with it and the tag is held. The reviewer approves, the term becomes Approved, and the held tag shows on the table. Also run live on a local Collate stack, step by step.

triggeringBotUsersOf(definitions));
}

private static TriggeringBotUsers triggeringBotUsersOf(List<WorkflowDefinition> definitions) {

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.

The new rules have no unit tests: triggeringBotUsersOf (suspended and Enforce workflows left out, deleted bots skipped), FilterEntityImpl.listsBotThatMadeTheChange, and ApprovalGate.rulesForActor. FilterEntityImplTest and the ApprovalGate*Test files are listed as run but did not change. The gate's other entry points (bulk PUT through mayHold, gatedAssets, and data product ports through admitRelations) are reached only through PATCH in the IT.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added (2b0c069): GovernanceApprovalRegistryTest covers a listing workflow starting for its entity type and only for that bot, suspended workflows, Enforce workflows' bots being gated rather than signalled, a deleted listed bot, the snapshot epoch changing when bots change, and gate admission for a listed bot, a bot held only by the workflows that list it, and workflow automation. FilterEntityImplTest covers a bot's change running only where the list contains it and a person's change never consulting the lists. Writing these surfaced a real gap, now fixed: ApprovalGate.rulesForActor filtered workflow automation (governance-bot impersonating a user) by the bot list; it now returns no rules for it, as the consumer already did. mayHold, gatedAssets and admitRelations all go through rulesForActor.

now,
snapshot.rulesByEntityType(),
snapshot.enforcedEntityTypes(),
snapshot.triggeringBotUsers())

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.

The listed bots are resolved to their users when the snapshot is computed, and the snapshot is reused for as long as the workflow-definition epoch stays the same. Deleting a listed bot and creating it again under the same name with a different bot user leaves the old user in the snapshot. That bot's changes then start nothing until some workflow definition is written or the server restarts. Saving the workflow itself is not enough, because the list hasn't changed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed (2b0c069). The snapshot epoch now also fingerprints bot_entity (COUNT(*):MAX(updatedAt), same shape as the workflow-definition epoch), so creating, deleting or reassigning a bot refreshes the cached bot users within the existing 5-second recheck. Checked live: a listed bot was hard-deleted and recreated under the same name with a different bot user, and its next change ran the workflow.

],
"default": "Default"
},
"triggeringBots": {

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.

Collate's Lifecycle page rebuilds a playbook's trigger with a fixed set of keys and publishes it over the saved one, so it drops triggeringBots:

  • collate-ui/.../pages/LifecycleWorkflows/LifecycleWorkflow.utils.ts:873 builds the trigger config from entityTypes, events, exclude, include and filter only.
  • LifecycleWorkflow.utils.ts:985 and :1302 compare the saved trigger with that rebuilt one to decide whether a workflow is still a playbook. A saved triggeringBots makes them differ, so the page no longer reads the workflow as a playbook.
  • collate-ui/.../rest/lifecycleWorkflowAPI.ts:222 publishes compare(current, { ...current, ...compiled }), which replaces the whole trigger and so removes triggeringBots.

How to hit it: list a bot on GlossaryTermLifecycle in the workflow builder, then open Glossary Term in the Lifecycle page. The playbook is not recognised, and publishing from that page silently removes the bot list. The Lifecycle page also has no way to set the list. This affects anyone who configures glossary review through lifecycle playbooks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed, thanks. The fix is in Collate, PR to follow: normalizeTrigger ignores triggeringBots, so a playbook whose workflow lists bots is still recognised, and publishLifecycleWorkflow carries the saved triggeringBots onto the compiled trigger before the diff, so publishing from the Lifecycle page keeps the list (tests added for both). Setting the list stays in the workflow builder. That PR reads the new field, so it should merge after this one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collate PR: https://github.com/open-metadata/openmetadata-collate/pull/9027. It also covers a consequence I found while checking this: after this PR the server returns triggeringBots: [] on every trigger, so without it the Lifecycle page would stop reading every lifecycle workflow as a playbook, not only ones that list bots. Its new tests fail on Collate main and pass with the change, against both OSS main types and this PR's. It's a no-op on today's OSS, so it should merge before this PR; I put that order in both descriptions.

@ShaileshParmar11 ShaileshParmar11 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.

Review at 57ad210. I found one 🔴, inline below. manerow's threads cover the other gaps, so I have not repeated them.

List<GatingRule> rules, String user, String impersonatedBy) {
return rules.isEmpty() || !isBotChange(user, impersonatedBy)
? rules
: rules.stream().filter(rule -> rule.triggeringBotUsers().contains(user)).toList();

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.

🔴 The gate now holds workflow automation's own writes when a listed bot is the requester.

Trigger:

  1. An Enforce workflow on an entity type lists bot X, and it gates a field that a workflow sets. Examples: the stage/status (STRUCTURAL_FIELDS notes that "a stage change gates like any other field"), or the certification.
  2. A workflow run whose requester is X writes that field. Two runs do this:
    • A Default workflow on the type that also lists X. Its global updatedBy is event.getUserName(), which is X.
    • The Enforce workflow's own run for X's held change. ChangeRequestDelivery sets updatedBy to request.getRequestedBy(), which is X.

Result:

  • SetEntityAttribute, SetEntityCertification and SetGlossaryTermStatus write as X, with governance-bot as impersonator. The call goes through EntityFieldUtils.setEntityField, then repository.patch(..., X, ..., "governance-bot"), then admitOrVerify (no approval), then ApprovalGate.admit.
  • Here, isBotChange(X, "governance-bot") is true, so this line keeps every rule that lists X. The automation's write is then staged as a new change request instead of being published.
  • In the second case, approving that request starts another run of the same workflow, so the cycle can repeat.
  • Before this PR, !isBotChange(...) let every write impersonated as governance-bot through.
  • The javadoc above ("workflow automation's own writes by none") and the ADR ("Workflow automation … never starts a workflow, whatever a list says") both still claim the old behaviour.
  • WorkflowEventConsumer.botAuthorOf already excludes these writes with isWorkflowAutomation. Only the gate misses it.

I traced this through the code but did not run it end to end.

Fix: return List.of() when GOVERNANCE_BOT equals user or impersonatedBy, the same check isWorkflowAutomation makes. Add a unit case that (listedBot, "governance-bot") is not held.

Comment on lines +64 to +86
const fetchNamesSafely = async (
fetchPage: (
after?: string
) => Promise<{ data: { name: string }[]; paging: Paging }>
): Promise<string[]> => {
try {
return (await fetchAllPages(fetchPage)).map((app) => app.name);
} catch {
return [];
}
};

// The server refuses an application's bot anyway; a user who cannot list applications still
// gets the picker, without that filter.
const fetchInstalledApplications = async (): Promise<App[]> => {
try {
return await fetchAllPages<App>((after) =>
getApplicationList({ fields: 'bot', limit: PAGE_SIZE, after })
);
} catch {
return [];
}
};

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.

🟡 fetchNamesSafely and fetchInstalledApplications are the same wrapper written twice.

Both run fetchAllPages inside a try and return [] on failure. The only difference is that fetchNamesSafely also maps each item to its name. One generic helper can replace both:

// The server refuses an application's bot anyway; a user who cannot list applications still
// gets the picker, without that filter.
const fetchAllPagesOrEmpty = async <T,>(
  fetchPage: (after?: string) => Promise<{ data: T[]; paging: Paging }>
): Promise<T[]> => fetchAllPages(fetchPage).catch(() => []);

fetchApplicationBots would then call fetchAllPagesOrEmpty for both lists, and map the marketplace result to names inline: marketplace.map((app) => app.name).

… cover the create flow

- The registry snapshot's epoch now also fingerprints bot_entity, so a listed bot deleted and
  recreated with another bot user (or reassigned) is resolved again within the 5-second recheck,
  instead of only after a workflow definition is written.
- ApprovalGate.rulesForActor returns no rules for workflow automation (governance-bot, or a user it
  impersonates), as the consumer already does, whatever a bot list holds.
- Unit tests for the registry's bot lists (listing, suspended, Enforce, deleted bot, epoch), the
  trigger filter's bot check, and gate admission for listed bots and workflow automation.
- IT for the flow the feature exists for: a bot listed on the seeded glossary term approval
  workflow creates a term, which goes to review; the asset link it adds is held and released when
  the term is approved.
Copilot AI balanced review requested due to automatic review settings November 27, 2026 10:34

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@gitar-bot

gitar-bot Bot commented Nov 27, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk 3 closed / 3 findings

ApprovalGate now routes bot edits through configured Enforce rules, changing whether governed content publishes immediately or waits for human approval.

Adds a triggeringBots list to workflow start nodes so admin-created bots can start governed workflows, with system and application bots rejected on save. Selected bots now show display names once loaded, the name-based application-bot rule is documented in the ADR, and app list fetches run in parallel. No open issues found.

✅ 3 closed
✅ Bug: Selected bots keep raw names after the bot list finishes loading

📄 openmetadata-ui/src/main/resources/ui/src/hooks/useSyncedListData.ts:25-37 📄 openmetadata-ui/src/main/resources/ui/src/components/WorkflowDefinitions/WorkflowBuilder/forms/TriggeringBotsSection.tsx:90-104
When the workflow builder opens on a saved workflow, TriggeringBotsSection renders before fetchAdminCreatedBots returns. At that point labelsByName is empty, so useSyncedListData fills the selected chips using getBotLabel(name), which falls back to the raw bot name. Once the bots load, getBotLabel changes and the effect runs again. But the effect only rebuilds the list when values differ from prevRef, and they don't. The chips therefore keep showing internal names (e.g. scraper-bot) instead of display names (Scraper) until the user edits the selection. The fix is to also rebuild the list when the label function changes, or to compute the labels at render time.

✅ Quality: Name-based application-bot rule is not in the new ADR

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowTriggeringBots.java:93-107 📄 openmetadata-ui/src/main/resources/ui/src/components/WorkflowDefinitions/WorkflowBuilder/forms/TriggeringBotsSection.tsx:59-62 📄 docs/decisions/2026-11-26-a-workflow-lists-the-bots-whose-changes-start-it.md
This commit adds a second rule for spotting an application's bot. A bot named <application name>Bot counts as one when that name matches an installed or marketplace application, even with no CONTAINS link. The server (isNamedForApplication) and the UI picker (toApplicationBotName filter) both have to follow this rule. ADR:2026-11-26-a-workflow-lists-the-bots-whose-changes-start-it defines an application's bot only as "the bot an application contains", so the tree doesn't record the rule this change enforces. One effect is that an admin-created bot whose name happens to match <marketplace app>Bot is now refused. The record (added in this PR) should say: "A bot named <application name>Bot, where the name is an installed application or a marketplace definition, is an application's bot even after its application is uninstalled, because reinstalling the application reuses it."

✅ Performance: Installed and marketplace app lists are fetched one after the other

📄 openmetadata-ui/src/main/resources/ui/src/components/WorkflowDefinitions/WorkflowBuilder/forms/TriggeringBotsSection.tsx:78-92
fetchApplicationBots waits for every page of getApplicationList before it starts paging getMarketPlaceApplicationList, even though the two requests don't depend on each other. This slows the bot picker on every start-node open and goes against the frontend rule against request waterfalls. Start both at once with Promise.all, wrapping each one so a failure falls back to an empty list.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

To release Will cherry-pick this PR into the release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let a governance workflow list the bots whose changes can start it

4 participants