Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR introduces two related improvements to the copilot VFS layer: lazy materialization of expensive per-workflow/KB artifacts (state.json, lint.json, executions.json, deployment.json, documents.json, connectors.json) so that
Confidence Score: 4/5Safe to merge. The lazy VFS is well-scoped (fresh instance per tool call eliminates cross-request sharing concerns), the deterministic WORKSPACE.md serialization is correct, and the async method signatures are properly awaited in all callers. The two notable gaps are the use of denormalized signals ( apps/sim/lib/copilot/vfs/workspace-vfs.ts — the denormalized-gate and error-logging points are both here. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant H as VFS Handler
participant V as WorkspaceVFS
participant L as lazy Map
participant F as files Map
Note over V: materialize() — always fresh per tool call
V->>F: set eager artifacts (metadata, WORKSPACE.md, folder markers)
V->>L: registerLazy(state.json, lint.json, executions.json, ...)
H->>V: read("workflows/foo/state.json")
V->>V: resolveLazyPath(path)
V->>L: get(path) → loader
V->>L: delete(path)
V->>F: await loader() → set(path, content)
V-->>H: ReadResult
H->>V: "glob("workflows/**")"
V->>V: keyView(false) — eager + lazy keys, no content load
V-->>H: string[] (paths only)
H->>V: grep("pattern", "workflows/foo")
V->>V: resolveLazyWithinScope("workflows/foo")
loop for each lazy path in scope
V->>L: delete(path)
V->>F: await loader() → set(path, content)
end
V->>F: activeFiles() — all resolved files
V-->>H: GrepMatch[]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant H as VFS Handler
participant V as WorkspaceVFS
participant L as lazy Map
participant F as files Map
Note over V: materialize() — always fresh per tool call
V->>F: set eager artifacts (metadata, WORKSPACE.md, folder markers)
V->>L: registerLazy(state.json, lint.json, executions.json, ...)
H->>V: read("workflows/foo/state.json")
V->>V: resolveLazyPath(path)
V->>L: get(path) → loader
V->>L: delete(path)
V->>F: await loader() → set(path, content)
V-->>H: ReadResult
H->>V: "glob("workflows/**")"
V->>V: keyView(false) — eager + lazy keys, no content load
V-->>H: string[] (paths only)
H->>V: grep("pattern", "workflows/foo")
V->>V: resolveLazyWithinScope("workflows/foo")
loop for each lazy path in scope
V->>L: delete(path)
V->>F: await loader() → set(path, content)
end
V->>F: activeFiles() — all resolved files
V-->>H: GrepMatch[]
|
Build the workspace inventory from the primary db (fixes replica-lag staleness) and emit it as a typed VfsSnapshotV1 `vfs` payload alongside the markdown, so the mothership can diff it into append-only baseline/delta messages. Generate the TS contract mirror from the Go-owned JSON schema (sync-vfs-snapshot-contract) and sort connector types so diffs stay byte-stable.
The branch buildPayload implementations hand-list the params they pass to buildCopilotRequestPayload and forwarded workspaceContext but dropped vfs, so the typed snapshot never reached the Go request (req.Vfs was always nil and the append-only delta path never engaged). Forward vfs in both the workflow and workspace branches, and add a regression guard asserting the branch threads it through (the bug slipped past tests because post.test mocked the payload builder and payload.test called it directly, bypassing the branch).
|
Summary
Adds lazy vfs and vfs deltas for prompt caching
Companion: https://github.com/simstudioai/mothership/pull/330
Type of Change
Testing
Manual
Checklist