Skip to content

Clear delete-for-all guard on preflight failures#1433

Merged
osyed merged 3 commits into
mainfrom
codex/issue-1431-clear-delete-guard-preflight
Jul 1, 2026
Merged

Clear delete-for-all guard on preflight failures#1433
osyed merged 3 commits into
mainfrom
codex/issue-1431-clear-delete-guard-preflight

Conversation

@dnlbui

@dnlbui dnlbui commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

What Changed

This PR clears the delete-for-all action guard when deterministic preflight checks fail, so users can retry immediately after fixing local prerequisites.

  • recentDeleteForAllGuardsByTxid now stores guard objects with timeout IDs so the active guard for a target message can be cleared explicitly.
  • clearRecentDeleteForAllGuard removes only the current guard instance, avoiding stale timeout callbacks from clearing a newer guard for the same message.
  • deleteMessageForAll clears the guard when keys are missing, balance validation fails, or recipient keys cannot be loaded.
  • The guard window is reduced from 15 seconds to 10 seconds for successful send attempts.

Fixed Flow

  1. A user confirms delete-for-all for one of their messages.
  2. The app marks that message as guarded before running send preflight checks.
  3. If a deterministic preflight check fails, the app now clears the guard immediately.
  4. The user can retry delete-for-all without waiting for the timeout window.

Why

The previous guard always lived until its timeout after confirmation, even when the delete request never reached transaction creation because local prerequisites failed. That made valid follow-up attempts appear blocked by stale local state. Tracking the guard object lets the failure paths clear only the guard they created while preserving the duplicate-action protection for in-flight send attempts.

Validation

  • node --check app.js
  • git diff --check origin/main...HEAD

Closes #1431

dnlbui added 3 commits July 1, 2026 11:22
* Introduce a Map to track timeouts for recent delete-for-all actions, allowing for proper cancellation and cleanup.
* Add a method to clear recent delete-for-all entries, enhancing state management during various conditions such as missing keys or insufficient balance.
* Ensure that the recent delete-for-all state is consistently updated across relevant operations.
* Rename recentDeleteForAllGuardTimeouts to recentDeleteForAllGuards for clarity.
* Enhance markRecentDeleteForAllForTarget and clearRecentDeleteForAllForTarget methods to utilize guard tokens for better state management.
* Ensure proper cleanup of timeout handlers and state updates during delete-for-all actions.
@dnlbui dnlbui changed the title [codex] Clear delete-for-all guard on preflight failures Clear delete-for-all guard on preflight failures Jul 1, 2026
@dnlbui dnlbui marked this pull request as ready for review July 1, 2026 17:19
@osyed osyed merged commit 56329a8 into main Jul 1, 2026
2 checks passed
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.

Clear delete-for-all guard on deterministic preflight failures

2 participants