You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Skill /tmp scratch files leak when a run ends before its final cleanup step #612
The docs-only skills the wizard runs (e.g. remediate-3000, cross-sell-3000 in context-mill) write JSON scratch files to /tmp/ across their steps, and delete them only in their final step.
If a run ends before reaching that final step, an [ABORT], an error, a rate-limit, or a kill, those files are left behind. The wizard never sweeps them.
The wizard only understands two things a skill emits: [STATUS] and [ABORT]. On [ABORT] it kills the run and calls wizardAbort(), which runs only the functions registered in cleanupFns. None of those touch the skill's /tmp/ files. The wizard uses fixed /tmp/ paths (src/utils/paths.ts) and has no knowledge of the skill's scratch filenames, so it can't sweep them as-is.
Relevant code:
src/lib/agent/agent-interface.ts (~1097-1118): [ABORT] detection, kills the run
src/lib/agent/wizard-abort.ts: the cleanupFns list that runs on abort/exit
src/utils/paths.ts: fixed /tmp/ paths, no managed temp dir
Impact
Low-harm: filenames are fixed so the next full run overwrites them, and /tmp/ clears on reboot. But interrupted runs leave orphaned files, which is confusing for anyone inspecting /tmp/ and slightly untidy.
Options
Wizard-level sweep (this repo): register a cleanup in the wizardAbort / cleanupFns path that removes known skill temp paths on any exit, including abort and error. Needs a convention for which paths to sweep (e.g. a glob like /tmp/posthog-*-plan.json, *-env.json, *-opportunities.json), which couples the wizard to skill filenames.
Skill-level self-heal (context-mill): have each skill rm -f its own temp files at the START of step 1, before writing anything, so an interrupted prior run gets cleaned on the next run. No wizard changes, and the skill already knows its own filenames. This is the lower-coupling fix.
Leaning toward option 2 for new skills, but filing here so the wizard team can decide whether a generic exit-time sweep is worth owning for all skills.
Repro
Run a skill that writes /tmp/ scratch files, interrupt it before the final step (e.g. trigger an [ABORT] or Ctrl-C), then check /tmp/ for leftover posthog-*.json files.
Activity