hermes - 💡(How to fix) Fix Per-session working directory for gateway (OpenAI-compatible API) sessions [2 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fixed

RAW_BUFFERClick to expand / collapse

Problem

Hermes' working directory (terminal.cwdTERMINAL_CWD) is process-global. The gateway serves many concurrent sessions — the OpenAI-compatible /v1/chat/completions endpoint, messaging platforms — from a single process, all sharing that one cwd. An individual API-driven session has no way to operate in its own working directory: the file, terminal, and code_execution tools all resolve against the single global value.

This makes per-project or per-conversation workflows impossible for any client of the OpenAI-compatible API — every concurrent session is pinned to the same directory.

Prior art that doesn't close this gap

  • terminal.cwd / TERMINAL_CWD — global, fixed at gateway startup.
  • /set-workspace (#23535) — registered cli_only=True; runs in the interactive CLI REPL and mutates the global env var, so it neither reaches API sessions nor isolates concurrent ones.
  • ACP sessions — these do get a per-session cwd, via register_task_env_overrides + per-task_id path resolution in file_tools (_resolve_path_for_task). That path is exclusive to the ACP adapter.
  • Per-session cwd storage (#19292, #21427) — records/restores a session's cwd for identification and --resume, not for concurrent isolation.
  • Gateway cwd fixes (#29365, #27488) — make gateway sessions honor the configured global cwd; still a single value.

Observation

The per-session-cwd machinery already exists — for ACP. register_task_env_overrides plus per-task_id resolution gives an ACP session its own working directory while its tools run. It is simply not exposed to OpenAI-compatible API sessions.

Proposal

Allow an OpenAI-compatible API session to specify a working directory, routed through the same per-task override mechanism the ACP adapter already uses, so that:

  • the file, terminal, and code_execution tools resolve against that session's directory;
  • ideally, project context-file discovery (AGENTS.md / .hermes.md / .cursorrules) follows the same directory (cf. #11515, the analogous ACP gap);
  • concurrent sessions with different working directories do not interfere.

Open questions for maintainers

  • Transport — a field on the chat-completions request body? a session-creation parameter? a gateway-routable /set-workspace?
  • Should context-file discovery follow the per-session cwd, or stay on the global value?
  • How should this compose with the session-cwd storage in #19292 / #21427?

Happy to implement this once there's a steer on the preferred transport.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING