Skip to content

fix(acp): use tempfile.gettempdir() for workspace auto-approve (#28262)#28675

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-3ad7d98a
May 19, 2026
Merged

fix(acp): use tempfile.gettempdir() for workspace auto-approve (#28262)#28675
teknium1 merged 1 commit into
mainfrom
hermes/hermes-3ad7d98a

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #28262 by @Zyrixtrex. Cross-platform improvement on top of just-merged #28063 (@EloquentBrush0x).

What: #28063 fixed the macOS /tmp/private/tmp symlink resolution issue by checking the RAW path (pre-resolve) against startswith("/tmp/"). That works on Linux + macOS, but doesn't work on WindowsPath("/tmp/foo").resolve() on Windows returns C:\\tmp\\foo (and the raw form has the wrong separator anyway), so the branch is unreachable there.

How: Replace the hardcoded "/tmp/" prefix check with Path(tempfile.gettempdir()).resolve() + Path.relative_to() — the same idiom already used three lines below for the cwd branch. Works correctly on:

  • Linux: /tmp
  • macOS: /private/var/folders/... (the real per-user temp dir)
  • Windows: %LOCALAPPDATA%\\Temp

Conflict against #28063 resolved by replacing the whole raw_path workaround — tempfile.gettempdir() is strictly better than that intermediate fix and renders the raw_path variable unnecessary. Test rewritten to use tempfile.gettempdir() so the assertion exercises the same code path on every platform.

Targeted test test_workspace_auto_approval_allows_workspace_and_tmp_but_not_sensitive passes locally.

Original PR: #28262

#28063 fixed the macOS `/tmp`→`/private/tmp` symlink issue by checking
the RAW path (pre-resolve) against startswith('/tmp/'). That works on
Linux + macOS but not on Windows — Path('/tmp/foo').resolve() returns
C:\\tmp\\foo and isn't the real Windows temp anyway.

Replace the hardcoded '/tmp/' prefix with Path(tempfile.gettempdir()).
resolve() + Path.relative_to() — same idiom as the cwd branch just
below. Works correctly on Linux (/tmp), macOS (/private/var/folders/...),
and Windows (%LOCALAPPDATA%\\Temp).

Test rewritten to use tempfile.gettempdir() so the assertion exercises
the same code path on every platform.

Conflict against the just-merged #28063 (raw_path approach) resolved
by replacing the whole raw_path block — tempfile.gettempdir() is
strictly better than that intermediate fix.

Salvage of #28262 by @Zyrixtrex.
@teknium1 teknium1 merged commit 7f253f5 into main May 19, 2026
@teknium1 teknium1 deleted the hermes/hermes-3ad7d98a branch May 19, 2026 10:05
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-3ad7d98a vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 8945 on HEAD, 8945 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4701 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working comp/acp Agent Communication Protocol adapter P2 Medium — degraded but workaround exists labels May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/acp Agent Communication Protocol adapter 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.

3 participants