The ao stop → ao update → ao start flow could drop the restore prompt when last-stop.json went missing on disk by the time ao start looked for it. Two layered fixes plus a cross-project follow-up: 1. ao start falls back to scanning recently `manually_killed` sessions (terminated within 10 minutes, reason=manually_killed) when last-stop.json is absent. The restore prompt surfaces them with the same UX as the existing record so a regression in the write pipeline cannot silently drop the user's in-flight work. The fallback uses the GLOBAL config so cross-project sessions appear in `otherProjects` (mirrors the existing restore step's global-config load). 2. writeLastStop now uses an fsync'd atomic write (atomicWriteFileSyncDurable) so the record survives a hard kill that lands immediately after the rename — renameSync is atomic but the data blocks aren't durable until fsync. The temp file is also unlinked on writeFileSync / fsyncSync throw (Greptile P2 #1 follow-up). 3. After any user decision on a restore prompt (declined / all-restored / empty), runStartup writes an empty marker via the new markLastStopAcknowledged() helper instead of unlinking the file. The fallback gate is tightened from `!lastStopHasContent` to `!lastStop` (file truly absent) so a second ao start within the 10-minute window does not re-surface sessions the user already declined (Greptile P1 review on PR #1780). Tests: - last-stop-fallback unit tests (5) - stop → simulated update → start integration test (2) - writeLastStop fsync test (1) - writeLastStop temp-file cleanup on write throw (1) - otherProjects round-trip through readLastStop (1) - markLastStopAcknowledged round-trip (1) - ao update no-touch regression (1) - start.ts: fallback finds recent killed sessions (1) - start.ts: fallback respects window (1) - start.ts: fallback uses global config for cross-project (1) - start.ts: empty marker prevents re-prompt after decline (1) - start.ts: every-session-restored writes marker (not unlink) (1) Closes #1743 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| ao | ||
| cli | ||
| core | ||
| integration-tests | ||
| notifier-macos | ||
| plugins | ||
| web | ||