fix: prevent duplicate action detection on re-navigation#653
Conversation
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>
There was a problem hiding this comment.
💡 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".
| if context.detecting_actions { | ||
| return Err("Detection is already in progress for this repository".into()); |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
ActionsSettingsPanelso the UI stays in sync when navigating away and backdetectingflag from the selected context on selection changeTest plan
🤖 Generated with Claude Code