Skip to content

feat(augment): Phase 4 - enterprise-grade cascading delete and lifecycle enforcement#3225

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

feat(augment): Phase 4 - enterprise-grade cascading delete and lifecycle enforcement#3225
pkliczewski merged 2 commits into
redhat-developer:mainfrom
rrbanda:pr/lifecycle-hardening-phase4

Conversation

@rrbanda
Copy link
Copy Markdown
Contributor

@rrbanda rrbanda commented May 21, 2026

Summary

Phase 4 of the Deep-Dive Lifecycle Hardening plan. Implements enterprise-grade cascading delete and lifecycle graph enforcement. Depends on Phase 3 (PR #3224).

Cascading DELETE /agents/:agentId

The delete endpoint now detects the agent's source and cleans up all relevant stores:

Source Cleanup
Orchestration (Responses API) Removes from agents admin config key + chatAgents lifecycle entry
Kagenti (K8s) Removes chatAgents lifecycle entry. Notes K8s cleanup requires dedicated admin endpoint
Workflow Removes chatAgents lifecycle entry

Returns detailed cleanupResults per store for full transparency. Ownership enforcement: non-admins restricted to their own draft agents.

Lifecycle enforcement on publish routes

  • PUT /agents/:agentId/publish: detects when admin bypasses lifecycle stages (e.g., draft -> production directly), logs audit warning with lifecycleBypassed flag
  • PUT /agents/bulk-publish: same detection per agent, logs count of bypassed agents

Both routes still allow the operation (admin override) but provide full audit trail.

OrchAgentDetailView update

  • handleDelete now calls the cascading DELETE /agents/:agentId API instead of directly mutating the admin config, ensuring consistent cleanup across all stores
  • Removed unused useAdminConfig('agents') hook

Test plan

  • Delete an orchestration agent: verify both admin config and chatAgents entries are cleaned up
  • Delete a Kagenti agent config: verify chatAgents removed, response notes K8s cleanup needed
  • Non-admin DELETE on non-draft agent returns 403
  • Non-admin DELETE on another user's draft returns 403
  • Publish a draft agent directly: verify response includes lifecycleBypassed: true
  • Publish from staging: verify no bypass warning
  • Bulk-publish with mixed stages: verify bypass list in response

@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-phase4 branch from 4fd11a1 to 92a525c Compare May 21, 2026 17:18
@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 (7469ed0).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3225      +/-   ##
==========================================
+ Coverage   53.80%   53.82%   +0.01%     
==========================================
  Files        2362     2362              
  Lines       84772    84815      +43     
  Branches    23497    23511      +14     
==========================================
+ Hits        45612    45650      +38     
- Misses      37638    38822    +1184     
+ Partials     1522      343    -1179     
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...7469ed0. 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 2 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
@rrbanda rrbanda force-pushed the pr/lifecycle-hardening-phase4 branch from 9bbc6bb to 7469ed0 Compare May 21, 2026 18:03
@sonarqubecloud
Copy link
Copy Markdown

@pkliczewski pkliczewski merged commit 1ab1689 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