Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Dec 21, 2025

Summary

Make history compaction crash-safe and recoverable across restart/crash, while ensuring user-cancelled compactions (Ctrl+C) do not auto-retry.

Changes

  • Crash-safe history replacement: add HistoryService.replaceHistoryWithSummary() (atomic writeFileAtomic of chat.jsonl) and use it from:
    • CompactionHandler.performCompaction()
    • WorkspaceService.replaceHistory()
  • Single recovery coordinator: extend useResumeManager to detect interrupted compaction-request messages and retry compaction via executeCompaction(...) (instead of resumeStream()), preserving parsed options (model/maxOutputTokens/continueMessage).
  • Intent-aware cancellation: persist a getCancelledCompactionKey(workspaceId) marker on Ctrl+C compaction cancel and skip auto-retry when the marker matches the compaction request message.
  • Cleanup: remove the old aborted-compaction event/hook plumbing (useAbortedCompactionRetry, schema/type guards, replay emission).

Validation

  • make static-check
  • bun test src/node/services/historyService.test.ts src/node/services/compactionHandler.test.ts

Generated with mux • Model: openai:gpt-5.2 • Thinking: high

@ammar-agent ammar-agent changed the title 🤖 fix: auto-retry aborted compaction on workspace reload 🤖 fix: make compaction crash-safe and recover via resume manager Dec 21, 2025
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.

1 participant