[NPU-driven HA] Ack standalone before peer activates dead role#203
Merged
BYGX-wcr merged 2 commits intoJul 6, 2026
Merged
Conversation
During a planned shutdown, the active side previously gated its transition to Standalone on the standby peer entering the Dead role. This ordering was incorrect: the active must ack the standalone role first so it owns all traffic before the standby activates its dead role. - Active side: on PeerShutdownRequested, enter Standalone immediately instead of waiting for the peer to become Dead. - Standby side: gate the transition to Destroying (dead role activation) on the active peer having acked the standalone role. Update the affected NPU-driven unit tests to reflect the new ordering. Signed-off-by: BYGX-wcr <wcr@live.cn>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR fixes the NPU-driven planned-shutdown ordering in hamgrd HA scope logic so the active side acknowledges Standalone first, and the standby side only activates Dead after observing that standalone ack, eliminating a traffic-ownership / inline-sync-ack gap during standby shutdown.
Changes:
- Updated
SwitchingToStandaloneside effects on the active side to enterStandaloneimmediately uponPeerShutdownRequested(planned shutdown). - Updated standby-side state transitions to gate
Deadactivation (Destroying) on the peer’s acked ASIC role beingstandalone, including a newStandbyhandling path. - Updated NPU-driven unit tests to reflect and enforce the new ordering.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/hamgrd/src/actors/ha_scope/npu.rs | Changes the planned-shutdown transition sequencing: active acks Standalone first; standby waits for that ack before activating Dead. |
| crates/hamgrd/src/actors/ha_scope/mod.rs | Updates tests to assert the new “standalone ack before dead activation” ordering during planned shutdown flows. |
Signed-off-by: BYGX-wcr <wcr@live.cn>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
vivekrnv
approved these changes
Jul 6, 2026
|
Cherry-pick PR to 202605: #204 |
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.
Description of PR
Summary:
During a planned shutdown of a standby HA scope, the active side previously gated its transition from
ActivetoStandaloneon the standby peer entering theDeadrole. This ordering is incorrect: the active must ack the standalone role first so that it owns all traffic before the standby activates its dead role. Otherwise there is a window where the active is still inSwitchingToStandalonewhile the standby has already dropped out, leaving traffic unowned / inline sync unacked.This PR flips the ordering so the active acks standalone first, and the standby only activates its dead role after observing the active's standalone ack.
Fixes # (N/A)
Type of change
Approach
What is the motivation for this PR?
Correct the NPU-driven HA planned-shutdown state-transition ordering to avoid a traffic-ownership gap between the active and standby HA scopes.
How did you do it?
apply_pending_state_side_effects,SwitchingToStandalone): onPeerShutdownRequested, enterStandaloneimmediately instead of waiting for the peer to becomeDead.next_state): gate the transition toDestroying(dead-role activation) on the active peer having acked thestandalonerole — both in the forcedShutdownpath and via a newStandbybranch that fires when the peer's acked ASIC role becomesstandaloneduring a planned shutdown (desired_ha_state == Dead).How did you verify/test it?
ha_scope_npu_launch_to_standby_then_down,ha_scope_npu_active_to_standalone_on_peer_shutdown_and_peer_rejoin,ha_scope_npu_standby_planned_shutdown_and_relaunch_to_standby) to reflect the new ordering.cargo test -p hamgrd --bin hamgrd actors::ha_scope— all 13 tests pass.cargo fmt -- --checkclean;cargo clippy -p hamgrdreports no new warnings.Any platform specific information?
NPU-driven HA only. DPU-driven mode is unaffected.
Documentation
N/A — behavior fix aligned with the SmartSwitch HA HLD planned-shutdown flow.