Skip to content

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

Merged
yan-3005 merged 9 commits into
mainfrom
feature/workflow-triggering-bots
Nov 27, 2026
Merged

yan-3005 merged 9 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.

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

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 in 2b0c069: ApprovalGate.rulesForActor returns no rules for workflow automation (governance-bot as the user or as the impersonator) before any bot-list filtering, so the workflow's own writes are never held, whichever bot made the change. aaf752f adds the exact case: workflowAutomationWritingForAListedBotIsNotHeld writes as listed bot scraperbot impersonated by governance-bot, and no rule holds it. mayHold, gatedAssets and admitRelations go through the same rulesForActor.

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).

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.

Done in aaf752f: both wrappers are now one generic fetchAllPagesOrEmpty, used for the installed and the marketplace application lists.

… 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.

… fetch wrappers

Covers the exact case from review: a listed bot impersonated by governance-bot is never held by the approval gate. The picker's two swallow-and-return-empty fetch helpers become one generic fetchAllPagesOrEmpty.
Copilot AI balanced review requested due to automatic review settings November 27, 2026 11:49

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

Adding triggeringBots changes approval-gate eligibility for bot-authored edits; misconfiguration could let governed changes publish without review or unnecessarily hold edits.

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

@yan-3005
yan-3005 merged commit c6ee3a8 into main Nov 27, 2026
55 checks passed
@yan-3005
yan-3005 deleted the feature/workflow-triggering-bots branch November 27, 2026 13:46
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Backport to 2.1 is under way. It is built from openmetadata-collate, which holds the credentials needed to open a PR here, and it will comment again with the result — nothing is needed from you unless it reports otherwise.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Backport to 2.0 is under way. It is built from openmetadata-collate, which holds the credentials needed to open a PR here, and it will comment again with the result — nothing is needed from you unless it reports otherwise.

@gh-bot-collate

Copy link
Copy Markdown

🤖 Backport to 2.1 opened as #39005. Claude resolved a cherry-pick conflict to build it. It merges itself once the checks pass, so read the diff now if this change is a sensitive one.

@gh-bot-collate

Copy link
Copy Markdown

🤖 Not backported to 2.0. Claude looked at the conflict and declined to resolve it:

Backport aborted: PR #38797 ("Let a workflow list the bots whose changes start it")

Reason

This PR extends the ApprovalGate / Change Request governance framework
(org.openmetadata.service.governance.approval.*: ApprovalGate,
GovernanceApprovalRegistry, ApprovalDecisionService, ChangeApplyService,
ChangeRequestService, ChangeRequestLifecycle, MutationPlanner,
StagedChange, etc.) so that a workflow can list specific bots whose edits
are held for approval instead of being treated as unconditionally trusted
automation.

That entire framework does not exist on 2.0:

$ git ls-tree -r origin/2.0 --name-only | grep -iE "changerequest|approvalgate|governanceapprovalregistry"
(no output)

Confirmed by the cherry-pick itself: ApprovalGate.java,
GovernanceApprovalRegistry.java, GovernanceDAOs.java,
GovernanceApprovalRegistryTest.java, and the related decision doc
(docs/decisions/2026-10-22-agent-glossary-proposals-are-decided-through-the-approval-workflow.md)
all show up as "deleted by us" conflicts — i.e. the merge base (and main at
the PR's parent commit) has them, but 2.0 never received them. 2.0 still
uses the older, pre-ApprovalGate approval mechanism for glossary terms.

PR #38797's core logic (ApprovalGate.rulesForActor,
GovernanceApprovalRegistry's bot-list snapshot/epoch, StagedChange
plumbing, the Change Request admission path) is written entirely in terms of
that missing framework. Porting just this PR would require first backporting
the whole Change Request / ApprovalGate system (dozens of classes, its own
history of PRs) — well beyond the scope of a single backport, and not
something that can be "sensibly adapted" by reworking this diff in place.

What was checked

  • git show c6ee3a8d2247ab839a31769b92c0f5052ba66604 — the PR replaces
    isBotChange-based unconditional bot exemption in ApprovalGate with
    rulesForActor, which depends on GatingRule.triggeringBotUsers() and the
    wider staged-change/admission pipeline.
  • git ls-tree -r <merge-base> -- .../governance/approval — empty: the
    framework was added to main after 2.0 and main diverged, and was
    never backported.
  • git ls-tree -r origin/2.0 --name-only | grep -i governance/approval —
    empty: confirms current 2.0 has no approval package at all.

Action taken

No files were edited. The repository is left mid-cherry-pick (conflicted,
unresolved) exactly as the workflow started it, since git cherry-pick --abort was not permitted in this session. The next step should run
git cherry-pick --abort (or equivalent cleanup) to restore 2.0 to its
pre-pick state before closing out this backport attempt.

Recommendation

Do not force this backport. If bot-gated workflow triggers are wanted on
2.0, the Change Request / ApprovalGate framework itself would need to be
backported first (a separate, much larger effort), after which this PR could
be reattempted on top of it.

resolver run

yan-3005 added a commit that referenced this pull request Nov 30, 2026
…it (#39005)

* Fixes #38796: Let a workflow list the bots whose changes start it (#38797)

* Let a workflow list the bots whose changes start it

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.

* Refuse leftover application bots; show bot display names once loaded

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

* Document the name-based application-bot rule; fetch app lists in parallel

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

* Name the change's bot changedByBot; test a workflow listing two bots

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

* Refresh listed bots when bots change; never gate workflow automation; 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.

* Test workflow automation writing for a listed bot; merge the picker's fetch wrappers

Covers the exact case from review: a listed bot impersonated by governance-bot is never held by the approval gate. The picker's two swallow-and-return-empty fetch helpers become one generic fetchAllPagesOrEmpty.

(cherry picked from commit c6ee3a8)

* Create bot_entity in the ontology test database

The approval registry snapshot now fingerprints bot_entity, so repository tests that build a partial schema need the table or every governed write reports the approval rules as unavailable.

---------

Co-authored-by: Ram Narayan Balaji <[email protected]>
Co-authored-by: Ram Narayan Balaji <[email protected]>
mohityadav766 added a commit that referenced this pull request Dec 2, 2026
…schema, stale and slow ITs (#39394)

* fix(sdk): remove fields cleared on a server-returned entity in update()

#39164 pruned the no-snapshot baseline to the fields the caller sent, so a field
nulled on an entity returned by create() or update() was never removed. Prune only
hand-built partial entities, which carry no version or updatedAt.

* test(ontology): create bot_entity in OntologyEntityDAOIT's scratch schema

Approval rules read bot_entity since #38797. Without it the gate refused every
write with "Approval rules are unavailable".

* test(context-memory): align ContextMemoryAnchorIT with memory-only search

#38011 lets a memory-only search return anchored memories a reader may read, but
left one assertion on the old rule. The "all" assertions counted fuzzy-matched
tables and queried the question, which "all" does not search; count memories only
and carry the query in the display name.

* fix(glossary): retry the pending-label drop of a bulk asset removal on deadlock

The chunked DELETE on tag_usage commits on its own and is idempotent, so
DeadlockRetry can rerun it.

* test: tolerate slow runners in OntologyGovernanceIT and ConceptContextIT

Retry a SPARQL request the single worker turns away with 429, and give the
approval workflow the 5 minutes MetricResourceIT already allows.

* test(informix): drop the clear() of per-source stored procedure state

PerSourceState is owned by each source instance, so a second run starts empty
and the object has no clear().

* chore(airflow-apis): refresh uv.lock for the ingestion mcp extra

* test: honour the SPARQL Retry-After and explain the workflow wait

The bounded worker answers saturation with 429 and Retry-After by design, so the
client waits as told. The approval workflow starts only when the serial
WorkflowEventConsumer reaches the create event, which lags under parallel load.

* test: poll the SPARQL retry with Awaitility; guard untouched fields in update()

Replace the sleep loop with Awaitility at the server's Retry-After interval.
Add a test that a server-returned entity with one changed field emits no
remove ops.
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