fix(copilot): make stored MIME the source of truth for workspace file writes - #6470
fix(copilot): make stored MIME the source of truth for workspace file writes#6470j15z wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview
Regression tests cover create-file MIME enforcement and edit-content type preservation. Reviewed by Cursor Bugbot for commit 9c6495a. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR makes the stored MIME type authoritative for Copilot workspace-file writes and requires callers to declare a normalized MIME when creating files.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issue identified in the changed paths. The create path validates and consistently persists declared MIME values, the edit path preserves the authoritative stored type, and the removed workspace_file create branch was already unreachable under the generated schema.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/copilot/tools/server/files/create-file.ts | Requires an explicit MIME, normalizes and shape-validates it, and passes the normalized value consistently into the VFS writer. |
| apps/sim/lib/copilot/tools/server/files/edit-content.ts | Replaces filename-extension inference with the stored file-record MIME while retaining explicit content-type conversion behavior. |
| apps/sim/lib/copilot/tools/server/files/workspace-file.ts | Removes an unreachable create branch and extension-to-MIME inference while retaining existing update, append, patch, rename, and delete behavior. |
| apps/sim/lib/copilot/generated/tool-catalog-v1.ts | Updates generated tool documentation and requires mimeType in create_file output declarations. |
| apps/sim/lib/copilot/generated/tool-schemas-v1.ts | Mirrors the generated catalog contract by requiring mimeType for output-file creation. |
| apps/sim/lib/copilot/tools/server/files/create-file.test.ts | Covers missing, malformed, normalized, legacy, and missing-path create-file inputs. |
| apps/sim/lib/copilot/tools/server/files/edit-content.test.ts | Covers stored-type preservation, explicit conversion, patch writes, and absent-intent failure. |
Sequence Diagram
sequenceDiagram
participant M as Mothership
participant C as create_file
participant W as Workspace storage
participant F as workspace_file
participant E as edit_content
M->>C: path + explicit mimeType
C->>C: normalize and validate MIME
C->>W: create file with stored MIME
M->>F: select existing file for update/patch
F->>E: store and consume file intent
E->>W: read existing file record
E->>E: use explicit conversion MIME or stored MIME
E->>W: write content and authoritative MIME
Reviews (1): Last reviewed commit: "fix(copilot): make stored MIME the sourc..." | Re-trigger Greptile
f03bddc to
9c6495a
Compare
Summary
edit_contentnow preserves the record's storedcontent_type; an explicitcontentTypeis the only way to change itcreate_filenow requires an explicit MIME — normalized (params stripped, lowercased) and shape-validated — instead of inferring from the name's extension; deletes the ext->MIME fallback and the unreachableworkspace_file 'create'branchmimeTyperequired onoutputs.files); includes a 2-line upstream OAuth description ride-along from mothership v0.8.10Type of Change
Testing
Deploy note
The mothership companion PR must merge first (to mothership staging): simstudioai/mothership#422. With old mothership + new sim, mimeType-less
create_filecalls fail with a self-describing error until the updated schema/prompt land; non-interactive replays would fail hard.Checklist
🤖 Generated with Claude Code