Repository navigation
fix: use service Trigger for manual AutoPilot runs - #36356
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
| private void authorizeAutoPilotTarget( | ||
| SecurityContext securityContext, App app, Map<String, Object> configPayload) { | ||
| if (AutoPilotApp.class.getName().equals(app.getClassName())) { |
There was a problem hiding this comment.
AppResource serves every app, but this check is specific to AutoPilot: it compares app.getClassName() to AutoPilotApp.class.getName() and imports the concrete bundle class (line 80). Any other app that takes a target in its trigger payload would need its own className branch in this same method, so the generic resource keeps learning about individual apps.
The string comparison also only matches that exact class name. An app registered with a subclass of AutoPilotApp would skip this check without any error.
Suggestion: one option might be to let each app declare what a trigger needs. This could be a default method on NativeApplication, something like List<AuthRequest> getTriggerAuthRequests(Map<String, Object> payload), which returns an empty list by default. AutoPilotApp would override it to return the EditAll request on the resolved service. AppResource would then call authorizer.authorizeRequests(securityContext, requests, AuthorizationLogic.ALL) when the list isn't empty, before dispatching the run. That keeps the resource generic, keeps the AutoPilot knowledge in AutoPilot, and subclasses inherit the check. ApplicationHandler already instantiates the app for triggerApplicationOnDemand, so the same instance could answer both calls.
| } | ||
| String triggeredBy = securityContext.getUserPrincipal().getName(); | ||
| if (app.getAppType().equals(AppType.Internal)) { | ||
| authorizeAutoPilotTarget(securityContext, app, configPayload); |
There was a problem hiding this comment.
PR #36156 (open) also adds payload-based authorization to triggerApplicationRun. It adds overridesConfiguredValue(...) and hardcodes RUNTIME_TRIGGER_PARAMETERS = Set.of("entityLink") in this resource, so AutoPilot's entityLink doesn't require app EditAll.
The two rules agree with each other. But together they make two separate mechanisms in the same method, each with its own built-in knowledge of AutoPilot: one keyed on the class name, one on a payload key list. Whichever PR merges second will conflict here.
Suggestion: it might be worth agreeing with Mohit on one mechanism before either PR merges. The app-level hook from the comment above could also carry the runtime parameter list, for example Set<String> getRuntimeTriggerParameters() on NativeApplication. Then neither PR needs to hardcode AutoPilot in AppResource, and the second PR to merge only adds its piece to the hook.
| if (runtimeConfig.getActive() == null) { | ||
| throw new BadRequestException("AutoPilot active must be a boolean"); | ||
| } | ||
| if (!runtimeConfig.getActive()) { | ||
| return; | ||
| } | ||
| if (nullOrEmpty(runtimeConfig.getEntityLink())) { | ||
| throw new BadRequestException("AutoPilot requires a service entity link"); | ||
| } | ||
| EntityLink entityLink = EntityLink.parse(runtimeConfig.getEntityLink()); | ||
| if (!Entity.getServiceEntityTypes().contains(entityLink.getEntityType())) { | ||
| throw new BadRequestException("AutoPilot requires a service entity link"); | ||
| } |
There was a problem hiding this comment.
The AutoPilot payload rules are checked here in the resource: active must not be null, an active run needs a link, and the link must point to a service. AutoPilotApp.triggerOnDemand (lines 71-76) still accepts active: true with a null or non-service entityLink, and the event-based path calls it directly. So the rules for a valid AutoPilot run now live in two places, and only the REST path enforces them.
The runtime config is also converted to AutoPilotAppConfig twice per request, once here and once in triggerOnDemand.
Suggestion: these rules could live in AutoPilotApp, for example a static method that takes the merged config and returns the validated service EntityLink, or an empty result when the run is inactive. The resource (or the hook above) and triggerOnDemand would both call it, so there would be one definition of a valid run and one conversion. The automatic run on service creation also calls triggerOnDemand, so it would be worth checking that it always sends a service link before it shares the stricter rules.
| Callers who can trigger the application must also be allowed to manage the selected service for | ||
| active runs. Clients should distinguish application permission from target-service permission; | ||
| showing the trigger button based only on application permission can still lead to HTTP 403. |
There was a problem hiding this comment.
The "Trigger AutoPilot" button on the service page (DataAssetsHeader.component.tsx) is still shown based on can(Operation.Trigger), read from the service's permissions. This PR makes the backend require app Trigger plus service EditAll. A user who has Trigger on a service but not EditAll will see the button and get a 403 on every click. The UI isn't changed in this PR.
Suggestion: the button could be shown only when both checks the backend makes pass:
canEditAllfrom the service's derived flags, which are already loaded in that component;Triggeron the AutoPilot app, fromuseEntityPermissions(ResourceEntity.APPLICATION, AUTO_PILOT_APP_NAME).
Doing it in this PR, or in a follow-up that ships in the same release, would keep the UI and the backend in step.
|
| Count | Rule |
|---|---|
| 42 | react-hooks/exhaustive-deps |
| 1 | openmetadata-imports/review-sequential-api-calls |
All findings
| Location | Rule | Message | |
|---|---|---|---|
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:379:8 |
react-hooks/exhaustive-deps |
React Hook useMemo has an unnecessary dependency: 'location.search'. Either exclude it or remove the dependency array. Outer scope values like 'location.search' |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:408:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has an unnecessary dependency: 'serviceCategory'. Either exclude it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:436:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 'navigate'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:454:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'setFilters'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:478:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'getEntityPermissionByFqn'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:497:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'navigate'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:537:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'handlePageChange', 'navigate', and 'setFilters'. Either include them or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:565:40 |
openmetadata-imports/review-sequential-api-calls |
Review these sequential API requests. If they are independent, start them together with Promise.all/Promise.allSettled; keep sequencing only when data-dependent |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:649:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has an unnecessary dependency: 'ingestionPaging'. Either exclude it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:764:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:778:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:797:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:838:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:852:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:868:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:884:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:898:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:913:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:935:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handleFilesPagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:960:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handleSpreadsheetsPagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1024:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handlePagingChange'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1067:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'navigate' and 'setFilters'. Either include them or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1089:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'followers', 'serviceDetails', and 't'. Either include them or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1114:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'serviceDetails' and 't'. Either include them or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1286:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1399:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'navigate'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1456:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'handleShowDeleted' and 'showDeleted'. Either include them or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1466:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'navigate'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1493:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1500:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has an unnecessary dependency: 'serviceCategory'. Either exclude it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1529:8 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1557:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'getOtherDetails'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1612:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has missing dependencies: 'fetchDashboardsDataModel', 'fileSearchValue', and 'spreadSheetSearchValue'. Either include them or remove the de |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1677:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchServiceDetails'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1683:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has missing dependencies: 'fetchServicePermission' and 'isOpenMetadataService'. Either include them or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1697:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has missing dependencies: 'currentIngestionPage', 'getAllIngestionWorkflows', 'ingestionPagingCursor?.pageSize', 'isOpenMetadataService', a |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1709:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has missing dependencies: 'collateAgentPagingCursor?.pageSize' and 'fetchCollateAgentsList'. Either include them or remove the dependency a |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1713:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchWorkflowInstanceStates'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1740:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'fetchCollateAgentsList'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1779:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has an unnecessary dependency: 'ingestionPaging'. Either exclude it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:1872:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:2055:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has missing dependencies: 'pagingInfo', 'setFilters', and 't'. Either include them or remove the dependency array. |
| 🟡 | src/pages/ServiceDetailsPage/ServiceDetailsPage.tsx:2102:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has an unnecessary dependency: 'serviceDetails.fullyQualifiedName'. Either exclude it or remove the dependency array. |
Fix locally (fast - only checks files changed in this branch):
make ui-checkstyle-changed| margin-top: 0; | ||
| margin-bottom: 0.5em; | ||
| color: var(--om-heading-color, rgba(0, 0, 0, 0.85)); | ||
| color: var(--tw-text-color-primary); |
There was a problem hiding this comment.
The merge commit 2f74ec7 changed this line, but main doesn't have this change. Main (#36373) has color: var(--om-heading-color, rgba(0, 0, 0, 0.85));. git show 2f74ec7 --cc on this file shows the merged result differs from both parents, so it looks like it came from resolving the merge.
This rule styles every h1 to h6 in the app. In light mode, headings change from rgba(0, 0, 0, 0.85) to the primary text token, and the fallback value is lost. Dark mode looks the same, because --om-heading-color already points to --color-text-primary there. #36373 kept the antd values on purpose, so that removing antd would not move any element.
Could you restore main's version of this file? It isn't related to the AutoPilot fix, and with a squash merge it would land under this PR's title.
|
Some regression notes, for information only. None of them block the PR, and I checked each one in the code.
Checked, and behaviour does not change:
|
| const hasTriggerPermission = | ||
| flags.canEditAll && canAutoPilot(Operation.Trigger); |
There was a problem hiding this comment.
This will enforce editAll permission to trigger the run?
|
| const hasTriggerPermission = | ||
| can(Operation.Trigger) && canAutoPilot(Operation.Trigger); |
There was a problem hiding this comment.
ServiceEntityPermissions.spec.ts (lines 154-172) doesn't match this condition. The Allow Trigger permissions test grants Trigger on app only, then expects the AutoPilot button to be visible. With this change the button also needs Trigger on the service. That user doesn't have it: assignRoleToUser replaces their roles, and they don't own the service. So the button stays hidden and the test fails.
Playwright is skipped on this PR and runs in the merge queue, where the impact map selects this spec through DataAssetsHeader.component.tsx. The failure would first show up there and would most likely eject the PR from the queue. I found this by reading the code and haven't run the spec.
Suggestion: one option might be to grant Trigger on All in that test, which is the default for initializePermissions and covers every service type in the matrix. An extra case with Trigger on app only could then assert that the button is hidden, since that's the behaviour this PR changes.
| Service resources expose `Trigger` through their permission descriptors. The service page shows | ||
| the AutoPilot button when both Trigger permissions are allowed. Application configuration | ||
| overrides still require application `EditAll`; an already-inactive run remains a no-op without | ||
| a target-service permission check. Automatic service-event workflows retain their existing path. |
There was a problem hiding this comment.
AutoPilot doesn't seem to have an automatic service-event workflow to retain. The trigger in AutoPilotWorkflow.json is noOp. The run after creating a service is a REST call from AddServicePage and EmbeddedAddServicePage, made as the creator, so it goes through the manual-run check this ADR describes. As written, a reader could conclude that those runs skip the check.
Suggestion: this sentence might be replaced with one saying that the run after service creation is a normal manual run, and that the creator passes the service check as its owner.
| - **Status:** Superseded by ADR:2026-11-06-manual-autopilot-runs-require-service-trigger | ||
| - **Revisions:** v1 2026-10-27 (initial) · v2 2026-11-05 (app-owned trigger preparation) | ||
| - **Deciders:** OpenMetadata maintainers | ||
| - **Guard:** `AppsResourceIT#test_autopilotTriggerRequiresEditAllOnEffectiveService`, `AppsResourceIT#test_autopilotInactiveDoesNotRequireTarget`, `AppsResourceIT#test_autopilotInvalidPayloadDoesNotStartWorkflow` |
There was a problem hiding this comment.
This ADR is added and superseded in the same PR, so it records a rule that never reached main. Its Guard also names test_autopilotTriggerRequiresEditAllOnEffectiveService, which no longer exists. The test in this PR is now test_autopilotTriggerRequiresTriggerOnEffectiveService.
Suggestion: it might be simpler to drop this file, along with the Related line in the new ADR and the "supersedes" wording in the PR description. If the reasoning against EditAll is worth keeping, a sentence in the new ADR could cover it.
|
|
||
| Roles can delegate AutoPilot execution separately from editing service information. The default | ||
| Data Steward policy grants `Trigger` on all resources, so it permits AutoPilot across services. | ||
| Owners retain access through the organization policy's `All` grant. Custom roles with only service |
There was a problem hiding this comment.
No integration test covers this owner path. The callers in AppsResourceIT get their service access from a role rule (matchAnyServiceName), never from ownership.
The run after creating a service depends on this path: the UI makes the creator the owner, and the owner rule's All is what gives them service Trigger. If that stopped working, the service would still be created, but AutoPilot wouldn't start and the user would only see an error toast.
Suggestion: a case where the caller has only Trigger on the app and owns the target service could cover this, expecting the workflow to start.
| Roles can delegate AutoPilot execution separately from editing service information. The default | ||
| Data Steward policy grants `Trigger` on all resources, so it permits AutoPilot across services. | ||
| Owners retain access through the organization policy's `All` grant. Custom roles with only service | ||
| `EditAll` need an additional `Trigger` grant. Existing ingestion-pipeline runs continue to check |
There was a problem hiding this comment.
This affects any custom role with Trigger on the app and none on the service, not only roles with service EditAll. On main, those roles can run AutoPilot on any service. After this PR, on services they don't own, the button disappears and a direct call returns 403. There's no migration that adds the grant, so admins would only find out after upgrading.
Suggestion: it might be worth a release note telling admins to add Trigger on the service resources to any role that should keep running AutoPilot.
| for `Trigger`, and is not required to run AutoPilot. | ||
|
|
||
| Service resources expose `Trigger` through their permission descriptors. The service page shows | ||
| the AutoPilot button when both Trigger permissions are allowed. Application configuration |
There was a problem hiding this comment.
This covers the service page, but Collate's AI mode connection page has two more AutoPilot buttons with no permission check: the header action and the one in the Agents tab. They show for every user.
That gap already exists, but this PR makes it easier to hit. A user with Trigger on the app and none on the service can run AutoPilot on main. After this PR they still see those buttons, but clicking one gives a 403 error toast. The backend still refuses the run, so this only affects the UI. I read this in the code and haven't run it.
Suggestion: this doesn't need to change here. A follow-up in the Collate repo could apply the same check as DataAssetsHeader, ideally in the same release.
|
Code Review ✅ Approved 2 closed / 2 findings🔴 High risk · Adding target-service Trigger authorization for manual AutoPilot runs changes access decisions; a faulty check could let users run agents on unauthorized services. Manual AutoPilot runs now require ✅ 2 closed✅ Edge Case: Target check runs before validation, so bad payloads return 500 not 400
✅ Quality: New AutoPilot trigger permission rule has no decision record
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
Manual AutoPilot runs require
Triggeron both the application and the effective target service. Service permission descriptors exposeTrigger, and the service-page button checks both permissions. Inactive runs remain no-ops; changing application configuration still requires applicationEditAll.Type of change
High-level design
Native applications declare runtime parameters and prepare a validated run with its authorization requests. AutoPilot subclasses inherit that preparation, and direct triggers share its validation. Service
Triggercovers AutoPilot agent creation, deployment, and execution; serviceEditAlldoes not substitute for it.Compatibility
The default Data Steward policy grants
Triggeron all resources, so it permits AutoPilot across services. Custom roles need applicationTriggerand target-serviceTriggerwhen ownership does not provide it. After service creation, the UI requests a manual run as the creator; ownership supplies the service permission under the default organization policy, while applicationTriggeris still required. The decision record documents the final permission contract.Validation
841dbc674f: Java reactor build, 21 focused Java unit tests, 73 API tests, and 180 UI tests passed. The API suites skipped 10 tests with no failures or errors.586f37bc56previously passed 4024 integration tests across 44 selected classes; 522 tests were skipped.