GeezerVison is showing github.com — fix(mothership): fix workflow vfs reads by Sg312 · Pull Request #4156 · simstudioai/sim
Conversation
Sg312
commented
Apr 14, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
Fix nested workflow reads in vfs
Type of Change
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)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
greptile-apps[bot] reacted with thumbs up emoji
…ership workflow edits via sockets, ui improvements
…ng improvements, posthog, secrets mutations
…ration, signup method feature flags, SSO improvements
* feat(posthog): Add tracking on mothership abort (#4023)
Co-authored-by: Theodore Li <[email protected]>
* fix(login): fix captcha headers for manual login (#4025)
* fix(signup): fix turnstile key loading
* fix(login): fix captcha header passing
* Catch user already exists, remove login form captcha
…nts, secrets performance, polling refactors, drag resources in mothership
* feat(transport): replace shared chat transport with mothership-stream module
* improvement(contracts): regenerate contracts from go
* feat(tools): add tool catalog codegen from go tool contracts
* feat(tools): add tool-executor dispatch framework for sim side tool routing
* feat(orchestrator): rewrite tool dispatch with catalog-driven executor and simplified resume loop
* feat(orchestrator): checkpoint resume flow
* refactor(copilot): consolidate orchestrator into request/ layer
* refactor(mothership): reorganize lib/copilot into structured subdirectories
* refactor(mothership): canonical transcript layer, dead code cleanup, type consolidation
* refactor(mothership): rebase onto latest staging
* refactor(mothership): rename request continue to lifecycle
* feat(trace): add initial version of request traces
* improvement(stream): batch stream from redis
* fix(resume): fix the resume checkpoint
* fix(resume): fix resume client tool
* fix(subagents): subagent resume should join on existing subagent text block
* improvement(reconnect): harden reconnect logic
* fix(superagent): fix superagent integration tools
* improvement(stream): improve stream perf
* Rebase with origin dev
* fix(tests): fix failing test
* fix(build): fix type errors
* fix(build): fix build errors
* fix(build): fix type errors
* feat(mothership): add cli execution
* fix(mothership): fix function execute tests
…ions, jira forms endpoints
vercel
Bot
commented
Apr 14, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.
Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.
🔎 Detected hardcoded secret in your pull request
| GitGuardian id |
GitGuardian status |
Secret |
Commit |
Filename |
|
| 29606901 |
Triggered |
Generic High Entropy Secret |
a54dcbe |
apps/sim/providers/utils.test.ts |
View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Greptile Summary
This PR refactors the Mothership/copilot chat stack: it introduces a canonical message-persistence layer (persisted-message.ts, display-message.ts), extends the VFS serializer library with connectors, deployments, skills, jobs, and task-session entries, adds MCP server CRUD and deployment-version revert tools, and wires credential-aware env-var filtering into environment/utils.ts. All remaining findings are P2 style issues.
Confidence Score: 5/5
- Safe to merge; all findings are P2 style/convention issues with no functional impact.
- Auth flows, rate limiting, and data-access patterns are correct. The only issues found are
crypto.randomUUID() used in place of the project-mandated generateId() (five occurrences across two files) and one any cast in a serializer — none of these affect runtime correctness.
- apps/sim/lib/copilot/chat/post.ts and apps/sim/lib/copilot/chat/persisted-message.ts (crypto.randomUUID usages)
Important Files Changed
| Filename |
Overview |
| apps/sim/lib/copilot/chat/post.ts |
Unified chat POST handler refactored to support both workflow and workspace branches; uses crypto.randomUUID() on lines 542, 695, 696 instead of the required generateId(). |
| apps/sim/lib/copilot/chat/persisted-message.ts |
New message persistence layer with canonical/legacy block normalization; crypto.randomUUID() used on lines 174 and 460 instead of the project-mandated generateId(). |
| apps/sim/lib/copilot/vfs/serializers.ts |
Extensive VFS serializer additions (connectors, deployments, skills, jobs, task sessions); serializeTaskChat uses (block as any) type casts where Record<string, unknown> would be correct. |
| apps/sim/lib/copilot/tools/handlers/deployment/manage.ts |
Adds MCP server CRUD operations and deployment version inspection/revert tools; correctly uses generateId() and has proper access-control guards on each operation. |
| apps/sim/lib/environment/utils.ts |
Adds credential-aware environment variable filtering and a short-lived in-process cache for decrypted env vars; implementation looks correct and follows project conventions. |
| apps/sim/app/api/mcp/copilot/route.ts |
MCP copilot server with OAuth and API-key auth, rate limiting, and subagent/direct-tool routing; auth flows, rate limiting, and error surfaces all look correct. |
Sequence Diagram
sequenceDiagram
participant Client
participant PostHandler as lib/copilot/chat/post.ts
participant PersistedMsg as persisted-message.ts
participant DisplayMsg as display-message.ts
participant DB as copilotChats (DB)
participant Orchestrator as Copilot Orchestrator
participant VFS as workspace-vfs.ts
Client->>PostHandler: POST /api/copilot/chat
PostHandler->>PostHandler: "resolveBranch (workflow | workspace)"
PostHandler->>DB: persistUserMessage
PostHandler->>Orchestrator: createSSEStream
Orchestrator-->>PostHandler: OrchestratorResult (onComplete)
PostHandler->>PersistedMsg: buildPersistedAssistantMessage(result)
PostHandler->>DB: finalizeAssistantTurn (upsert messages)
Client->>DisplayMsg: load chat history
DisplayMsg->>PersistedMsg: normalizeMessage(rawRecord)
DisplayMsg-->>Client: ChatMessage[]
Client->>VFS: read("workflows/…/state.json")
VFS->>DB: loadWorkflowFromNormalizedTables
VFS-->>Client: serialized VFS content
Loading
Comments Outside Diff (3)
-
apps/sim/lib/copilot/chat/persisted-message.ts, line 174 (link)
crypto.randomUUID() violates project ID generation rule
The project requires using generateId() from @/lib/core/utils/uuid instead of crypto.randomUUID() directly. The same violation appears at line 460 of this file. generateId() already exists and works identically, including in non-secure (HTTP) browser contexts.
Also fix line 460:
id: (raw.id as string) ?? generateId(),
Add the import at the top of the file:
import { generateId } from '@/lib/core/utils/uuid'
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
-
apps/sim/lib/copilot/chat/post.ts, line 542 (link)
crypto.randomUUID() violates project ID generation rule
crypto.randomUUID() is used on this line, and again on lines 695–696. The project mandates generateId() from @/lib/core/utils/uuid for all ID generation. generateId is already imported at the top of this file and should be used consistently.
Also update lines 695–696:
const executionId = generateId()
const runId = generateId()
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
-
apps/sim/lib/copilot/vfs/serializers.ts, line 934-937 (link)
any cast violates TypeScript conventions
block is already narrowed to object by the preceding guard, so it can be safely cast to Record<string, unknown> instead of using any.
Context Used: TypeScript conventions and type safety (source)
Reviews (1): Last reviewed commit: "Merge branch 'staging', remote-tracking ..." | Re-trigger Greptile
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This branch was successfully deployed
1 active
deployment
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|