Repository navigation
Studio: add account-aware workspace storage roots - #10250
Imagineer99 wants to merge 2 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fbda19a973
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| def studio_db_path() -> Path: | ||
| return studio_root() / "studio.db" | ||
| return workspace_root() / "studio.db" |
There was a problem hiding this comment.
Track schema initialization per workspace database
When multiple subjects use the same server process, studio_db_path() now selects a different SQLite file for each subject, but storage/studio_db.py:102,1252-1258 and the provider, MCP, credential, and chat-generation storage modules still use process-global _schema_ready flags. After the first subject initializes its database, a second subject opens a new empty file while schema creation is skipped, so normal operations fail with no such table; rag_db.py:325-330 has the same problem after rag_root() became subject-specific. Key schema readiness by database path or verify each selected database independently.
Useful? React with 👍 / 👎.
|
|
||
| def outputs_root() -> Path: | ||
| return studio_root() / "outputs" | ||
| return workspace_root() / "outputs" |
There was a problem hiding this comment.
Resolve output defaults in the active workspace
For any subject different from the one active when modules were imported, existing defaults such as utils/models/checkpoints.py:143 and :301 retain an absolute path produced by the old import-time outputs_root(). For example, routes/preview.py:184 calls list_preview_targets() without an argument, and scan_checkpoints() passes that captured path to resolve_output_dir(), which compares it with the current subject's root and raises a path-containment ValueError, breaking preview listing for managed accounts. Make these defaults nullable and resolve the root at call time.
Useful? React with 👍 / 👎.
| def assets_root() -> Path: | ||
| return studio_root() / "assets" | ||
| return workspace_root() / "assets" |
There was a problem hiding this comment.
Route Hub storage through account-aware roots
Once a managed subject is bound, Hub-backed routes still bypass this account-aware root: hub/utils/paths.py:73-98 independently constructs assets, outputs, exports, and temporary paths beneath studio_root(), and hub/services/datasets/local.py:37-38 captures those shared dataset paths at import time. Consequently dataset uploads/listing and Hub model output/export discovery continue reading or writing the historical shared workspace rather than the active account's private root, defeating the isolation introduced here. Re-export the canonical storage-root helpers and avoid import-time path constants.
Useful? React with 👍 / 👎.
| return target(*args, **kwargs) | ||
| finally: | ||
| reset_workspace_subject(token) |
There was a problem hiding this comment.
Keep the workspace bound while awaiting async targets
When target is an async callable, run_in_workspace("alice", target) only creates and returns its coroutine; the finally block then restores the previous subject before that coroutine is awaited. A caller using await run_in_workspace(subject, async_target) therefore executes storage lookups under the outer or legacy workspace and can silently read or write another account's data. Provide an async counterpart that awaits the target before resetting the token, or explicitly reject awaitable results.
Useful? React with 👍 / 👎.
Summary
This is the first, deliberately small layer extracted from #10102.
unslothowner's historical paths exactly unchanged.This PR does not add account-management endpoints, the Accounts UI, request binding, or route-specific authorization gates. Those remain in the backed-up upper-layer branch and can be reviewed after this foundation lands.
Validation
282 passedacross the focused workspace-root and existing storage-root suites.