Repository navigation
Description
This was generated by AI during triage.
Agent Brief
Category: enhancement
Summary: Runs leave files in the shared /tmp that nothing removes: Factory skills directories from Commands that end without cleanup, and the scratch files sessions write there. On stephens.page they reached 22 GB.
Current behavior:
On 2026-11-18, stephens.page's /tmp held 22 GB; 17 GB of it was more than two days old, with about 11,500 entries, and pushed the root disk to 91%. Clearing those entries by hand freed 16 GB (91% → 82%). Two kinds of leftover:
-
Factory skills directories (
thirdshift-skills-XXXXXX).skills::written_out()(src/skills.rs) writes the Factory skills to atempfiledirectory held in a staticWRITTEN.skills::remove_written()drops it from the normal end paths (src/command.rs,src/processes.rs,src/processes/review.rs,src/skill.rs,src/trial.rs). A Command that dies by signal, is killed, or whose host or VM restarts never reaches those paths, and a static is not dropped at exit, so its directory stays. Unit tests leave 24 Factory skills directories in the temp directory on every run #1913 fixed the unit-test leak (the daily count fell from 192 on 11-06 to 1–12 after 11-10), but the production leak remains:Host thirdshift-skills-*in/tmpCreated since 2026-11-11 stephens.page 2,348 (1.4 GB) 15 thirdshift.app 1,928 (1.1 GB) 29 orchestrate 3,454 (260 MB) 4 dev 969 (53 MB) 0 factory 18 (11 MB) 18 They come in bursts with identical timestamps (factory: 7 at 2026-11-12 09:15, 3 at 2026-11-14 17:31), which fits several Commands dying together.
-
Session scratch files. Sessions write their logs, builds and reproductions straight into
/tmp(/tmp/issue-188-main-d1-extension.log,/tmp/issue244-rooms-final.logand the like). Nothing removes them. The entries older than two days on stephens.page includedissue*(543 entries, 132 MB),pr-*(245),repro-*(17, 1.2 GB), athirdshift-2050-base-targetbuild (812 MB), and 4,980scheduling-*test fixtures from voice-agent-scheduling sessions (278 MB). Only Triage runs set a session-specificTMPDIR(src/sandbox/triage.rs).
Desired behavior (recommended; confirm before moving to ready-for-agent):
- Each Command gets one scratch directory, and every session it starts runs with
TMPDIRpointing inside it. The Factory skills go there too. The Command removes it when it ends, as it removes its worktree. - Like the orphaned reservations released since 0.37.0 (Notice a reservation whose owning process has died #1959), a Command's startup removes scratch directories, including stale
thirdshift-skills-*, that belong to a Command on this host whose process is gone, and logs what it removed. - Session prompts and Factory skills keep using
mktemp, so their files land in thatTMPDIR; any guidance that names/tmpliterally should use$TMPDIR.
Questions for the Day shift:
- Should the scratch directory live under the system temp directory or under
~/.thirdshift, where its disk use is easier to see and to keep out of other users' way? - Should startup clean-up remove only directories it can tie to a dead Command, or also
thirdshift-skills-*directories older than a cutoff (for example 2 days) left by versions before this change? - Should a retained worktree (a Paused Command or Recovery) keep its scratch directory until it is continued or dismissed, so its logs stay available?
Key interfaces:
skills::written_out/remove_writtenand the staticWRITTENinsrc/skills.rs.- Session launch, where the environment is set for each Harness (
src/sandbox.rssetsTMPDIR=/tmpfor sandboxed sessions). - The orphan-detection used for reservations (Notice a reservation whose owning process has died #1959), reused to find dead Commands' scratch directories.
Acceptance criteria:
- A session's
TMPDIRis inside its Command's scratch directory, and a session that writesmktempfiles leaves nothing in the system/tmpafter the Command ends. - A Command stopped with SIGTERM removes its scratch directory; one killed with SIGKILL has it removed by the next Command on that host, with a log line.
- A live Command's scratch directory is never removed by another.
- Factory skills are written inside the scratch directory, not as a separate
thirdshift-skills-*directory. - Docs updated where they describe what a Run leaves on the host.
Out of scope:
- Removing files outside
/tmpthat sessions write elsewhere. - Disk-space waiting (Host limits: wait for free disk space instead of starting sessions that fail on a full disk #2091).
Activity
JacobStephens2 commentedon Nov 18, 2026
Decisions (Day shift, 2026-11-18)
~/.thirdshift(for example~/.thirdshift/scratch/<command identity>/), not the system temp directory, so its disk use is visible beside the logs and stays in the user's own space. Sessions'TMPDIRpoints inside it; the Factory skills are written there too.thirdshift-skills-*directories in the system temp directory older than a cutoff (2 days), left by versions before this change. Guard: remove only directories owned by the current user whose contents are exactly the Factory skills layout thirdshift writes (thirdshift-*skill folders andLICENSE), so nothing a user put there is touched. Users' own skills live in repositories'.agents/skillsand are never in scope.Extra acceptance criteria:
~/.thirdshift/scratch/, one per Command.thirdshift-skills-*directory older than 2 days, owned by the user and matching the Factory skills layout, is removed at startup with a log line; one with any other content is left alone.Moved to
ready-for-agent.