Norma's tool.Capture writes an oversized tool output to a file in
ToolOutputDir, from the server process. ARTEX passed <run dir>/cmd-output:
the executor can write in the run directory and could turn cmd-output into
a symlink, so root wrote the spill where the link pointed.
- With the privilege drop on, ToolOutputDir is <data>/spill/tasks/<id> for
the worker, the main agent and the planner of a task, and
<data>/spill/sessions/<id> for a chat. The server creates it when the
run starts (agent.SetSpillDirMaker, same style as SetRunDirMaker):
root:<exec gid> 0750 below root:root 0755 parents, each level through a
descriptor opened with O_NOFOLLOW. A directory that cannot be created
leaves the run without a spill directory (output is truncated), never
with the run directory. Without the drop the path stays
<run dir>/cmd-output.
- Norma v0.4.11 writes the spill file 0600 (directory 0700), so the
executor could not read it. The runs wrap their hooks (agent.SpillHooks):
after a tool call whose result carries the spill marker, the server makes
the files of the directory root:<exec gid> 0640. The agent reads a spill
with Bash; the file tools do not reach outside the run directory.
- The spill directory follows the task: stageTaskFiles moves it to the
delete staging with tasks/<id>, stageTaskArchiveFiles packs it as
files/spill/tasks/<id>, and installTaskArchiveFiles restores it and puts
its ownership back. Deleting a conversation removes
spill/sessions/conv-<id>.
Tests: TestToolOutputDir (agent); TestDeleteTaskFilesRemovesSpillDir,
TestRemoveConversationSpill and the archive round trip (server); root-only
TestSpillDirAsRoot, and the spill directory in
TestTaskArchiveRestoreRunDirOwnershipAsRoot. SECURITY.md drops the spill
from the residual list.