sb-dev/openquant / .agents/skills/rust-review
rust-review
VerifiedReview Rust crates, services, or libraries for safe/unsafe boundary issues, memory safety, concurrency hazards, panic-induced denial of service, FFI safety, and async runtime mistakes. Use for a Rust security audit, especially unsafe, FFI, or concurrent code.
upstream/prompts/general/select-bias-finder.md
View on GitHub---
name: select-bias-finder
description: Detects tokio::select!/futures::select! relying on nondeterministic poll order when correctness requires deterministic branch priority
---
**Finding ID Prefix:** `SELECTBIAS`.
**Gates:**
1. `tokio::select! { ... }` **or** `futures::select! { ... }` macro.
2. The branches include a "cancellation" branch (e.g., `_ = shutdown.recv() => ...`) AND a "work" branch.
3. The poll order is non-deterministic — `tokio::select!` without a `biased;` line, or `futures::select!` (which is always pseudo-random; its ordered form is the **separate** `futures::select_biased!` macro, not a `biased;` keyword) — AND correctness requires the cancellation branch to win when both are ready.
**Patch:** for `tokio::select!`, add `biased;` as the first line of the block **and** place the cancellation/priority branch **first** — `biased;` polls top-to-bottom, so it only makes the cancellation branch win if that branch is physically first (`biased;` with the work branch on top makes the *work* branch win, the opposite of the intent). For `futures::select!`, switch to `futures::select_biased!` (there is **no** `biased;` keyword in futures-rs) **and** place the cancellation branch first. Or restructure to use a dedicated priority channel.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |