Skip to content

Improvement/mothership#4775

Merged
Sg312 merged 2 commits into
devfrom
improvement/mothership
May 28, 2026
Merged

Improvement/mothership#4775
Sg312 merged 2 commits into
devfrom
improvement/mothership

Conversation

@Sg312
Copy link
Copy Markdown
Collaborator

@Sg312 Sg312 commented May 28, 2026

Summary

Brief description of what this PR does and why.

Fixes #(issue)

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

How has this been tested? What should reviewers focus on?

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)

Screenshots/Videos

@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 28, 2026 8:47pm

Request Review

@Sg312 Sg312 merged commit d550934 into dev May 28, 2026
8 of 9 checks passed
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 28, 2026

Greptile Summary

This PR gates the "Mothership" beta artifact surfaces (workflow plans, changelogs, plan-alias VFS paths, touch_plan server tool) behind a new MOTHERSHIP_BETA_FEATURES environment variable/feature flag, and upgrades the default copilot model from claude-opus-4-7 to claude-opus-4-8.

  • Feature flag (isMothershipBetaFeaturesEnabled): New MOTHERSHIP_BETA_FEATURES boolean env var is added to the schema and consumed in workspace-vfs.ts, router.ts, function-execute.ts, workflow-alias-resolver.ts, and touch-plan.ts to conditionally enable or suppress plan/changelog artifact behaviors.
  • Workspace context broadening: generateWorkspaceContext is now triggered for any branch that has a workspaceId (not just workspace-kind branches), and the resulting workspaceContext string is forwarded through both workflow and workspace buildPayload calls to the Go backend.
  • Model bump: Default copilot model updated to claude-opus-4-8 in post.ts, the MCP copilot route, and providers/models.ts (where it becomes the new recommended model).

Confidence Score: 4/5

Safe 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

Filename Overview
apps/sim/lib/copilot/tools/server/router.ts Renames registry constant and adds getServerToolRegistry() wrapper; copies the registry object on every invocation when the flag is false
apps/sim/lib/copilot/chat/post.ts Bumps DEFAULT_MODEL to claude-opus-4-8, fixes indentation, and broadens workspaceContextPromise to trigger on any branch that has a workspaceId (not just workspace branches)
apps/sim/lib/copilot/vfs/workspace-vfs.ts Large feature-flag gating: workflow-artifact paths (plans, changelog, alias links) are now skipped when isMothershipBetaFeaturesEnabled is false; materializeFiles still queries reserved system files unconditionally and filters at the app layer
apps/sim/lib/core/config/feature-flags.ts Adds isMothershipBetaFeaturesEnabled module-level constant read from new MOTHERSHIP_BETA_FEATURES env var
apps/sim/providers/models.ts Adds claude-opus-4-8 as recommended model; removes recommended flag from claude-opus-4-7
apps/sim/lib/copilot/tools/server/files/touch-plan.ts Adds early-exit guard when isMothershipBetaFeaturesEnabled is false; defense-in-depth since the router already removes the tool from the registry when the flag is off
apps/sim/lib/copilot/tools/handlers/function-execute.ts Replaces hardcoded true for includeReservedSystemFiles/Folders with isMothershipBetaFeaturesEnabled flag

Reviews (1): Last reviewed commit: "System role in cache" | Re-trigger Greptile

Comment on lines +163 to 174
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())
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Suggested change
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!

@waleedlatif1 waleedlatif1 deleted the improvement/mothership branch May 29, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant