fix(flows): close stale-read race in flows_update disarm + actionable-node reachability#4891
Merged
graycyrus merged 1 commit intoJul 15, 2026
Conversation
…ble-node reachability - flows_update's manual->automatic disarm decision now forces enabled_override=Some(false) unconditionally on the transition, instead of gating on the outer `existing.enabled` read. That read is a snapshot taken before store::update_flow_graph's own guarded UPDATE re-reads the row; a concurrent flows_set_enabled(id, true) landing in the gap bumps updated_at too, so it wouldn't even trip the optimistic-concurrency conflict — it would silently persist the automatic-trigger graph as enabled (addresses @chatgpt-codex-connector on ops.rs:2532). - graph_has_actionable_nodes now walks reachability from the trigger node instead of a naive "any non-trigger node + any edge" count, so a disconnected component with its own internal edges no longer suppresses the empty-flow note (addresses @coderabbitai on ops.rs:378-384). - Add regression coverage: disconnected-component empty-flow note, disarm- even-when-already-disabled, and a store-level proof that the enabled_override always wins over a concurrently-enabled row (addresses @coderabbitai on ops_tests.rs:269-302, ops_tests.rs:646-698, and store_tests.rs:94-102).
senamakel
pushed a commit
to M3gA-Mind/openhuman
that referenced
this pull request
Jul 18, 2026
…-node reachability (tinyhumansai#4891)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #4889 (merged) addressing two review findings from Codex + CodeRabbit that landed after #4889 was already merged.
Problems & fixes
1. Stale-read race in
flows_updatedisarm (Codex P2 — real concurrency bug). #4889'sshould_disarm = now_auto && existing.enabled && !was_autoreadexisting.enabledfrom an outerget_flowbeforestore::update_flow_graph's own guarded UPDATE re-reads the row. A concurrentflows_set_enabled(id, true)landing in that gap bumpsupdated_attoo — so it wouldn't even trip the optimistic-concurrency conflict, and would silently persist an automatic-trigger graph as enabled: exactly the live-arming bug #4889 was meant to close. Fix: forceenabled_override=falseunconditionally on any manual/none→automatic transition, decoupled from the staleexisting.enabledread (a no-op when the flow was already disabled). Theshould_disarmmessaging is kept separate for log accuracy.2.
graph_has_actionable_nodesreachability (CodeRabbit Major). The predicate usednon_trigger_nodes > 0 && !edges.is_empty(), which treats a disconnected component's internal edges as actionable even when unreachable from the trigger. Fix: reachability walk fromgraph.trigger().Testing
enabled_overridebranches instore_tests.rs.cargo fmtclean.Acceptance criteria