Skip to content

fix(mothership): rebuild copilot VFS trigger/integration overviews per viewer#5694

Open
TheodoreSpeaks wants to merge 2 commits into
stagingfrom
fix/copilot-vfs-per-viewer-overviews
Open

fix(mothership): rebuild copilot VFS trigger/integration overviews per viewer#5694
TheodoreSpeaks wants to merge 2 commits into
stagingfrom
fix/copilot-vfs-per-viewer-overviews

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • Move the copilot VFS overview files (components/triggers/triggers.md, environment/oauth-integrations.json, environment/api-key-integrations.json) out of the frozen process-global cache and rebuild them per viewer, filtered through the caller's block visibility — so a revealed preview block now appears in the overview catalog, not just its per-file schema. Previously these were baked once at null visibility, leaving the catalog permanently incomplete for revealed-preview viewers (e.g. a sim tester with slack_v2 revealed saw the slack_oauth schema file but not the triggers.md row).
  • Reuse the existing per-file gating predicates (isHiddenUnder, isStaticFileHidden, filterExposedIntegrationTools) so an overview entry appears exactly when its per-file schema does.
  • Refactor the static-component cache into one atomic StaticComponents object bundling the file map plus the integration/trigger path-owner maps (previously three separate module globals with the owner maps populated as a side effect and never reset). Add resetStaticComponents so a rebuild clears files and owner maps together — no stale or double-populated owner maps.

Type of Change

  • Bug fix

Testing

Tested manually. tsc --noEmit clean, bun run lint and bun run check:api-validation:strict pass. Confirmed no LLM prompt-cache impact on the mothership side: these overview files are delivered only as on-demand VFS tool results appended to the transcript, never injected into a cached system-prompt prefix, so per-viewer rebuilds cannot invalidate a cached prefix (per-file schemas already varied per-viewer the same way).

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)

TheodoreSpeaks and others added 2 commits July 15, 2026 11:04
triggers.md and the oauth/api-key integration summaries were baked once
into the process-global static component cache under null visibility, so a
revealed-preview viewer got the per-trigger schema file but the trigger was
permanently missing from the overview catalog. Move these three aggregate
files out of getStaticComponentFiles and rebuild them per materialize in
buildViewerScopedComponentFiles, filtered through the viewer's visibility
(isHiddenUnder / isStaticFileHidden / filterExposedIntegrationTools) so an
overview entry appears exactly when its per-file schema does. Per-file
schemas stay in the shared ungated cache, include/exclude-filtered at stamp
time as before.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QCHVAfWcDYNQFbNMemQJwK
…to one resettable object

The static component files and their integration/trigger path-owner maps were
three separate module globals, with the owner maps populated as a side effect of
the file build and never reset. Bundle all three into one StaticComponents object
built and cached atomically, thread it through isStaticFileHidden and the
per-viewer overview builder, and add resetStaticComponents (test/hot-reload seam,
mirrors resetExposedIntegrationToolsCache) so a rebuild clears files and owner
maps together — no stale or double-populated owner maps.
@vercel

vercel Bot commented Jul 15, 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 Jul 15, 2026 7:23pm

Request Review

@cursor

cursor Bot commented Jul 15, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes copilot discovery content and cache lifecycle for preview-block visibility; scoped to VFS materialization and aligns overviews with existing per-file gating predicates.

Overview
Fixes copilot VFS catalog drift for viewers who have revealed preview blocks: overview files were frozen at null visibility, so per-file schemas could appear while triggers.md and the OAuth/API-key integration summaries stayed incomplete.

Viewer-scoped overviewscomponents/triggers/triggers.md, environment/oauth-integrations.json, and environment/api-key-integrations.json are no longer built in the process-global static cache. They are regenerated on each VFS materialize via buildViewerScopedComponentFiles, using the same visibility rules as stamp-time gating (isHiddenUnder, isStaticFileHidden, filterExposedIntegrationTools).

Atomic static cache — Per-file component schemas stay in a single StaticComponents object (files plus integration/trigger path-owner maps). resetStaticComponents() clears the bundle for tests/hot-reload so owner maps cannot go stale or double-populate.

Reviewed by Cursor Bugbot for commit d00860a. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes Copilot VFS overview files reflect each viewer’s block visibility. The main changes are:

  • Rebuild trigger and integration overviews per viewer.
  • Reuse schema visibility filters for overview entries.
  • Store static files and owner maps in one atomic cache.
  • Add a reset function for the static component cache.

Confidence Score: 5/5

This looks safe to merge.

  • The overview and schema visibility rules stay aligned for built-in triggers, external triggers, and integrations.
  • The previously questioned hideFromToolbar trigger case still exposes both the overview entry and its schema file.
  • No blocking issue was found in the updated code.

Important Files Changed

Filename Overview
apps/sim/lib/copilot/vfs/workspace-vfs.ts Builds viewer-specific overview files and keeps static files and ownership maps in one cache.

Reviews (2): Last reviewed commit: "improvement(mothership): bundle copilot ..." | Re-trigger Greptile

Comment thread apps/sim/lib/copilot/vfs/workspace-vfs.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit d00860a. Configure here.

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