Improvement/mothership#4775
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR gates the "Mothership" beta artifact surfaces (workflow plans, changelogs, plan-alias VFS paths,
Confidence Score: 4/5Safe to merge; the flag defaults to off so existing deployments see no behavior change until MOTHERSHIP_BETA_FEATURES is set. The feature flag is correctly scoped as a server-only env var, and all gating points return safe defaults when the flag is absent. The one inefficiency is in router.ts where the registry copy is recreated on every tool execution call instead of once at startup, but this does not affect correctness. apps/sim/lib/copilot/tools/server/router.ts — the per-call registry copy. Important Files Changed
Reviews (1): Last reviewed commit: "System role in cache" | Re-trigger Greptile |
| function getServerToolRegistry(): Record<string, BaseServerTool> { | ||
| if (isMothershipBetaFeaturesEnabled) { | ||
| return baseServerToolRegistry | ||
| } | ||
| const registry = { ...baseServerToolRegistry } | ||
| delete registry[touchPlanServerTool.name] | ||
| return registry | ||
| } | ||
|
|
||
| export function getRegisteredServerToolNames(): string[] { | ||
| return Object.keys(serverToolRegistry) | ||
| return Object.keys(getServerToolRegistry()) | ||
| } |
There was a problem hiding this comment.
Since
isMothershipBetaFeaturesEnabled is evaluated once at module load and never changes, getServerToolRegistry() builds a new shallow copy of the registry object on every call to routeExecution and getRegisteredServerToolNames. The copy is cheap, but it's unnecessary allocation on every tool invocation. Computing the registry once at startup avoids this entirely.
| function getServerToolRegistry(): Record<string, BaseServerTool> { | |
| if (isMothershipBetaFeaturesEnabled) { | |
| return baseServerToolRegistry | |
| } | |
| const registry = { ...baseServerToolRegistry } | |
| delete registry[touchPlanServerTool.name] | |
| return registry | |
| } | |
| export function getRegisteredServerToolNames(): string[] { | |
| return Object.keys(serverToolRegistry) | |
| return Object.keys(getServerToolRegistry()) | |
| } | |
| const serverToolRegistry: Record<string, BaseServerTool> = (() => { | |
| if (isMothershipBetaFeaturesEnabled) { | |
| return baseServerToolRegistry | |
| } | |
| const registry = { ...baseServerToolRegistry } | |
| delete registry[touchPlanServerTool.name] | |
| return registry | |
| })() | |
| export function getRegisteredServerToolNames(): string[] { | |
| return Object.keys(serverToolRegistry) | |
| } |
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!
Summary
Brief description of what this PR does and why.
Fixes #(issue)
Type of Change
Testing
How has this been tested? What should reviewers focus on?
Checklist
Screenshots/Videos