Skip to content

fix(copilot): read sandbox paths in files view and admit missing overwrite targets in multi-file exports - #9200

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/copilot-file-view-sandbox-and-overwrite-create
Oct 18, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/copilot-file-view-sandbox-and-overwrite-create

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • files view now routes absolute sandbox paths (/tmp/..., /home/user/...) to the same authorized chat scratch reader files read uses, rendered visually like the uploads/ branch. Before, they fell through to the workspace lookup and returned a misleading "File not found"
  • The sandbox-path predicate moves to isScratchReference in scratch-file-read.ts so files read and files view share one definition
  • validateWorkspaceFileWriteTarget now treats a not-found overwrite target as a create (same admission and target resolution as the create branch, reported as mode: 'create'), matching writeWorkspaceFileByPath, which has upserted since improvement(mothership): mothership v0.9 #6815. Before, a multi-file run_function export with mode: "overwrite" for a path that didn't exist yet failed up front with "File not found" after the user's code had already run
  • Other errors from the overwrite lookup (permission denials etc.) still propagate; a missing target still requires create permission, the same as the writer; the duplicate-destination check is unchanged

Type of Change

  • Bug fix

Testing

  • file-view.test.ts: files view /home/user/x.png reaches the scratch reader and never the workspace lookup (red with the guard reverted: workspace artifact read called)
  • resource-writer.test.ts: overwrite validation of a missing target resolves as create, and still refuses when create admission is denied (red with the guard reverted: rejects "File not found")
  • overwrite-export.integration.ts (real Postgres): a two-file Function export with an overwrite target in an empty folder creates the file; an existing overwrite target is still replaced in place
  • file-read.test.ts, execute-request.test.ts pass; check:test-patterns, check:comment-hygiene, check:file-names pass

Checklist

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

@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 18, 2026 9:08pm UTC

Request Review

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 7 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Routes absolute sandbox paths in files view through the existing authorized scratch reader. Missing overwrite targets now pass through the same create checks used by the writer.

  • Sandbox file views now read from the chat scratch machine.
  • Missing overwrite destinations now create files during Function exports.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  V["files view"] --> S{"Scratch path?"}
  S -->|Yes| R["Authorized chat scratch reader"]
  R --> O["Visual observation"]
  S -->|No| E["Existing upload or workspace reader"]
  W["Validate overwrite target"] --> F{"Target found?"}
  F -->|Yes| U["Keep overwrite target"]
  F -->|Not found| A["Require create permission"]
  A --> C["Resolve create destination"]
  U --> D["Check duplicate destinations"]
  C --> D
Loading

Reviews (1) · Last reviewed commit: "fix(copilot): read sandbox paths in file..." · Reviewed by Greptile

@waleedlatif1
waleedlatif1 merged commit 768141a into staging Oct 18, 2026
53 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/copilot-file-view-sandbox-and-overwrite-create branch October 18, 2026 22:12

This branch was previously deployed

1 inactive deployment
Preview — d2b29deb Deployed Oct 18, 2026 by vercel[bot]
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