Repository navigation
Conversation
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.
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
- 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
…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.
- 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.
| private static boolean isApplicationBot(final Bot bot) { | ||
| return isLinkedToApplication(bot) || isNamedForApplication(bot.getName()); |
There was a problem hiding this comment.
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 increateNewAppBot. 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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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": { |
There was a problem hiding this comment.
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:873builds the trigger config fromentityTypes,events,exclude,includeandfilteronly.LifecycleWorkflow.utils.ts:985and:1302compare the saved trigger with that rebuilt one to decide whether a workflow is still a playbook. A savedtriggeringBotsmakes them differ, so the page no longer reads the workflow as a playbook.collate-ui/.../rest/lifecycleWorkflowAPI.ts:222publishescompare(current, { ...current, ...compiled }), which replaces the whole trigger and so removestriggeringBots.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
🔴 The gate now holds workflow automation's own writes when a listed bot is the requester.
Trigger:
- An Enforce workflow on an entity type lists bot X, and it gates a field that a workflow sets. Examples: the stage/status (
STRUCTURAL_FIELDSnotes that "a stage change gates like any other field"), or the certification. - 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
updatedByisevent.getUserName(), which is X. - The Enforce workflow's own run for X's held change.
ChangeRequestDeliverysetsupdatedBytorequest.getRequestedBy(), which is X.
- A Default workflow on the type that also lists X. Its global
Result:
SetEntityAttribute,SetEntityCertificationandSetGlossaryTermStatuswrite as X, withgovernance-botas impersonator. The call goes throughEntityFieldUtils.setEntityField, thenrepository.patch(..., X, ..., "governance-bot"), thenadmitOrVerify(no approval), thenApprovalGate.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.botAuthorOfalready excludes these writes withisWorkflowAutomation. 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.
| 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 []; | ||
| } | ||
| }; |
There was a problem hiding this comment.
🟡 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.
Code Review ✅ Approved 🔴 High risk 3 closed / 3 findingsApprovalGate now routes bot edits through configured Enforce rules, changing whether governed content publishes immediately or waits for human approval. Adds a ✅ 3 closed✅ Bug: Selected bots keep raw names after the bot list finishes loading
✅ Quality: Name-based application-bot rule is not in the new ADR
✅ Performance: Installed and marketplace app lists are fetched one after the other
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
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:
High-level design:
Contract: new
triggeringBots(bot names, unique) on theeventBasedEntitytrigger 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 withprovider: 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 thetriggeringBotprocess 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 throughNodeUtils(load) andWorkflowValidationService(save; a cleared list is saved as cleared).useSyncedListDatamoved tohooks/soTriggerConfigSectionand the new section share it.Alternatives rejected:
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
Unit tests
WorkflowTriggeringBotsTest(new, 7: incl. a bot left behind by an uninstalled app),WorkflowEventConsumerTest(+3), withGovernanceApprovalRegistryTest,FilterEntityImplTest,ApprovalGate*Test,ChangeRequest*Test,WorkflowDefinitionRepository*Test: 230 run, 0 failures, plus 82/0 on the rerun.Review round 2:
GovernanceApprovalRegistryTest60/0 (+8: bot lists, suspended/Enforce/deleted bot, bot epoch, gate admission for listed bots and workflow automation),FilterEntityImplTest33/0 (+3),WorkflowEventConsumerTest77/0,WorkflowTriggeringBotsTest7/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 seededGlossaryTermApprovalWorkflow→ its held asset link is released on approval),ChangeRequestAdmissionIT23/0,GlossaryTermAutomationDraftIT13/0: 42 run, 0 failures.UI tests
TriggeringBotsSection.test.tsx(new, 4),WorkflowValidationService.test.ts(+3 round-trip cases), with the WorkflowBuilder form suites andWorkflowOssRestrictions.test.tsx: 172 passed, 17 suites.TriggeringBotsSection.test.tsxextended: 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.Manual test steps
scraper-bot).scraper-bot, save.scraper-bot's token: the workflow runs (the term goes to review).ingestion-bot's token: nothing runs.ingestion-botlisted (via API): 400 "is a system bot".Live verification
How bots reach workflows on
maintoday (DevRel, currentmain, done the way users do it):updatedBy/impersonatedBy)autoclassification-bot/ —aiautomationapplicationbotMcpApplicationBotWhoever 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 frommain, no data migration):Start → RanCheck → EndTruevs none)autoClassification-bot/ingestion-boteditsgovernance-bot,AIAutomationApplicationBotlistedMcpApplicationBot) listedautomationglossary term (proposal)Migration: none needed.
triggeringBotsis 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,
ScraperBotandSyncBot:The picker lists only bots an admin created; system bots and application bots (including a leftover bot of an uninstalled application) are hidden:
🤖 Generated with Claude Code