Skip to content

refactor: use semaphores for async serialization gates#18403

Merged
bolinfest merged 1 commit intomainfrom
pr18403
Apr 20, 2026
Merged

refactor: use semaphores for async serialization gates#18403
bolinfest merged 1 commit intomainfrom
pr18403

Conversation

@bolinfest
Copy link
Copy Markdown
Collaborator

@bolinfest bolinfest commented Apr 17, 2026

This is the second cleanup in the await-holding lint stack. The higher-level goal, following #18178 and #18398, is to enable Clippy coverage for guards held across .await points without carrying broad suppressions.

The stack is working toward enabling Clippy's await_holding_lock lint and the configurable await_holding_invalid_type lint for Tokio guard types.

Several existing fields used tokio::sync::Mutex<()> only as one-at-a-time async gates. Those guards intentionally lived across .await while an operation was serialized. A mutex over () suggests protected data and trips the await-holding lint shape; a single-permit tokio::sync::Semaphore expresses the intended serialization directly.

What changed

  • Replace Mutex<()> serialization gates with Semaphore::new(1) for agent identity ensure, exec policy updates, guardian review session reuse, plugin remote sync, managed network proxy refresh, auth token refresh, and RMCP session recovery.
  • Update call sites from lock().await / try_lock() to acquire().await / try_acquire().
  • Map closed-semaphore errors into the existing local error types, even though these semaphores are owned for the lifetime of their managers.
  • Update session test builders for the new managed_network_proxy_refresh_lock type.

Verification

  • The split stack was verified at the final lint-enabling head with just clippy.

Stack created with Sapling. Best reviewed with ReviewStack.

@bolinfest bolinfest requested a review from a team as a code owner April 20, 2026 16:54
@bolinfest bolinfest enabled auto-merge (squash) April 20, 2026 16:57
@bolinfest bolinfest merged commit 5d5d610 into main Apr 20, 2026
25 checks passed
@bolinfest bolinfest deleted the pr18403 branch April 20, 2026 17:21
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants