fix(tools): default AGENT_WORK_ROOT to $HOME/mosaic/agent-work #641
Reference in New Issue
Block a user
Delete Branch "fix/pr-merge-agent-work-root-home"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
pr-merge.sh(and its regression test) hardcoded/home/hermes/agent-workas theAGENT_WORK_ROOTfallback — one operator's home dir baked into a framework tool. Any other user (e.g.jarvis) hits:on every merge, and
--skip-queue-guarddoes not avoid it (the failingmkdiris in the API/tea-error path, not the queue guard). Hit live while merging #552.Fix
Default to
${AGENT_WORK_ROOT:-${HOME:-/tmp}/mosaic/agent-work}:/home/<user>/mosaic/agent-work, no cross-user collision or permission errors.~/.config/mosaicstays framework config (overwritten on upgrade);~/mosaicholds runtime work artifacts./tmpfor systemd/CI contexts where$HOMEmay be empty (an empty HOME would otherwise yield/mosaic/agent-work→ root).AGENT_WORK_ROOTstill overrides everything.5 occurrences across 2 files (
pr-merge.sh×4,test-pr-merge-gitea-empty-uid.sh×1). All operator-agnostic.Validation
bash -nclean on both files.test-pr-merge-gitea-empty-uid.shpasses.$HOME/mosaic/agent-work; HOME unset →/tmp/mosaic/agent-work;AGENT_WORK_ROOTset → honored.pr-merge.sh and its regression test hardcoded /home/hermes/agent-work as the AGENT_WORK_ROOT fallback, baking in one operator's home dir. Any other user (e.g. jarvis) hit 'mkdir: cannot create directory /home/hermes: Permission denied' on merge, and --skip-queue-guard did not avoid it (the mkdir is in the API/tea-error path, not the guard). Default to ${HOME:-/tmp}/mosaic/agent-work instead: per-user isolated, kept separate from the framework's ~/.config/mosaic config tree, with a /tmp last-ditch fallback for unset-HOME contexts (systemd/CI). An explicit AGENT_WORK_ROOT still overrides. 5 occurrences across 2 files. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>