feat(gateway): add /workspace command for multi-workspace sessions - #62075
Open
joymadhu49 wants to merge 1 commit into
Open
feat(gateway): add /workspace command for multi-workspace sessions#62075joymadhu49 wants to merge 1 commit into
joymadhu49 wants to merge 1 commit into
Conversation
teknium1
reviewed
Jul 11, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the focused gateway feature and the session-routing tests.
Problems
gateway/slash_commands.py:200-205addsenv_typeto every CWD override. On current main,tools/terminal_tool.py:1142-1155explicitly reservesenv_typeas an isolation signal; CWD-only overrides are intended to avoid per-session container creation.gateway/slash_commands.py:201registers a host path as the tool CWD.tools/terminal_tool.py:2096-2115discards unusable host CWDs on container backends and falls back to the configured sandbox CWD, so Docker/Modal/Singularity/Daytona do not actually switch workspaces.- The branch uses
async_session_store(gateway/run.py:10734), but current main usessession_storedirectly atgateway/run.py:10702; current session concurrency changes includeb3f77f5c8270f5a8980daf92c85a57c706f84728.
Suggested changes
- Keep workspace overrides CWD-only unless a distinct backend environment is intentionally required.
- Define container mapping/mount behavior and test local plus container mount-on/off paths.
- Adapt the session-store calls during salvage onto current main.
Automated hermes-sweeper review.
| if updated is not None: | ||
| from tools.terminal_tool import register_task_env_overrides | ||
| register_task_env_overrides(updated.session_id, { | ||
| "cwd": cwd, |
Contributor
There was a problem hiding this comment.
This is a host path, but container backends reject host-path CWD overrides and fall back to their configured sandbox CWD (tools/terminal_tool.py:2096-2115). Please map only mounted paths to valid in-container paths, or return a clear unsupported/mount-required result.
| "cwd": cwd, | ||
| # Gateway workspaces may run concurrently. Mark this task | ||
| # as isolated so two sessions never share a mutable env.cwd. | ||
| "env_type": os.environ.get("TERMINAL_ENV", "local"), |
Contributor
There was a problem hiding this comment.
env_type is an isolation key in tools/terminal_tool.py:1142-1155; adding it makes this a per-session environment instead of the intended CWD-only override. Remove it unless this command is deliberately provisioning isolated backend environments.
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
/workspaceslash command to the messaging gateway so a user can register multiple working directories (workspaces) and switch the active one per session — enabling working on two projects concurrently from chat (e.g. two Telegram topics on different workspaces).Subcommands
/workspace//workspace list— show current + registered workspaces/workspace new <name> [path]— register a workspace (default~/.hermes/workspaces/<name>, name validated, path created if missing)/workspace <name>//workspace switch <name>— switch the session's working directory/workspace remove <name>— unregister (never deletes files; falls back cwd if it was active)Design notes (per AGENTS.md)
config.yamlundergateway.workspaces; the active selection is session routing state onSessionEntry(survives/newresets like other routing state).register_task_env_overridesmechanism + session DB cwd update; no past-context mutation, no system-prompt rebuild._profile_runtime_scopewhen profile multiplexing is enabled.GatewaySlashCommandsMixin; registered in the messaging-only command set and documented inwebsite/docs/reference/slash-commands.md.Testing
tests/gateway/test_workspace_command.py(3 behavior-contract tests): registry CRUD + validation, switch updates session entry + terminal overrides, remove never deletes files. All pass.pytest tests/gateway -k 'session or workspace': 884 passed; the 4-5 failures seen locally also fail on cleanupstream/mainunder the same run order (pre-existing test pollution, unrelated).🤖 Built with Codex CLI, reviewed and validated before submission.