Skip to content

refactor(claude): write the session settings from Python instead of mkdir and tee - #1710

Merged
max-sixty merged 1 commit into
mainfrom
fix/run-claude-settings-write
Nov 19, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/run-claude-settings-write

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

run_claude.main writes .claude/settings.local.json by running mkdir -p and tee as subprocesses. Its comments say the file is "written inside the sandbox so the agent can read it back" and that "tee receives the body through its own pipe". Both describe an earlier version that ran these commands as sudo -u <sandbox> from the runner. run_claude now runs inside the agent's systemd unit as the sandbox user, so the subprocesses do nothing a direct write doesn't. The .git/info/exclude write next to them was already plain Python. This replaces them with Path.mkdir and Path.write_text, keeps the comment about why the exclude exists, and adds tend-claude-stderr.log to the module docstring's account of what the outer supervisor copies back (launch_agent.export_results copies both files).

There's no behavior change: same file, same contents, same user. test_launch_writes_settings_inside_the_existing_sandbox now reads the written file instead of checking the tee argv, so it checks the result rather than the mechanism. The full pytest run passes except the two test_refresh_consumers.py tests, which need DNS the sandbox doesn't have (as AGENTS.md notes).

…kdir and tee

run_claude already runs as the sandbox user, so the subprocesses left
over from the sudo era add nothing; the exclude write beside them was
already plain Python. Also name the stderr log in the module docstring's
account of what the supervisor copies back.
@max-sixty
max-sixty merged commit ca53e76 into main Nov 19, 2026
12 checks passed
@max-sixty
max-sixty deleted the fix/run-claude-settings-write branch November 19, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants