Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Why another fix?

Message-ID guard reduced duplicates but users still observed rare double-sends.
Root cause in those cases: two distinct summary messages were created for
one compaction-run (different IDs) due to duplicated completion signals
(delete + message + final bump, reconnect/replay, or abort/accept flows).

What changed

  • Add requestId to compaction-result metadata (source compaction-request user msg)
  • WorkspaceStore: dedupe performCompaction by compaction-request id
  • useAutoCompactContinue: guard on requestId when present, fallback to message id
  • Fix retry cleanup to remove the correct guard key

Why this is obviously correct

  • A compaction-run is uniquely identified by the compaction-request user message ID
  • We now:
    • Perform compaction only once per requestId (store-level dedupe)
    • Send continue only once per requestId (hook-level idempotency)
  • If requestId is missing (unexpected), fallback to summary message id (still safe)

Testing notes

  • Run repeatedly, interrupt/retry, and force reconnection
  • Expect exactly one continue send per compaction-run

_Generated with _

…ilable

- Add requestId to compaction-result metadata (source compaction-request user msg)
- WorkspaceStore: dedupe performCompaction by compaction-request id
- Hook: guard on requestId (fallback to summary message id)
- Fix retry cleanup to remove the right id from the processed set

Generated with cmux
@ammar-agent ammar-agent force-pushed the fix-compact-continue-race-messageid branch from f0542be to b4225ce Compare October 20, 2025 01:43
…o behavior change. The workspaceStatesRef was written but never read.\nThis reduces cognitive load and avoids confusion during future edits.\n\nGenerated with cmux
@ammario ammario merged commit 2b73afa into main Oct 20, 2025
8 checks passed
@ammario ammario deleted the fix-compact-continue-race-messageid branch October 20, 2025 02:28
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.

2 participants