oliver-zehentleitner / maity
runner: every placement gets its own short TMPDIR again (default workspaces path)
tsk-0zb9mgzmbwn4 Done An agent
Under the default ~/maity-workspaces, the scratch's tmp path is usually too long for the socket-room rule (cli/src/maity/runner/adapters.py, SOCKET_PATH_MAX), so the placement gets no TMPDIR and tools and the harness fall back to the system /tmp. Before #2014, temporary files stayed in the placement's own scratch.
Done when:
- Every placement gets a TMPDIR of its own, mode 0700, short enough for the socket rule, outside every other placement's reach in the same way as the scratch (each harness's sandbox rules), and removed with the placement.
- Or, if a separate setting is cleaner: the harness's own temp setting (for Claude Code, CLAUDE_CODE_TMPDIR) stays in the scratch, independent of the socket rule. Say which and why in a Keep the Why entry.
- Tests for the default path length and for the per-placement isolation in the generated settings.
- docs/runners.md says where temp files go.
- A live check on a runner after the fix that a placed session's temp files land in its own directory (ops).
Security leg on the PR.
Notes
Maity Test Team · Nov 20, 2026, 21:53 UTC
mmza to lotse and maity-coder-claude-008#ugmc: #2068 (tsk-0zb9mgzmbwn4) at bc73292d1c39c92c6f1f51dfc6f010be84aa3a5f, from a clean tree (git archive), as the non-root user box (uid 1000), with the cli venv from requirements/dev.txt (hash-pinned) plus an editable install.
- tests/test_adapters.py + tests/test_supervisor.py: 1 failed, 425 passed. It fails the same way when run alone:
tests/test_adapters.py::test_a_placements_own_tmpdir_leaf_is_opened_again_and_its_siblings_stay_hiddenFileExistsError: [Errno 17] File exists: '<tmp_path>/st/agents/plc-0003'at test_adapters.py:29 (agent_dir.mkdir(parents=True, mode=0o700)incontext()), raised from the secondcodex_fs(scratch=room)call at line 741.
Cause, from reading it: the new test'scodex_fs()callscontext(tmp_path, ...)twice with the same tmp_path, andcontext()creates agent_dir without exist_ok. So it should fail on every machine, not only for a non-root user. Thecontext()helper is the same at 9e505c98, bc73292d and main, so the merge did not cause this. The asserts before line 741 passed.- ruff check: pass. black --check: pass (122 files unchanged). mypy src tests: pass (121 files).
- Full cli suite: not run yet on this head. I'll run it on the next head once the test is fixed, or on bc73292d if you want that anyway.
Maity Test Team · Nov 20, 2026, 21:56 UTC
mmza to lotse and maity-coder-claude-008#ugmc: #2068 at bc73292d, the full cli suite, same tree, venv and non-root user as my message a few minutes ago: 4752 passed, 1 failed, 19 skipped. The one failure is the same test_adapters.py::test_a_placements_own_tmpdir_leaf_is_opened_again_and_its_siblings_stay_hidden (FileExistsError in context(), called twice on the same tmp_path). Nothing else fails. I ran the 73 test files split into 5 parallel pytest processes. Once that test is fixed I'll rerun test_adapters.py on the new head.
Maity Test Team · Nov 20, 2026, 22:42 UTC
mmza to lotse and maity-coder-claude-008#ugmc: #2068 (tsk-0zb9mgzmbwn4) at cfd37566756271665e000495d8a17ce9a5e297de (still the branch head). I ran it from a complete tree (git archive of the whole commit), as the non-root user box (uid 1000), with a fresh cli venv from requirements/dev.txt (hash-pinned) plus an editable install. All green:
- Full cli suite: pass. 4773 passed, 19 skipped, 0 failed, 0 errors. I ran all 73 tests/test_*.py files split into 5 parallel pytest processes, each exiting 0. This includes test_adapters.py and test_supervisor.py.
- ruff check: pass.
- black --check: pass (122 files unchanged).
- mypy src tests: pass (121 files).
Maity Test Team · Nov 21, 2026, 12:29 UTC
Tester note (maity-test-team#mmza): deployed #2068 at main 1cb0a03d, tested headless from the clone. PASS, no bug filed.
Ran
cli/tests/test_adapters.py+cli/tests/test_supervisor.py: 504 passed (fresh venv).- Direct exercise of
adapters.scratch_tmpdir,fits_socket,workspace.tmp_scratch_of: - default
~/maity-workspacesscratch with a 16-char placement id: no room under the scratch'stmpfor homes like/home/oliver.zehentleitneror/Users/oliverzehentleitner(Linux and macOS limits), so the own leaf applies; with/home/boxand a short id the scratch'stmpstill fits and no leaf is needed. - own leaf
/tmp/maity-scratch-<uid>/<32 hex>/tmpplus Claude Code's socket name: 95 bytes (uid 1000), 94 (uid 501), 101 (uid 4294967294); fits 107 and 103. A realAF_UNIXbind at the 95-byte length worked. OWN_TMPDIR_HARNESSES == ("codex",).- docs/runners.md (line 326) says where temp files go, incl. the Claude Code gap and the short-root advice; the KtW entry in cli/context/runner.md cites the card.
Not covered
- No live Codex placement on a runner (no runner or harness on my box); the card's live check stays with ops.
- Claude Code still starts without a TMPDIR under the default root, by design here; that is tsk-k7svzz2p4v7y.