---
name: "Archive sweep not moving stories from done to archived"
---

# Bug 251: Archive sweep not moving stories from done to archived

## Description

Stories that have been in `5_done/` for well over the configured retention period (default 4 hours) are not being automatically swept to `6_archived/`. Items from March 14 are still sitting in `5_done/` as of March 16 — over 2 days past the threshold. The last items that successfully reached `6_archived/` date from Feb 23-24.

Additionally, story file moves (e.g. from one pipeline stage to another) are sometimes not being auto-committed, which used to work.

## How to Reproduce

1. Start the Story Kit server
2. Move a story to `5_done/`
3. Wait longer than `done_retention_secs` (default 14400 seconds / 4 hours)
4. Observe that the story is never moved to `6_archived/`

## Actual Result

Stories remain in `5_done/` indefinitely. No sweep log messages appear in the server output.

## Expected Result

Stories older than `done_retention_secs` are automatically moved to `6_archived/` and the move is auto-committed.

## Investigation Notes

The sweep logic lives in `server/src/io/watcher.rs` around line 208 (`sweep_done_to_archived()`). The watcher runs on a dedicated OS thread (line 310) with a timer-based sweep interval (line 441, default 60s).

**Do NOT layer new code on top of this.** Use `git bisect` or `git log` to find when the sweep stopped working. The code looks structurally correct — the watcher thread may be dying silently with no restart mechanism, or something changed in how/when the sweep is triggered. Find the root cause and fix it there.
