feat(copilot): provide accessible workspaces to agents - #6222
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview A new Interactive chat ( Reviewed by Cursor Bugbot for commit d25f790. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryAgents now receive a stable list of active workspaces accessible to the authenticated user, including effective permissions, across interactive Copilot and internal Mothership execution paths. The lookup degrades to omitted context on failure and is explicitly skipped for external inbox senders.
Confidence Score: 5/5The PR appears safe to merge with the new workspace context scoped to resolved users and omitted for external inbox senders. The shared lookup filters to active accessible workspaces, computes effective permissions through the established workspace utility, degrades to omitted optional context on failure, and preserves independent authorization checks for actions.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/copilot/chat/accessible-workspaces.ts | Adds a safely degrading, deterministically sorted projection of active accessible workspaces and effective permissions. |
| apps/sim/lib/copilot/chat/post.ts | Loads the workspace list for the session-authenticated user and forwards it through both interactive Copilot branches. |
| apps/sim/app/api/mothership/execute/route.ts | Adds accessible-workspace context to authenticated headless Mothership execution payloads. |
| apps/sim/lib/copilot/chat/payload.ts | Extends Copilot payload construction to conditionally forward nonempty accessible-workspace lists. |
| apps/sim/lib/mothership/inbox/executor.ts | Includes the list for workspace-member senders while omitting it for external senders using owner execution fallback. |
Sequence Diagram
sequenceDiagram
participant User as Authenticated user
participant Sim as Sim request handler
participant DB as Workspace authorization data
participant Agent as Mothership agent
Sim->>DB: List active accessible workspaces by authenticated user ID
DB-->>Sim: id, name, effective permission
alt Lookup succeeds with results
Sim->>Agent: Runtime payload with accessibleWorkspaces
else Lookup fails or returns empty
Sim->>Agent: Runtime payload without accessibleWorkspaces
end
Note over Sim,Agent: External inbox senders always take the omission path
Reviews (1): Last reviewed commit: "feat(copilot): send accessible workspace..." | Re-trigger Greptile
|
Superseded by the focused tool-based approach in #5948. |
Summary
Agents now receive the authenticated user's active accessible workspaces as
{ id, name, permission }runtime context, allowing main agents and subagents to answer workspace-access questions without another lookup. The list uses effective permissions, degrades safely if the informational lookup fails, and is omitted for external inbox senders so the workspace owner's other workspaces cannot leak.Companion runtime consumer: simstudioai/mothership#391
Deployment order: merge and deploy Mothership first, then Sim.
Type of Change
Testing
bunx vitest run lib/copilot/chat/accessible-workspaces.test.ts lib/copilot/chat/payload.test.ts lib/copilot/chat/post.test.ts app/api/mothership/execute/route.test.ts lib/mothership/inbox/executor.test.ts— 43 tests passedbunx --bun tsc --noEmit --pretty falsebun run check:api-validationReview focus: authenticated-user scoping and omission of cross-workspace context for external inbox senders.
Checklist
Screenshots/Videos
Not applicable — agent runtime context only.