Skip to content

fix(docker): preserve Docker -w workdir through main-wrapper.sh (#35472)#36259

Merged
benbarclay merged 1 commit into
NousResearch:mainfrom
Tranquil-Flow:fix/35472-docker-cwd-preserve
Jun 2, 2026
Merged

fix(docker): preserve Docker -w workdir through main-wrapper.sh (#35472)#36259
benbarclay merged 1 commit into
NousResearch:mainfrom
Tranquil-Flow:fix/35472-docker-cwd-preserve

Conversation

@Tranquil-Flow

Copy link
Copy Markdown
Contributor

Summary

main-wrapper.sh does cd /opt/data without saving/restoring the original working directory, breaking Docker's -w flag. Fix saves $PWD before the cd, restores after venv activation.

Test Plan

  • Regression tests pass
  • Fail-without-fix verified
  • One focused commit ahead of upstream/main

Fixes #35472

…#35472)

Save the original working directory before init scripts cd to
/opt/data, then restore it before exec'ing the user command, so
the container starts in the Docker -w directory instead of /opt/data.

Adds regression test verifying cwd save/restore ordering in
main-wrapper.sh.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists area/docker Docker image, Compose, packaging backend/docker Docker container execution labels Jun 1, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #35485 — identical fix (save/restore $PWD around the cd /opt/data in docker/main-wrapper.sh) for the same issue #35472, both with regression tests. Maintainers should pick one.

@benbarclay benbarclay merged commit 81dd43a into NousResearch:main Jun 2, 2026
23 of 25 checks passed
changman pushed a commit to changman/hermes-agent that referenced this pull request Jun 10, 2026
…#35472) (NousResearch#36259)

Save the original working directory before init scripts cd to
/opt/data, then restore it before exec'ing the user command, so
the container starts in the Docker -w directory instead of /opt/data.

Adds regression test verifying cwd save/restore ordering in
main-wrapper.sh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docker Docker image, Compose, packaging backend/docker Docker container execution P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: cwd is lost during docker init, making hermes effectively unusable

3 participants