Skip to content

fix(copilot): surface document render failures - #6629

Merged
j15z merged 3 commits into
stagingfrom
fix/render-failure-signaling
Aug 12, 2026
Merged

fix(copilot): surface document render failures#6629
j15z merged 3 commits into
stagingfrom
fix/render-failure-signaling

Conversation

@j15z

@j15z j15z commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

When document rendering fails, the file agent now receives a failed vfs_read tool call with the real compiler or renderer error. Previously, the VFS returned that failure as successful JSON content, so the agent could continue without a rendered reference and misdiagnose the problem.

The error remains inside the existing provenance envelope, so this hardening does not bypass workspace-file access or secret checks.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • 130 VFS tests passed across 10 test files.
  • Biome passed on all five changed files.
  • bun run check:api-validation passed.
  • The full app TypeScript check reported errors only in unchanged HEIC and provider files on this staging checkout; it reported none in the changed VFS files.

Reviewer focus: verify that a /render exception stays provenance-aware while crossing the VFS boundary as a failed tool call.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

Not applicable; this changes backend tool error signaling.


Compound Engineering

@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 12, 2026 6:30pm

Request Review

@cursor

cursor Bot commented Aug 12, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Copilot tool signaling only; provenance and secret checks run before surfacing dynamic read errors. No auth or data-model changes.

Overview
Document render and validation failures now fail vfs_read instead of returning success with {ok:false} JSON, so the file agent sees the real compiler/renderer message instead of treating the read as successful.

FileReadResult gains an optional error field. Workspace VFS dynamic reads (especially /render) populate it via a shared renderErrorResult helper for size limits, unsupported types, missing sandbox tasks, and caught exceptions—still inside the provenance envelope. executeVfsRead returns { success: false, error } only after secret provenance checks pass; if provenance cannot be verified, the generic safe-sharing error is returned and the underlying render error is not leaked.

Tests cover the VFS handler boundary and WorkspaceVFS render error paths.

Reviewed by Cursor Bugbot for commit 3ad89f2. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR changes document-render failures from successful VFS responses containing error JSON into failed tool calls, while retaining workspace-file provenance validation before detailed errors are returned.

  • Adds an optional dynamic-read error field to the VFS read-result contract.
  • Propagates render exceptions through the workspace VFS and converts them into failed vfs_read calls.
  • Adds coverage for render failures and blocked provenance.

Confidence Score: 5/5

The PR appears safe to merge.

The previously reported provenance bypass is fixed: render failures associated with resolved workspace files retain their identity and undergo provenance validation before the detailed error is returned, with a generic safe failure used when validation fails.

Important Files Changed

Filename Overview
apps/sim/lib/copilot/tools/handlers/vfs.ts Converts dynamic-read errors into failed tool calls only after the existing provenance check.
apps/sim/lib/copilot/vfs/workspace-vfs.ts Preserves render exceptions in the VFS result and binds file identity whenever rendering reached a resolved workspace file.
apps/sim/lib/copilot/vfs/file-reader.ts Extends the internal read-result contract with an optional dynamic-view error.
apps/sim/lib/copilot/tools/handlers/vfs.test.ts Covers failed-tool-call signaling and generic-error fallback when provenance verification fails.
apps/sim/lib/copilot/vfs/workspace-vfs.test.ts Covers conversion of renderer exceptions into explicit VFS read errors.

Sequence Diagram

sequenceDiagram
  participant Agent as File Agent
  participant Handler as executeVfsRead
  participant VFS as WorkspaceVFS
  participant Renderer as Document Renderer
  participant Provenance as Provenance Gate
  Agent->>Handler: vfs_read(/render)
  Handler->>VFS: readFileContentWithProvenance
  VFS->>Renderer: render document
  Renderer-->>VFS: throw render error
  VFS-->>Handler: bound file identity + error result
  Handler->>Provenance: validate derived model view
  alt provenance accepted
    Provenance-->>Handler: allowed
    Handler-->>Agent: failed tool call with render error
  else provenance unavailable
    Provenance-->>Handler: denied
    Handler-->>Agent: failed tool call with generic safe error
  end
Loading

Reviews (2): Last reviewed commit: "Address PR review feedback (#6629)" | Re-trigger Greptile

Comment thread apps/sim/lib/copilot/tools/handlers/vfs.ts Outdated
Comment thread apps/sim/lib/copilot/tools/handlers/vfs.ts Outdated
- validate render errors against workspace-file provenance before returning details\n- cover blocked provenance with a regression test
@j15z

j15z commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

This PR should not merge until failed render results pass the same workspace-file provenance validation as successful reads.

Addressed in b893927: detailed render errors now pass the existing workspace-file provenance gate before reaching the model, and a regression test covers provenance-blocked error envelopes.

@j15z

j15z commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

@j15z

j15z commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b893927. Configure here.

Comment thread apps/sim/lib/copilot/vfs/file-reader.ts
- mark every non-throwing render failure as a failed dynamic read\n- cover all soft render failure paths with producer-level tests\n\nNote: pre-existing type-check failures in HEIC and provider files are not addressed by this PR.
@j15z
j15z merged commit 0e65ca3 into staging Aug 12, 2026
29 checks passed
@j15z
j15z deleted the fix/render-failure-signaling branch August 12, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant