Skip to content

fix: prevent duplicate action detection on re-navigation#653

Merged
matt2e merged 1 commit intomainfrom
double-action-detection
Apr 24, 2026
Merged

fix: prevent duplicate action detection on re-navigation#653
matt2e merged 1 commit intomainfrom
double-action-detection

Conversation

@matt2e
Copy link
Copy Markdown
Contributor

@matt2e matt2e commented Apr 23, 2026

Summary

  • Add a guard in the Rust backend to reject concurrent action detection requests for the same repository
  • Listen for detection state changes via events in ActionsSettingsPanel so the UI stays in sync when navigating away and back
  • Sync the detecting flag from the selected context on selection change

Test plan

  • Navigate to a repo's action settings and trigger detection
  • Navigate away and back while detection is running — verify no duplicate detection starts
  • Verify detection status updates correctly when it completes

🤖 Generated with Claude Code

When a user clicks "Detect Actions", navigates away, and returns, the
detection button appeared clickable again because the local `detecting`
state was lost on unmount. Clicking it again would run a second detection
in parallel, creating duplicate actions.

Backend: add early-return guard in `detect_repo_actions` that rejects
concurrent detection when `detecting_actions` is already true.

Frontend: initialize `detecting` from the persisted `detectingActions`
flag on context change, and subscribe to `repo-actions-detection` events
so the UI stays in sync with in-flight detection across navigations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@matt2e matt2e requested review from baxen and wesbillman as code owners April 23, 2026 03:44
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 09cd3630a8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +119 to +120
if context.detecting_actions {
return Err("Detection is already in progress for this repository".into());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Permit retries when persisted detection flag is stale

This new guard can permanently block action detection after an interrupted run. detecting_actions is stored in SQLite, so if the app is closed/crashes after set_action_context_detecting(..., true) but before mark_action_context_detected, the flag remains true across restart; every later detect_repo_actions call will hit this early return even though no detection is actually running. This creates a stuck repo context that users cannot recover from in settings.

Useful? React with 👍 / 👎.

@matt2e matt2e merged commit 7e1913a into main Apr 24, 2026
5 checks passed
@matt2e matt2e deleted the double-action-detection branch April 24, 2026 02:49
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