Skip to content

[dev] [Marfuen] mariano/sale-45-screenshot-automation-feature-improvements#2657

Closed
github-actions[bot] wants to merge 28 commits into
mainfrom
mariano/sale-45-screenshot-automation-feature-improvements
Closed

[dev] [Marfuen] mariano/sale-45-screenshot-automation-feature-improvements#2657
github-actions[bot] wants to merge 28 commits into
mainfrom
mariano/sale-45-screenshot-automation-feature-improvements

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

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

This is an automated pull request to merge mariano/sale-45-screenshot-automation-feature-improvements into dev.
It was created by the [Auto Pull Request] action.


Summary by cubic

Adds an audit overlay to automation screenshots and replaces stale full‑size links with a signed redirect to meet SALE‑45 auditor requirements. Also adds per‑automation evaluation criteria with pass/fail verdicts and clearer run errors, fixing “Access denied” and “evaluation error” cases.

  • New Features

    • Screenshot overlay bakes in UTC timestamp, source URL, and instruction; rendered via sharp with Comp AI branding.
    • Stable full‑size link: GET /v1/browserbase/runs/{runId}/screenshot issues a fresh 302 to a signed S3 URL; supports ?download=true. UI now links to this endpoint.
    • Optional evaluationCriteria on automations; runs produce pass/fail with a short reason when set. DTOs and OpenAPI updated.
    • Improved error messages: classify session-ended/timeouts and surface concise, user‑friendly text.
  • Migration

    • Run DB migration adding nullable BrowserAutomation.evaluationCriteria.
    • No breaking changes; API images now include fontconfig and fonts-dejavu-core so overlay text renders in production.

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

Marfuen and others added 28 commits April 22, 2026 11:29
Design doc covering three fixes: baked-in audit overlay (timestamp,
source URL, auditor requirement), stable redirect endpoint to replace
stale presigned URLs on "Open full size", and evaluation-error repair.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
11-task TDD plan: overlay module + integration, org-scoped redirect
service method + controller endpoint, RunItem href swap, eval-error
hardening, and final verification.

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…c failures

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… errors

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…isNoPage predicate, SVG dim safety)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…icons

ChevronDown, ExternalLink (as Launch), and ImageIcon now come from
@trycompai/design-system/icons (Carbon icons). @trycompai/ui/badge kept
since no DS equivalent exists.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The service was instantiating its own S3Client without credentials,
falling back to the default AWS credential chain which fails locally
and in most deployments. Reuse the shared s3Client / BUCKET_NAME from
@/app/s3 (same pattern as the rest of the API).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Left brand pillar with hex logo mark + "Comp AI" wordmark + "AUDIT TRAIL"
tag, vertical divider, info column on the right, and a thin brand-green
accent stripe at the bottom. Keeps the 88px total height so existing
tests remain valid.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Service now accepts a `download` flag that signs the S3 URL with a
ContentDisposition: attachment header so the browser downloads the
image instead of rendering it inline. Controller exposes the flag via
?download=true on the existing redirect endpoint. RunItem.tsx gets a
new Download link next to "Open full size".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Users can now set an optional natural-language "Evaluation Criteria"
on each BrowserAutomation. When set, runs use stagehand.extract() to
inspect the final page and produce a pass/fail verdict with a short
reason. When unset, runs just capture a screenshot with no verdict.

- schema: add BrowserAutomation.evaluationCriteria (nullable)
- service: executeAutomation runs the eval step when criteria present;
  drops the misleading "Navigation completed..." fallback reason when
  no criteria is configured
- dto: accept evaluationCriteria on create/update
- ui: add the field to the config dialog; hide the eval result block
  in RunItem unless a real pass/fail verdict was produced
- tests: cover the null-evaluationStatus UI path

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

next build reported: "Type 'string | undefined' is not assignable to
type 'string'" because .optional().default('') makes the zod input
type differ from the output type, which confuses zodResolver's Resolver
generic. Drop the .default() — defaultValues in useForm already supplies
the empty string.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nts' of https://github.com/trycompai/comp into mariano/sale-45-screenshot-automation-feature-improvements
…uction

The node:*-slim base images ship with zero fonts installed, so
librsvg falls back to .notdef glyphs and the overlay rendered as
□ □ □ boxes in production. Install fontconfig + fonts-dejavu-core
in both Dockerfiles and use "DejaVu Sans" explicitly in the SVG.

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

linear Bot commented Apr 24, 2026

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

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

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Apr 24, 2026 1:22pm
comp-framework-editor Ready Ready Preview, Comment Apr 24, 2026 1:22pm
portal Ready Ready Preview, Comment Apr 24, 2026 1:22pm

Request Review

@mintlify
Copy link
Copy Markdown
Contributor

mintlify Bot commented Apr 24, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
CompAI 🟢 Ready View Preview Apr 24, 2026, 1:22 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

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.

cubic analysis

1 issue found across 20 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="docs/plans/2026-04-22-sale-45-screenshot-automation-improvements.md">

<violation number="1" location="docs/plans/2026-04-22-sale-45-screenshot-automation-improvements.md:1024">
P2: The generic fallback error message is self-referential: it says "see run error details for specifics" but the `error` field _is_ the run error details — the raw error has been discarded (only logged server-side). The user would read this message and find no further specifics anywhere.

Consider either including a sanitised summary of the original error, or removing the misleading "see run error details" clause.</violation>
</file>

Linked issue analysis

Linked issue: SALE-45: Screenshot automation: feature improvements

Status Acceptance criteria Notes
Bake audit metadata into screenshot image: include timestamp renderOverlay supports capturedAt and tests assert timestamp rendering
Bake audit metadata into screenshot image: include source URL renderOverlay accepts sourceUrl and tests include sourceUrl prop
Bake audit metadata into screenshot image: include auditor requirement text (instruction) renderOverlay accepts instruction and tests assert instruction truncated/visible
Install fonts at runtime so sharp/librsvg can render text Dockerfiles add fontconfig and fonts-dejavu-core packages
⚠️ Integrate overlay rendering into automation capture/upload flow (bake into stored screenshot) renderOverlay imported into service, but usage in execute flow not fully shown
Replace stale presigned-URL 'Open full size' with stable redirect endpoint New controller endpoint /runs/:runId/screenshot and OpenAPI path added
Redirect endpoint mints a fresh presigned S3 URL (302 redirect) Service/controller add getSignedUrl usage and controller annotated for 302
⚠️ Support ?download=true to force attachment download on redirect Controller docs & OpenAPI include download param but implementation snippet truncated
Front-end 'Open full size' link points at stable redirect endpoint (not expired signed URL) RunItem builds /v1/browserbase/runs/:id/screenshot and tests assert it
Front-end download link uses stable endpoint with ?download=true RunItem defines downloadHref = `${fullSizeHref}?download=true`
Database schema stores evaluation criteria (evaluationCriteria column and migration) Prisma schema updated and SQL migration added
API DTOs accept evaluationCriteria on create/update Create/Update DTOs include optional evaluationCriteria fields
UI form allows entering evaluation criteria (create/edit dialog) BrowserAutomationConfigDialog schema and initialValues include evaluationCriteria
Add tests for overlay rendering, redirect, run-item links, and error formatting Multiple spec/test files added for overlay, service, controller, run item, formatter
⚠️ Diagnose and repair 'evaluation error' UI state (classify and surface run errors appropriately) run-error-formatter added and imported, but full fix in eval path not fully shown
OpenAPI docs updated to include new screenshot redirect endpoint openapi.json includes /v1/browserbase/runs/{runId}/screenshot path
Controller/service return 404 when run or screenshot not found Controller annotated with 404 response and NotFoundException used in tests

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

? 'Browser session ended before we could capture evidence. Please retry.'
: isTimeout
? 'Automation timed out before completing. Please retry — if this keeps happening, simplify the instruction or check the target site.'
: 'Automation failed to complete. Please retry — see run error details for specifics.';
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Apr 24, 2026

Choose a reason for hiding this comment

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

P2: The generic fallback error message is self-referential: it says "see run error details for specifics" but the error field is the run error details — the raw error has been discarded (only logged server-side). The user would read this message and find no further specifics anywhere.

Consider either including a sanitised summary of the original error, or removing the misleading "see run error details" clause.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/plans/2026-04-22-sale-45-screenshot-automation-improvements.md, line 1024:

<comment>The generic fallback error message is self-referential: it says "see run error details for specifics" but the `error` field _is_ the run error details — the raw error has been discarded (only logged server-side). The user would read this message and find no further specifics anywhere.

Consider either including a sanitised summary of the original error, or removing the misleading "see run error details" clause.</comment>

<file context>
@@ -0,0 +1,1093 @@
+        ? 'Browser session ended before we could capture evidence. Please retry.'
+        : isTimeout
+          ? 'Automation timed out before completing. Please retry — if this keeps happening, simplify the instruction or check the target site.'
+          : 'Automation failed to complete. Please retry — see run error details for specifics.';
+
+      return {
</file context>
Fix with Cubic

@Marfuen Marfuen closed this Apr 24, 2026
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.

1 participant