Skip to content

fix(cloud-tests): move remediation preview to Trigger.dev#2567

Merged
tofikwest merged 1 commit intomainfrom
fix/remediation-preview-trigger-dev
Apr 16, 2026
Merged

fix(cloud-tests): move remediation preview to Trigger.dev#2567
tofikwest merged 1 commit intomainfrom
fix/remediation-preview-trigger-dev

Conversation

@tofikwest
Copy link
Copy Markdown
Contributor

@tofikwest tofikwest commented Apr 16, 2026

Summary

The "Preparing fix plan" step (preview) runs 3+ LLM calls + cloud API reads + permission analysis, often taking 50-70+ seconds — exceeding browser timeout limits and causing silent failures ("Failed to load preview").

Now both preview AND execute run as Trigger.dev background tasks with real-time progress via websocket. Zero browser timeout risk for the entire remediation flow.

Changes

File What
remediate-preview.ts (new) Trigger.dev task — calls /v1/cloud-security/remediation/preview via service token, streams result via metadata
single-fix.ts (action) Added startPreview() server action (same pattern as startSingleFix)
RemediationDialog.tsx Two separate useRealtimeRun hooks: one for preview, one for execute. Removed all synchronous api.post calls.

What changed for the user

Nothing visible — same UI, same loading animation, same preview display. The only difference is it won't silently fail after 60 seconds.

Edge cases

  • Guided-only mode — unchanged, no API call needed (local data)
  • Permission recheck — also runs through Trigger.dev (passes cachedPermissions to skip AI re-analysis)
  • Dialog close during preview — task continues, state cleans up on reopen
  • Preview task failure — shows error message (same as before)

Test plan

  • Open Fix dialog for a finding → "Preparing fix plan" animation shows → preview loads via Trigger.dev → current/proposed state displayed
  • Click Apply Fix → executes via Trigger.dev → success shown
  • Preview with missing permissions → permission panel shown → Recheck button works (also via Trigger.dev)
  • Guided-only findings → manual steps shown without any API call
  • Close dialog during preview → reopen → fresh preview starts

🤖 Generated with Claude Code


Summary by cubic

Move the remediation preview to a @trigger.dev background task with real-time progress to eliminate browser timeout failures during “Preparing fix plan.” Preview and execute now follow the same async task pattern.

  • Refactors
    • Added remediate-preview Trigger.dev task (3-minute max) calling /v1/cloud-security/remediation/preview with a service token and streaming progress via metadata.
    • Introduced startPreview() server action in single-fix.ts that returns a run ID and public token via @trigger.dev/sdk.
    • Updated RemediationDialog to use separate useRealtimeRun hooks for preview and execute (@trigger.dev/react-hooks), removed direct api.post calls, and routed rechecks with cachedPermissions through Trigger.dev.
    • No UI changes; long previews no longer fail silently, and tasks continue if the dialog is closed.

Written for commit ef88b91. Summary will update on new commits.

…owser timeout

The "Preparing fix plan" step (preview) runs 3+ LLM calls + cloud API
reads + permission analysis, often taking 50-70+ seconds — exceeding
browser timeout limits and causing silent failures.

Changes:
- New `remediate-preview` Trigger.dev task (3-minute max duration)
- New `startPreview` server action in single-fix.ts
- RemediationDialog now uses two separate useRealtimeRun hooks:
  one for preview, one for execute — both fully async
- Recheck flow (cachedPermissions) also runs through Trigger.dev
- Guided-only mode unchanged (no API call needed)
- Removed direct api.post calls — no more synchronous HTTP for either
  preview or execute

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Apr 16, 2026 3:23am
comp-framework-editor Ready Ready Preview, Comment Apr 16, 2026 3:23am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped Apr 16, 2026 3:23am

Request Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Requires human review: This is a significant architectural refactor that moves a core feature (remediation preview) to background tasks, requiring human verification of the new async flow.

@tofikwest tofikwest merged commit 96550c7 into main Apr 16, 2026
11 checks passed
@tofikwest tofikwest deleted the fix/remediation-preview-trigger-dev branch April 16, 2026 03:29
@claudfuen
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.22.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants