Skip to content

fix(mship): add folder rename tools and locked workflow status#5126

Open
Sg312 wants to merge 2 commits into
stagingfrom
improvement/mship-tool-access
Open

fix(mship): add folder rename tools and locked workflow status#5126
Sg312 wants to merge 2 commits into
stagingfrom
improvement/mship-tool-access

Conversation

@Sg312

@Sg312 Sg312 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add manage folder tool and make locked workflow status clear
Companion: https://github.com/simstudioai/copilot/pull/321

Type of Change

  • New feature

Testing

Manual

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)

@vercel

vercel Bot commented Jun 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 (UTC)
docs Skipped Skipped Jun 18, 2026 5:42pm

Request Review

@github-actions github-actions Bot added the requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep label Jun 18, 2026
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

⚠️ Cross-repo companion check

One or more companion PRs aren't merged into staging yet. Merging this without them will leave copilot and sim out of sync — merge them in lockstep.

  • simstudioai/copilot#321OPEN, not merged (targets staging) — fix(mship): add folder rename tool and notify if workflow is locked

@greptile-apps

greptile-apps Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR consolidates the four separate folder tools (create_folder, delete_folder, move_folder, list_folders) into a single unified manage_folder tool that dispatches on an operation field, and adds folder/workflow lock status to the VFS by computing inherited folder locks and surfacing them in each workflow's meta.json.

  • manage_folder tool: Replaces four separate folder tools with one that accepts operation: create | rename | move | delete, resolving target and destination folders by either VFS path (e.g. workflows/Marketing/Q3) or direct folderId, with path resolution delegated to the same buildVfsFolderPathMap used by the VFS materializer.
  • Locked workflow status in VFS: computeLockedFolderIds walks each folder's ancestor chain in memory to determine which folders are effectively locked (directly or transitively), and serializeWorkflowMeta now emits locked and lockedBy ("workflow" or "folder") in meta.json so the agent can check lockedness before attempting mutations.
  • listFolders now includes locked: A one-line addition to the query in utils.ts feeds the new lock-propagation logic.

Confidence Score: 4/5

Safe to merge — the consolidation is internally consistent, the VFS lock computation is correct, and no existing behavior is broken beyond the removal of the now-superseded tools.

All path resolution logic round-trips correctly through the VFS encoding layer, the lock inheritance walk handles circular refs via a visited set, and the generated catalog/schema files are kept in sync. Two minor concerns: the MCP destructiveHint: false annotation on manage_folder misleads clients about the delete operation, and resolveWorkflowFolderIdByPath re-fetches all folders from the DB on each call, producing duplicate round-trips for move when both target and destination are path-addressed.

apps/sim/lib/copilot/tools/mcp/definitions.ts (destructiveHint annotation) and apps/sim/lib/copilot/tools/handlers/workflow/mutations.ts (DB call deduplication in path resolution).

Important Files Changed

Filename Overview
apps/sim/lib/copilot/tools/handlers/workflow/mutations.ts Adds executeManageFolder consolidating create/rename/move/delete into a single handler with VFS path resolution; path resolution logic is correct but makes redundant DB calls per operation
apps/sim/lib/copilot/tools/mcp/definitions.ts Replaces list_folders, create_folder, move_folder with unified manage_folder; destructiveHint: false is incorrect since the tool includes a delete operation
apps/sim/lib/copilot/vfs/workspace-vfs.ts Adds computeLockedFolderIds to propagate folder-level locks to contained workflows; logic is correct and threads inheritedFolderLock into serializeWorkflowMeta
apps/sim/lib/copilot/vfs/serializers.ts Extends serializeWorkflowMeta to emit locked and lockedBy fields; direct-lock and inherited-folder-lock are correctly combined
apps/sim/lib/copilot/generated/tool-catalog-v1.ts Removes CreateFolder/DeleteFolder/MoveFolder/ListFolders and replaces them with ManageFolder including operation enum and ManageFolderOperation constants
apps/sim/lib/copilot/generated/tool-schemas-v1.ts Runtime schemas updated in sync with catalog; manage_folder schema matches catalog definition correctly
apps/sim/app/workspace/[workspaceId]/home/hooks/stream/stream-helpers.ts Updates FOLDER_TOOL_NAMES and both display-title resolvers to handle ManageFolder's operation dispatch; consistent with existing Manage* tool patterns
apps/sim/lib/workflows/utils.ts Adds locked field to listFolders query output; straightforward and correct
apps/sim/lib/copilot/tool-executor/register-handlers.ts Handler registry updated to wire executeManageFolder to ManageFolder.id; old create/delete/move/list handlers removed cleanly
apps/sim/lib/copilot/tools/handlers/param-types.ts Removes ListFoldersParams, adds ManageFolderParams with correct optional fields for path/folderId/name/destinationPath/parentId
apps/sim/lib/copilot/tools/handlers/workflow/queries.ts Removes executeListFolders handler; listFolders import cleaned up; no regressions

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[manage_folder call] --> B{operation?}
    B -->|create| C[resolve parent via path or parentId]
    B -->|rename| D[resolveManageFolderTarget path to folderId]
    B -->|move| E[resolveManageFolderTarget + resolveManageFolderParent]
    B -->|delete| F[resolveManageFolderTarget path to folderId]
    C --> C2[executeCreateFolder]
    D --> D2[executeRenameFolder]
    E --> E2[executeMoveFolder]
    F --> F2[executeDeleteFolder]
    G[materializeWorkflows] --> H[listFolders incl. locked]
    H --> I[computeLockedFolderIds walks ancestor chain per folder]
    I --> J{folderId in lockedFolderIds?}
    J -->|yes| K[inheritedFolderLock=true]
    J -->|no| L[inheritedFolderLock=false]
    K --> M[serializeWorkflowMeta locked=true lockedBy=folder]
    L --> N[serializeWorkflowMeta locked=wf.locked lockedBy=workflow or undefined]
Loading
%%{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"}}}%%
flowchart TD
    A[manage_folder call] --> B{operation?}
    B -->|create| C[resolve parent via path or parentId]
    B -->|rename| D[resolveManageFolderTarget path to folderId]
    B -->|move| E[resolveManageFolderTarget + resolveManageFolderParent]
    B -->|delete| F[resolveManageFolderTarget path to folderId]
    C --> C2[executeCreateFolder]
    D --> D2[executeRenameFolder]
    E --> E2[executeMoveFolder]
    F --> F2[executeDeleteFolder]
    G[materializeWorkflows] --> H[listFolders incl. locked]
    H --> I[computeLockedFolderIds walks ancestor chain per folder]
    I --> J{folderId in lockedFolderIds?}
    J -->|yes| K[inheritedFolderLock=true]
    J -->|no| L[inheritedFolderLock=false]
    K --> M[serializeWorkflowMeta locked=true lockedBy=folder]
    L --> N[serializeWorkflowMeta locked=wf.locked lockedBy=workflow or undefined]
Loading

Reviews (1): Last reviewed commit: "fix(mship): add folder rename tools and ..." | Re-trigger Greptile

Comment thread apps/sim/lib/copilot/tools/mcp/definitions.ts Outdated
Comment thread apps/sim/lib/copilot/tools/handlers/workflow/mutations.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant