Skip to content

feat(augment): Phase 5 - SonataFlow agent-approval workflow#3226

Merged
pkliczewski merged 3 commits into
redhat-developer:mainfrom
rrbanda:pr/lifecycle-hardening-phase5
May 21, 2026
Merged

feat(augment): Phase 5 - SonataFlow agent-approval workflow#3226
pkliczewski merged 3 commits into
redhat-developer:mainfrom
rrbanda:pr/lifecycle-hardening-phase5

Conversation

@rrbanda
Copy link
Copy Markdown
Contributor

@rrbanda rrbanda commented May 21, 2026

Summary

Phase 5 of the Deep-Dive Lifecycle Hardening plan. Adds a SonataFlow workflow for automated agent lifecycle approval, based on the RHDH orchestrator escalation pattern from the serverless-workflows repository. Depends on Phase 4 (PR #3225).

Workflow Flow

draft -> review (triggers workflow)
  |
  v
NotifyReviewSubmitted (Backstage Notifications)
  |
  v
WaitForDecision (callback state, waits for CloudEvent)
  |
  |-- 72h timeout --> EscalateTimeout --> (loop back to wait)
  |
  |-- approved --> ApproveAgent (promote to staging + notify creator)
  |
  |-- rejected --> RejectAgent (demote to draft with reason + notify creator)

Files

  • agent-approval.sw.yaml - SonataFlow workflow definition
  • schemas/agent-approval-input.json - Input validation schema
  • specs/augment-agent-lifecycle.yaml - OpenAPI spec for promote/demote endpoints
  • application.properties - SonataFlow Operator deployment config
  • README.md - Architecture, CloudEvent format, deployment guide

CloudEvent Correlation

Admin decisions are sent as CloudEvents with type io.rhdhorchestrator.agent.approval.decision and correlated to workflow instances via the kogitoprocrefid extension attribute.

Prerequisites

  • SonataFlow Operator on OpenShift
  • Knative Eventing with Broker
  • Backstage Notifications plugin
  • OIDC service account for service-to-service auth

Test plan

  • Validate workflow YAML syntax against SonataFlow spec
  • Verify input schema validates correctly
  • Verify OpenAPI spec matches actual augment backend endpoints
  • Deploy to SonataFlow Operator and trigger with test data
  • Send approval CloudEvent and verify promote + notification
  • Send rejection CloudEvent and verify demote with reason + notification
  • Wait for 72h timeout (or use test timeout) and verify escalation notification

@rrbanda rrbanda requested review from a team and pkliczewski as code owners May 21, 2026 16:35
@rrbanda rrbanda force-pushed the pr/lifecycle-hardening-phase5 branch from 70e2bea to b5058c0 Compare May 21, 2026 17:08
@rrbanda rrbanda requested review from a team as code owners May 21, 2026 17:08
@github-actions
Copy link
Copy Markdown
Contributor

This pull request adds a new top-level directory under workspaces/. Please follow Submitting a Pull Request for a New Workspace in CONTRIBUTING.md.

@rhdh-gh-app
Copy link
Copy Markdown

rhdh-gh-app Bot commented May 21, 2026

Missing Changesets

The following package(s) are changed by this PR but do not have a changeset:

  • @red-hat-developer-hub/backstage-plugin-augment-backend
  • @red-hat-developer-hub/backstage-plugin-augment

See CONTRIBUTING.md for more information about how to add changesets.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-augment-backend workspaces/augment/plugins/augment-backend none v0.1.0
@red-hat-developer-hub/backstage-plugin-augment workspaces/augment/plugins/augment none v0.1.0

@rrbanda rrbanda force-pushed the pr/lifecycle-hardening-phase5 branch 2 times, most recently from 133da88 to 8e2a61b Compare May 21, 2026 17:27
@rrbanda rrbanda force-pushed the pr/lifecycle-hardening-phase5 branch from 8e2a61b to 67bb121 Compare May 21, 2026 17:38
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 60.25641% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.82%. Comparing base (18fe980) to head (8365e4c).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3226      +/-   ##
==========================================
+ Coverage   53.80%   53.82%   +0.01%     
==========================================
  Files        2362     2362              
  Lines       84772    84815      +43     
  Branches    23497    23512      +15     
==========================================
+ Hits        45612    45650      +38     
- Misses      37638    37643       +5     
  Partials     1522     1522              
Flag Coverage Δ *Carryforward flag
adoption-insights 83.58% <ø> (ø) Carriedforward from 18fe980
ai-integrations 70.03% <ø> (ø) Carriedforward from 18fe980
app-defaults 69.60% <ø> (ø) Carriedforward from 18fe980
augment 47.62% <60.25%> (+0.04%) ⬆️
bulk-import 72.86% <ø> (ø) Carriedforward from 18fe980
cost-management 16.49% <ø> (ø) Carriedforward from 18fe980
dcm 32.85% <ø> (ø) Carriedforward from 18fe980
extensions 61.79% <ø> (ø) Carriedforward from 18fe980
global-floating-action-button 74.30% <ø> (ø) Carriedforward from 18fe980
global-header 61.68% <ø> (ø) Carriedforward from 18fe980
homepage 50.92% <ø> (ø) Carriedforward from 18fe980
konflux 91.01% <ø> (ø) Carriedforward from 18fe980
lightspeed 68.33% <ø> (ø) Carriedforward from 18fe980
mcp-integrations 81.59% <ø> (ø) Carriedforward from 18fe980
orchestrator 36.36% <ø> (ø) Carriedforward from 18fe980
quickstart 62.88% <ø> (ø) Carriedforward from 18fe980
sandbox 79.56% <ø> (ø) Carriedforward from 18fe980
scorecard 83.84% <ø> (ø) Carriedforward from 18fe980
theme 64.54% <ø> (ø) Carriedforward from 18fe980
translations 8.49% <ø> (ø) Carriedforward from 18fe980
x2a 78.59% <ø> (ø) Carriedforward from 18fe980

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 18fe980...8365e4c. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

rrbanda added 3 commits May 21, 2026 14:03
Phase 3 of lifecycle hardening: adds 30-second polling to ReviewQueue
and OpsOverview for real-time admin visibility.

Key fix: only sets loading=true on the initial load, not on subsequent
polls. This eliminates the skeleton flash that occurred every 30 seconds
in the previous implementation (PR G).

ReviewQueue:
- 30s polling interval for review queue agents
- initialLoadDone ref prevents loading flash on polls

OpsOverview:
- 30s polling interval for agent and tool data
- Same loading flash fix via initialLoadDone ref
…ement

Phase 4 of lifecycle hardening: source-aware cascading delete and
lifecycle graph enforcement for publish routes.

Cascading DELETE /agents/:agentId:
- Detects agent source via unified agent list (kagenti/orchestration/workflow)
- For orchestration agents: removes from 'agents' admin config key AND
  chatAgents lifecycle entry in a single operation
- For Kagenti agents: removes chatAgents entry, notes that K8s cleanup
  requires the dedicated admin endpoint
- Returns detailed cleanupResults per store for transparency
- Ownership enforcement: non-admins restricted to own draft agents

Lifecycle enforcement on publish routes:
- PUT /agents/:agentId/publish: detects when admin bypasses lifecycle
  stages (e.g. draft -> production), logs audit warning with
  lifecycleBypassed flag, still allows the operation
- PUT /agents/bulk-publish: same bypass detection per agent, logs
  warning with count of bypassed agents

OrchAgentDetailView:
- Updated handleDelete to use the cascading DELETE /agents/:agentId
  endpoint instead of directly mutating admin config
- Removed unused useAdminConfig('agents') hook
Phase 5 of lifecycle hardening: SonataFlow workflow for automated agent
lifecycle approval, based on the RHDH orchestrator escalation pattern.

Workflow (agent-approval.sw.yaml):
- Triggered when agent is submitted for review (draft -> review)
- Sends Backstage notification to admins on submission
- Suspends in callback state awaiting admin decision CloudEvent
- Approval: promotes agent to staging, notifies creator
- Rejection: demotes to draft with reason, notifies creator
- 72-hour timeout: sends escalation notification, re-enters wait state
- Uses kogitoprocrefid CloudEvent extension for instance correlation

Infrastructure:
- OpenAPI spec for augment promote/demote endpoints
- JSON Schema for workflow input validation
- Application properties for SonataFlow Operator deployment
- Knative Eventing configuration for CloudEvent routing

CloudEvent type: io.rhdhorchestrator.agent.approval.decision
Correlation: kogitoprocrefid (SonataFlow process instance ID)

Prerequisites: SonataFlow Operator, Knative Eventing, Backstage
Notifications plugin, OIDC service account.
@rrbanda rrbanda force-pushed the pr/lifecycle-hardening-phase5 branch from 67bb121 to 8365e4c Compare May 21, 2026 18:03
@sonarqubecloud
Copy link
Copy Markdown

@pkliczewski pkliczewski merged commit fb32b28 into redhat-developer:main May 21, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants