feat: context workspaces#1035
Conversation
🦋 Changeset detectedLatest commit: 937ff4b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This comment has been minimized.
This comment has been minimized.
📝 WalkthroughWalkthroughPropagates runtime operationContext through workspace toolkits (sandbox, search, skills). OperationContext is added to sandbox execute options and threaded into search and skills flows (indexing, querying, discovery, loading, activation, file reads), enabling tenant-aware routing at runtime. Changes
Sequence Diagram(s)sequenceDiagram
participant Agent as Agent
participant Toolkit as Workspace Toolkit
participant Sandbox as WorkspaceSandbox
participant Search as WorkspaceSearch
participant Skills as WorkspaceSkills
participant FS as Filesystem Backend
Agent->>Toolkit: invoke tool (includes operationContext)
Toolkit->>Sandbox: sandbox.execute(..., operationContext)
Toolkit->>Search: search.index/search(..., context: {operationContext})
Toolkit->>Skills: skills.discover/load/... (options with context)
Sandbox->>FS: (optional) route by operationContext -> tenant backend
Search->>FS: globInfo/readRaw(..., context) -> tenant-scoped roots
Skills->>FS: globInfo/readRaw(..., context) -> tenant-scoped roots
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/core/src/workspace/skills/index.ts (1)
486-515:⚠️ Potential issue | 🟠 MajorRoot path resolution caches the first tenant's context permanently — multi-tenant
rootPathsresolvers cannot work as documented.
rootResolvePromiseis created once (line 497) androotResolvedprevents all subsequent re-entry (line 487), even for different tenants. TheoperationContextis captured in the closure from whichever tenant first callsensureRootPaths.The changeset documents a multi-tenant pattern where
rootPathsresolver returns tenant-specific paths like["/skills/common",/skills/tenants/${tenantId}]by extractingtenantIdfromoperationContext. However, the caching logic means only the first tenant's paths persist—subsequent tenants reuse those same paths instead of resolving their own.
ensureDiscoveredhas an identical caching problem via thethis.discoveredflag (line 463), which permanently blocks re-discovery for different tenants.If per-tenant root paths and discovery are intended, the module needs to either:
- Skip caching when a resolver/context-dependent operation is present, or
- Cache per-context (e.g., per-tenantId)
Otherwise, the changeset's multi-tenant example is misleading.
🤖 Fix all issues with AI agents
In `@website/docs/workspaces/sandbox.md`:
- Around line 223-248: Update the TenantE2BSandboxRouter and
TenantDaytonaSandboxRouter to fully implement the WorkspaceSandbox interface by
adding the missing members: a status property and a getInfo() method (mirror the
shape used in the CustomSandbox example), ensuring their signatures match
WorkspaceSandbox; retain getSandboxForTenant and the sandboxes Map but add a
brief comment and/or stubbed eviction strategy (e.g., LRU/ttl cleanup or
explicit dispose logic) near the Map declaration to warn about unbounded growth
in production and point to where to add cleanup code.
In `@website/docs/workspaces/search.md`:
- Around line 76-86: The example uses an undefined symbol model when
constructing the Agent; declare or show a placeholder for it (e.g., a comment
like "// your LLM model instance" or a minimal import/instantiation) so readers
can follow the Agent creation; update the snippet around Agent { name:
"workspace-search-agent", model, instructions..., workspace } and/or mention
model when calling agent.generateText to make the required dependency explicit.
🧹 Nitpick comments (1)
packages/core/src/workspace/search/index.ts (1)
274-287: Auto-index context is only used on the first invocation — acceptable for one-shot semantics.The
autoIndexPromiseis set once and cached. If the constructor already triggered auto-indexing (line 236, without context), a laterensureAutoIndex(context)will just await the existing promise. This is correct for a one-shot auto-index, but it means the constructor-triggered auto-index will always run without tenant context (since no operation context exists at construction time).This is likely intentional and unavoidable, but worth noting for consumers who rely on tenant-routed filesystem backends during auto-indexing.
Deploying voltagent with
|
| Latest commit: |
937ff4b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://228b952b.voltagent.pages.dev |
| Branch Preview URL: | https://feat-context-workspaces.voltagent.pages.dev |
PR Checklist
Please check if your PR fulfills the following requirements:
Bugs / Features
What is the current behavior?
What is the new behavior?
fixes (issue)
Notes for reviewers
Summary by cubic
Propagates runtime operation context across sandbox, search, and skills for tenant-aware routing and storage. Toolkits pass the agent’s context end-to-end, and auto-index/discovery now respect it.
Written for commit 937ff4b. Summary will update on new commits.
Summary by CodeRabbit
New Features
Documentation