Skip to content

fix(tools): respect configured terminal cwd during init#11708

Closed
perqin wants to merge 1 commit into
NousResearch:mainfrom
perqin:fix/terminal-cwd
Closed

fix(tools): respect configured terminal cwd during init#11708
perqin wants to merge 1 commit into
NousResearch:mainfrom
perqin:fix/terminal-cwd

Conversation

@perqin

@perqin perqin commented Apr 17, 2026

Copy link
Copy Markdown

What does this PR do?

This PR let the terminal commands be executed with the working directory set to terminal.cwd.

Related Issue

Fixes #11312

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • tools/environments/base.py: cd to the configured cwd before taking pwd snapshot

How to Test

  1. Configure terminal.cwd in config.yaml
  2. Ask the agent to run terminal command pwd
  3. Proof -> it prints the configured cwd in config file

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform:

Documentation & Housekeeping

  • N/A: I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • N/A: I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • N/A: I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • N/A: I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • N/A: I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

  • This skill is broadly useful to most users (if bundled) — see Contributing Guide
  • SKILL.md follows the standard format (frontmatter, trigger conditions, steps, pitfalls)
  • No external dependencies that aren't already available (prefer stdlib, curl, existing Hermes tools)
  • I've tested the skill end-to-end: hermes --toolsets skills -q "Use the X skill to do Y"

Screenshots / Logs

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tools Tool registry, model_tools, toolsets tool/terminal Terminal execution and process management labels Apr 24, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #14796 and #14831 — same root cause: init_session() doesn't honor configured terminal.cwd. See also #14136, #12983.

@dctr

dctr commented Apr 26, 2026

Copy link
Copy Markdown

This patch works for me

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the contribution @perqin! Closing — the init_session cwd fix landed in #17205 (commit ac855bb) via @Tranquil-Flow's #14796, which uses the same approach (inject cd $cwd into the bootstrap before pwd -P). Both reports also overlap with the v0.11.0 fix 4c13628 (Popen cwd= argument). Issue #14044 is now resolved.

@teknium1 teknium1 closed this Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists tool/terminal Terminal execution and process management type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Gateway working directory config not respected, and resets after update.

5 participants