Skip to content

feat: context workspaces#1035

Merged
omeraplak merged 3 commits into
mainfrom
feat/context-workspaces
Feb 9, 2026
Merged

feat: context workspaces#1035
omeraplak merged 3 commits into
mainfrom
feat/context-workspaces

Conversation

@omeraplak

@omeraplak omeraplak commented Feb 9, 2026

Copy link
Copy Markdown
Member

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.

  • New Features
    • Sandbox: execute_command forwards operationContext to workspace.sandbox.execute; WorkspaceSandboxExecuteOptions includes operationContext.
    • Search: indexPaths/indexContent/search accept context; auto-index uses it; toolkit passes { agent, operationContext }; WorkspaceSearchOptions adds context.
    • Skills: discovery, indexing, loading, activation/deactivation, search, and file reads accept context; rootPaths resolver gets operationContext; prompt hook/toolkit forward context.
    • Docs: added tenant-aware examples for filesystem backend factories, sandbox (E2B/Daytona), search, and skills.
    • Tests: added coverage for toolkit context forwarding in sandbox, search, and skills.
    • Backward compatible; operationContext is optional.

Written for commit 937ff4b. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Runtime context propagation across workspace operations, enabling tenant-aware routing for sandbox execution, search (indexing/search), and skills workflows.
    • Public APIs extended to accept and forward operation context for dynamic, per-request routing.
  • Documentation

    • Added guides and examples for tenant-aware filesystem backends, sandbox routing patterns, and context-aware search and skills usage.

@changeset-bot

changeset-bot Bot commented Feb 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 937ff4b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@voltagent/core Patch

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

@ghost

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Feb 9, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Propagates 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

Cohort / File(s) Summary
Sandbox Context Integration
packages/core/src/workspace/sandbox/types.ts, packages/core/src/workspace/sandbox/toolkit.ts, packages/core/src/workspace/sandbox/toolkit.spec.ts
Added optional operationContext to WorkspaceSandboxExecuteOptions; toolkit now forwards operationContext when calling context.sandbox.execute; test added to assert forwarding.
Search Context Integration
packages/core/src/workspace/search/types.ts, packages/core/src/workspace/search/index.ts, packages/core/src/workspace/search/index.spec.ts
Added WorkspaceFilesystemCallContext plumbing and optional context to search options; auto-indexing, indexPaths, indexContent, and search now accept/forward context; exported createWorkspaceSearchToolkit; tests validate context propagation.
Skills Context Integration
packages/core/src/workspace/skills/types.ts, packages/core/src/workspace/skills/index.ts, packages/core/src/workspace/skills/index.spec.ts
Introduced WorkspaceSkillsOperationOptions (with filesystem context) and added operationContext to root resolver context; threaded context through discovery, root resolution, indexing, loading, activation/deactivation, file reads, prompt builds; exported createWorkspaceSkillsToolkit; tests added to verify forwarding.
Filesystem docs & examples
website/docs/workspaces/filesystem.md, website/docs/workspaces/sandbox.md, website/docs/workspaces/search.md, website/docs/workspaces/skills.md
Documentation additions showing runtime operationContext usage in custom backends, tenant-aware sandbox routing, search indexing, and skills root resolution with example code and usage notes.
Changeset
.changeset/small-rooms-eat.md
Describes the operationContext propagation feature in the changeset/manifest.

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I hop with context tucked in my paw,

Passing tenant whispers through every law,
Sandbox, search, and skills — a gentle thread,
Roots and reads follow where I tread,
Hooray — context carried, soft as clover straw.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'feat: context workspaces' is vague and generic, using non-descriptive phrasing that doesn't clearly convey the specific changes being made. Use a more descriptive title that clearly indicates the main change, such as 'feat: propagate operation context through workspace toolkits' or 'feat: add context support to sandbox, search, and skills workflows'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The PR description is comprehensive and complete, with all required sections filled out, tests added, docs updated, and changesets included; the auto-generated summary clearly explains the changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/context-workspaces

No actionable comments were generated in the recent review. 🎉

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@omeraplak omeraplak changed the title Feat/context workspaces feat: context workspaces Feb 9, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

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.

No issues found across 14 files

@coderabbitai coderabbitai Bot left a comment

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.

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 | 🟠 Major

Root path resolution caches the first tenant's context permanently — multi-tenant rootPaths resolvers cannot work as documented.

rootResolvePromise is created once (line 497) and rootResolved prevents all subsequent re-entry (line 487), even for different tenants. The operationContext is captured in the closure from whichever tenant first calls ensureRootPaths.

The changeset documents a multi-tenant pattern where rootPaths resolver returns tenant-specific paths like ["/skills/common", /skills/tenants/${tenantId}] by extracting tenantId from operationContext. However, the caching logic means only the first tenant's paths persist—subsequent tenants reuse those same paths instead of resolving their own.

ensureDiscovered has an identical caching problem via the this.discovered flag (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 autoIndexPromise is set once and cached. If the constructor already triggered auto-indexing (line 236, without context), a later ensureAutoIndex(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.

Comment thread website/docs/workspaces/sandbox.md
Comment thread website/docs/workspaces/search.md
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Feb 9, 2026

Copy link
Copy Markdown

Deploying voltagent with  Cloudflare Pages  Cloudflare Pages

Latest commit: 937ff4b
Status: ✅  Deploy successful!
Preview URL: https://228b952b.voltagent.pages.dev
Branch Preview URL: https://feat-context-workspaces.voltagent.pages.dev

View logs

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