Skip to content

Add workspace-scoped storage support#131

Open
xpcmdshell wants to merge 2 commits intomainfrom
feature/workspace-scoped-storage-design
Open

Add workspace-scoped storage support#131
xpcmdshell wants to merge 2 commits intomainfrom
feature/workspace-scoped-storage-design

Conversation

@xpcmdshell
Copy link
Copy Markdown
Owner

@xpcmdshell xpcmdshell commented Apr 6, 2026

Problem

Multi-agent deployments need separate sessions to share artifacts and workflows within a client boundary while preventing cross-client data leakage. py-code-mode previously scoped persistence only by storage root/prefix, so there was no first-class way to isolate one tenant's stored artifacts/workflows from another while still allowing collaboration inside the same tenant.

What changed

  • add optional workspace_id support to FileStorage and RedisStorage
  • scope artifacts, workflows, and vectors by workspace while preserving legacy behavior when workspace_id is omitted
  • roundtrip workspace_id through bootstrap so subprocess-backed sessions reconstruct the same scoped storage
  • update subprocess/container storage wiring to preserve the intended unscoped deps behavior for this feature
  • fix the container Redis deps fallback so omitted REDIS_DEPS_PREFIX still resolves to the root namespace instead of a workspace-scoped workflow prefix

Design notes

  • workspace is modeled as a storage concern, not a new Session concept
  • sessions share artifacts/workflows by pointing at the same workspace-scoped storage instance
  • tools and deps semantics are intentionally unchanged in this PR
  • there is a documented follow-up refactor to separate deps access from storage access more cleanly, but the current behavior is covered and working for this feature scope

Testing

  • uv run pytest tests/test_workspace_scoped_storage.py tests/test_bootstrap.py tests/test_storage.py tests/test_executor_protocol.py tests/test_subprocess_namespace_injection.py tests/test_subprocess_vector_store.py -n 0
  • uv run pytest tests/container/test_server.py tests/test_workspace_scoped_storage.py tests/test_bootstrap.py -n 0
  • uv run ruff check .

Implement workspace_id-based scoping for FileStorage and RedisStorage.
Scope artifacts, workflows, and vectors by workspace while preserving
legacy behavior when workspace_id is omitted.

Propagate workspace scope through bootstrap and executor wiring, and add
coverage for isolation, sharing, defaults, validation, and bootstrap
roundtrip behavior.
Use the unscoped tools prefix when REDIS_DEPS_PREFIX is omitted so deps
remain rooted at the base Redis namespace instead of a workspace-scoped
workflow prefix.

Add coverage for fallback behavior and explicit REDIS_DEPS_PREFIX
precedence.
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