Skip to content

[Fix] Discord drops task request when user links account - #1022

Merged
mrubens merged 2 commits into
developfrom
fix/continue-discord-task-after-link-2gez4aw6k6q45
Aug 3, 2026
Merged

[Fix] Discord drops task request when user links account#1022
mrubens merged 2 commits into
developfrom
fix/continue-discord-task-after-link-2gez4aw6k6q45

Conversation

@roomote-community

@roomote-community roomote-community Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Opened on behalf of Matt Rubens. Follow up by mentioning @roomote, in the web UI, or in Discord.

What changed

Discord now retains an unlinked user's latest attempted task request for 10 minutes. When the user completes /link, Roomote replays that request through the normal Discord intake path, preserving new-task, existing-thread, attachment, routing, and configured channel behavior.

Pending writes are ordered atomically by Gateway receipt time, with the Discord event ID as a tie-breaker, so an older event that finishes processing later cannot replace a newer request.

If replay fails, both the pending request and one-shot link code are restored so the operation can be retried safely.

Why this change was made

Previously, account linking attributed future requests correctly but discarded the request that prompted the user to link. Users had to repeat themselves after completing setup.

Impact

Users who link their Discord account shortly after attempting to start work can continue directly from the original request without resending it. Existing linking behavior remains unchanged when there is no recent pending request.

@roomote-community

roomote-community Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

No new code issues found. See task

  • apps/api/src/handlers/discord/pending-account-link-task.ts:28 — The unconditional Redis SET is last-writer-wins by completion time, not request time. Independently processed Discord events can finish out of order, allowing an older request to overwrite the newer one and be replayed after /link; compare the envelope timestamps atomically or serialize this per user.

Reviewed f658dd7

@roomote-community

roomote-community Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in f658dd7. Pending requests now use an atomic Redis compare-and-set ordered by Gateway receipt time and Discord event ID, so late completion or replay restoration cannot overwrite a newer request. Added focused out-of-order persistence coverage; the Discord test set, API type check, lint, and pre-push checks pass.

@mrubens
mrubens marked this pull request as ready for review August 3, 2026 12:37
@mrubens
mrubens merged commit 9491478 into develop Aug 3, 2026
18 checks passed
@mrubens
mrubens deleted the fix/continue-discord-task-after-link-2gez4aw6k6q45 branch August 3, 2026 12:37
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