Skip to content

Fix autolog write recovery and active-session pruning - #97

Merged
ctoth merged 1 commit into
masterfrom
agent/autolog-reliability
Jul 30, 2026
Merged

Fix autolog write recovery and active-session pruning#97
ctoth merged 1 commit into
masterfrom
agent/autolog-reliability

Conversation

@ctoth

@ctoth ctoth commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep the serialized AutoLog flush queue usable after an IndexedDB append or prune failure while still rejecting the failed flush to its caller
  • always release the current session after a failed final flush so a later session can start
  • exclude the active session from whole-session pruning so later entries remain reachable and accounted for

Root cause and impact

AutoLogService stored the rejecting operation itself as the next queue dependency, permanently poisoning every later flush. Its failed endSession() path also skipped session cleanup. Separately, AutoLogStore treated the currently-written session as an ordinary oldest-session deletion candidate, orphaning later entries and defeating the storage cap.

TDD

The new regressions failed first by proving that the queue stayed rejected, the failed session could not be replaced, and the active session record was deleted. The implementation then made those same tests pass.

Validation

  • npm test -- src/logging/AutoLogService.test.ts src/logging/AutoLogStore.test.ts — 2 files, 11 tests
  • npm test — 106 files, 1,055 tests
  • npm run typecheck
  • npm run lint:staged — passes with three pre-existing warnings in the touched AutoLog files
  • npm run build
  • git diff --check

Closes #53
Closes #57

@ctoth
ctoth merged commit 59d8580 into master Jul 30, 2026
1 check passed
github-actions Bot pushed a commit that referenced this pull request Jul 30, 2026
Fix autolog write recovery and active-session pruning 59d8580
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AutoLog pruneToMaxBytes can delete the session currently being written Autolog flush chain dies permanently after one failed write

1 participant