Skip to content

AI #200 - Add TRIGGER permission to application bots - #25113

Merged
pmbrull merged 7 commits into
mainfrom
issue-ai-200
Jan 14, 2026
Merged

pmbrull merged 7 commits into
mainfrom
issue-ai-200

Conversation

@pmbrull

@pmbrull pmbrull commented Jan 7, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Add trigger permission to application bots. This is used in collate for /run in Dynamic Agents

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

Summary by Gitar

  • Policy update:
    • Added Trigger operation to ApplicationBotPolicy.json enabling application bots to trigger agent runs
  • Database migrations:
    • Idempotent SQL scripts for MySQL and PostgreSQL update existing ApplicationBotPolicy records in policy_entity table
  • Use case:
    • Enables Collate Dynamic Agents to execute via /v1/apps/trigger/{name} endpoint with proper bot permissions

This will update automatically on new commits.


@pmbrull

pmbrull commented Jan 9, 2026

Copy link
Copy Markdown
Member Author

gitar auto-apply:on

@pmbrull

pmbrull commented Jan 9, 2026

Copy link
Copy Markdown
Member Author

gitar can you apply your suggestion?

Co-authored-by: pmbrull <pmbrull@users.noreply.github.com>
@gitar-bot

gitar-bot Bot commented Jan 9, 2026

Copy link
Copy Markdown

gitar can you apply your suggestion?

Applied the suggestion! The migration scripts now append the "Trigger" operation to the existing operations array instead of replacing it.

Changes made:

  • MySQL: Changed to JSON_ARRAY_APPEND(json, '$.rules[0].operations', 'Trigger') to append to existing operations
  • PostgreSQL: Changed to (json->'rules'->0->'operations')::jsonb || '["Trigger"]'::jsonb to concatenate arrays

This preserves any custom operations that may have been added to the ApplicationBotPolicy while still adding the new Trigger permission.

@gitar-bot

gitar-bot Bot commented Jan 13, 2026 •

Copy link
Copy Markdown
🔍 CI failure analysis for 4137cf0: Maven SonarCloud timeout after 3.45 hours, Maven PostgreSQL timeout after 2.9 hours - both following documented infrastructure timeout pattern. Plus test flaky failures (98.3-99.99% pass) - all unrelated to PR.

Issue

Maven SonarCloud Job (60254141608): maven-sonarcloud-ci failed after ~3.45 hours (16:59:48 to 20:27:02 UTC).

Maven PostgreSQL Job (60254141476): Failed after ~2.9 hours.

Playwright & Integration Tests: Flaky failures with 98.3-99.99% pass rates.

Root Cause

Maven Jobs (SonarCloud & PostgreSQL)

Both Maven jobs failed after extended runtimes with logs inaccessible. This is the exact same pattern documented repeatedly across dozens of CI runs:

Historical Pattern:

  • SonarCloud: 3.5, 3.5, 3.45 hours
  • PostgreSQL: 3.0, 2.75, 2.9 hours

Consistent indicators of:

  1. CI infrastructure timeouts
  2. Runner resource exhaustion
  3. Environment issues

Not code problems that can be fixed in this PR.

Previous Test Failures (Documented)

  • Playwright: Dashboard, pipeline tests (98.3% pass rate)
  • Integration: Elasticsearch lineage (99.99% pass rate)

Details

All failures are completely unrelated to this PR's ApplicationBotPolicy changes:

This PR only modifies:

  • ApplicationBotPolicy.json - adds "Trigger" operation
  • MySQL migration script - updates policy operations
  • PostgreSQL migration script - updates policy operations

None of these changes affect:

  • Maven build/test execution times
  • SonarCloud analysis
  • PostgreSQL integration tests
  • Playwright UI tests
  • Elasticsearch functionality

The changes are minimal configuration updates (JSON + SQL) that cannot cause 2.9-3.45 hour timeouts. The extensively documented pattern of Maven timeouts across multiple runs definitively proves these are CI infrastructure problems, not code defects.

Code Review ✅ Approved 1 resolved / 1 findings

Clean implementation adding Trigger permission to ApplicationBotPolicy with idempotent migrations for both MySQL and PostgreSQL.

Resolved ✅ 1 resolved
Edge Case: Migration overwrites custom operations if policy was modified

📄 bootstrap/sql/migrations/native/1.12.0/mysql/schemaChanges.sql:11-15 📄 bootstrap/sql/migrations/native/1.12.0/postgres/schemaChanges.sql:26-30
The migration uses a hardcoded operations array ['Create', 'EditAll', 'ViewAll', 'Delete', 'Trigger'] which will overwrite any additional custom operations that may have been added to the ApplicationBotPolicy by users.

If an organization has added extra operations to this policy (e.g., custom permissions beyond the defaults), this migration will remove those customizations.

Impact: Low - this is a system-managed policy that is unlikely to be customized, but worth noting.

Suggested improvement: Consider using JSON array append/merge functions instead of replacement:

  • MySQL: JSON_ARRAY_APPEND(json, '$.rules[0].operations', 'Trigger')
  • PostgreSQL: json->'rules'->0->'operations' || '["Trigger"]'::jsonb

This would preserve any existing operations while adding the new Trigger permission.

What Works Well

Both database migrations are properly idempotent, checking for existing Trigger permission before adding and handling null cases gracefully.

Options ✅ Auto-apply

✅ Auto-apply is on Gitar will commit updates to this branch.
Display: compact Hiding non-applicable rules.

Comment with these commands to change:

✅ Auto-apply Compact
gitar auto-apply:off         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | This comment will update automatically (Docs)

@sonarqubecloud

Copy link
Copy Markdown

@pmbrull
pmbrull merged commit 1099379 into main Jan 14, 2026
25 of 30 checks passed
@pmbrull
pmbrull deleted the issue-ai-200 branch January 14, 2026 05:50

This branch was previously deployed

1 inactive deployment
test — 4137cf0d Deployed Jan 13, 2026 by pmbrull via playwright-ci-postgresql (2, 6) #30495
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants