Skip to content

[comp] Production Deploy#2562

Merged
tofikwest merged 11 commits into
releasefrom
main
Apr 16, 2026
Merged

[comp] Production Deploy#2562
tofikwest merged 11 commits into
releasefrom
main

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Apr 15, 2026

This is an automated pull request to release the candidate branch into production, which will trigger a deployment.
It was created by the [Production PR] action.


Summary by cubic

Move remediation preview and single-fix execution to Trigger.dev background tasks with live progress to avoid browser timeouts. Add Azure OAuth auto-refresh and make token refresh more robust; fix Trigger.dev maxDuration units and trust session data in server actions.

  • New Features

    • Added remediate-preview and remediate-single tasks in @trigger.dev/sdk that call the preview/execute endpoints with a service token and sync progress via metadata.
    • Added startPreview and startSingleFix server actions that trigger the tasks and return a public access token for run streaming.
    • RemediationDialog now streams both preview and execute progress via useRealtimeRun from @trigger.dev/react-hooks, handling success, failures, and permission errors.
  • Bug Fixes

    • Use seconds for Trigger.dev maxDuration: single (5m) and batch (30m).
    • Azure remediation: auto-refresh OAuth tokens via getValidAzureToken() with fallback to legacy service principal; applied to preview/execute and rollback with clearer reconnect errors.
    • Credential vault: prefer activeCredentialVersionId, retry token refresh once with 2s backoff and log provider error body; mark connection as error on 400/401/403.
    • Security: derive organizationId from session (not client input) and send acknowledgment only when provided.

Written for commit 96550c7. Summary will update on new commits.

github-actions Bot and others added 4 commits April 15, 2026 15:27
Single-finding auto-fix previously ran entirely within one HTTP request
(3-5 LLM calls + cloud API writes = 5-45 seconds), risking browser
timeouts. Batch remediation already used Trigger.dev correctly.

Changes:
- New `remediate-single` Trigger.dev task that calls the existing execute
  endpoint via service token (mirrors remediate-batch pattern)
- New `startSingleFix` server action that triggers the task and returns
  a public access token for real-time progress
- RemediationDialog now uses useRealtimeRun to watch task progress
  instead of blocking on a synchronous API call

Preview stays synchronous (needed for UI, within browser limits).
All edge cases preserved: permission errors, retry with IAM propagation
wait, guided-only mode, dialog close during execution, success with
re-scan trigger.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…econds

Trigger.dev maxDuration is in seconds. remediate-single had 300,000s
(~3.5 days) instead of 300s (5 minutes). Also fixes same pre-existing
bug in remediate-batch: 1,800,000s → 1,800s (30 minutes).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…r-dev

fix(cloud-tests): move single-finding remediation to Trigger.dev
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 15, 2026

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

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

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.

2 issues found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/app/src/app/(app)/[orgId]/cloud-tests/actions/single-fix.ts">

<violation number="1" location="apps/app/src/app/(app)/[orgId]/cloud-tests/actions/single-fix.ts:23">
P1: Do not trust `organizationId` from server-action input for a privileged remediation trigger. Derive the organization from the authenticated session and reject requests without an active organization.</violation>
</file>

<file name="apps/app/src/trigger/tasks/cloud-security/remediate-single.ts">

<violation number="1" location="apps/app/src/trigger/tasks/cloud-security/remediate-single.ts:61">
P2: Do not default a missing acknowledgment to `'acknowledged'`; this bypasses explicit confirmation semantics for an infrastructure-changing action.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread apps/app/src/app/(app)/[orgId]/cloud-tests/actions/single-fix.ts
Comment thread apps/app/src/trigger/tasks/cloud-security/remediate-single.ts Outdated
tofikwest and others added 3 commits April 15, 2026 17:25
Azure remediation was using getDecryptedCredentials() which returns
raw stored tokens without checking expiry or refreshing. This caused
"OAuth token expired" errors and connection status changes to 'error'.

Now uses getValidAzureToken() (mirrors GCP's getValidGcpToken() pattern):
- Checks token expiry with 5-minute buffer
- Auto-refreshes via OAuth refresh_token if expired
- Falls back to legacy service principal flow
- Applied to resolveContext (preview/execute) and rollback

GCP already had this pattern. AWS uses IAM roles (no expiry issue).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ging

Three issues fixed in the credential vault:

1. No retry on refresh failure — a single transient 400/401 from
   Google/Microsoft would permanently kill the connection. Now retries
   once after 2s before marking as error.

2. Error response body was discarded — logged "HTTP 400" but threw away
   the actual error from the provider (e.g., "invalid_grant"). Now logs
   the full response body for debugging.

3. getDecryptedCredentials ignored activeCredentialVersionId — always
   fetched by highest version number instead of the explicitly marked
   active version. Now prefers activeCredentialVersionId with fallback.

These affect ALL OAuth integrations (GCP, Azure, Slack, Google
Workspace, etc.), not just cloud tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fix(cloud-tests): add OAuth token auto-refresh to Azure remediation
tofikwest and others added 2 commits April 15, 2026 22:46
…cknowledgment

- organizationId now comes from session.activeOrganizationId instead of
  untrusted client input (security fix)
- Removed 'acknowledged' default for missing acknowledgment — the
  execute endpoint should receive exactly what the user provided

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ning

fix(cloud-tests): derive organizationId from session, remove acknowledgment default
tofikwest and others added 2 commits April 15, 2026 23:21
…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>
…er-dev

fix(cloud-tests): move remediation preview to Trigger.dev
@vercel vercel Bot temporarily deployed to staging – portal April 16, 2026 03:29 Inactive
@tofikwest tofikwest merged commit 6a42a6e into release Apr 16, 2026
14 checks passed
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants