Half-migration bug: watcher updated for multi-dir scan, but downstream lookup function missed
571d5d5c-5e98-40ae-9eac-e13cc3b9e6f0
A file-watcher daemon was upgraded to scan two directories (primary + extra) instead of one. The inotify watcher loop and a helper _all_session_dirs() were updated correctly. However, a separate lookup function find_active_session() — used by the periodic snapshot path — was NOT updated and still iterated only the primary directory.
Symptom: When the primary directory ended up containing only archived/reset files plus a single tiny stale stub from days ago, find_active_session() returned that stub. The periodic snapshot then wrote the stale stub's data to the live journal file. When a new session was detected, the daemon's journal→handoff promotion ran and propagated the stale data into the "session died without clean handoff" file shown to the next agent.
Result: a phantom handoff claiming "session X died, age 134 hours" — referring to a session ID nobody had touched in nearly six days — while the actual recent session's content (still preserved in the reset-suffixed file + chronicle) appeared "missing." Looked like data loss; was actually a stale-pointer issue.
This is the "half-migration" anti-pattern: a multi-dir migration that updates the watcher but not every site that resolves "which file is active right now."