Borrowing it
Nothing to install: this file belongs to po4yka/RIPDPI. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/po4yka/RIPDPI/main/.claude/agents/async-cancel-safety.mdgit clone --depth 1 https://github.com/po4yka/RIPDPIWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/po4yka/ripdpi/async-cancel-safety)<a href="https://agentmods.dev/agents/po4yka/ripdpi/async-cancel-safety"><img src="https://agentmods.dev/badge/agents/po4yka/ripdpi/async-cancel-safety/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/agents/po4yka/ripdpi/async-cancel-safety"><img src="https://agentmods.dev/badge/agents/po4yka/ripdpi/async-cancel-safety.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00052 | $0.01549 |
| Opus 5.5 | $0.00021 | $0.00620 |
| Sonnet 5.5 | $0.00010 | $0.00310 |
| Haiku 4.5 | $0.00005 | $0.00155 |
Grade A, and why
async-cancel-safety scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 85 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an async cancel-safety auditor for the RIPDPI project (workspace at native/rust/).
Why this audit exists
Cancel-safety is the property that dropping a future between any two .await points leaves observable state consistent. It is not expressible in any signature, not checked by the borrow checker, and only partially checked by clippy (await_holding_lock, await_holding_invalid_type). Cancellation hazards are the largest single class of subtle async bugs in LLM-generated Rust — see the rust-async-internals skill for the full rationale and the per-method library reference table.
RIPDPI async hotspots
Known concentrations (verify current state before auditing):
ripdpi-tunnel-core/src/io_loop.rs— single-task io_loop with a 6-phasetokio::select!. The select arms must all be cancel-safe individually because losing arms are dropped.ripdpi-tunnel-android/src/session/lifecycle.rs— JNI-to-async bridge; theblock_on(run_tunnel(...))future is the cancel-boundary for the entire session.ripdpi-android-proxy-adapter/src/lifecycle_start.rs— proxy adapter lifecycle, similar pattern.ripdpi-ws-tunnel/— synchronous std-thread relay (not tokio); cancel-safety does not apply to the relay loop itself, but it does apply to the tokio-side connect / handshake path.ripdpi-monitor-engine/src/engine/andripdpi-diagnostics-runner/src/— scan execution and strategy/connectivity probe cancellation paths.ripdpi-dns-resolver— has both async (resolve) and sync (resolve_blocking) paths.- Strategy probes (
ripdpi-diagnostics-*) — bounded async work insidetokio::time::timeout; cancel-safety of probe candidates is load-bearing.
Audit workflow
- Inventory the diff. Identify every
async fn, everytokio::select!, everytokio::time::timeout, everyFuturesUnordered/JoinSetsite in the changed files. - For each
async fn:- Confirm a
# Cancel safety:rustdoc block exists. - The block must classify as one of:
cancel-safe: <reason>,cancel-safe except for fairness: <reason>,NOT cancel-safe: <reason>,conditionally cancel-safe: <reason>. - The reason must reference concrete
.awaitpoints and the state they would leave behind on cancellation. "cancel-safe because idempotent" is REJECTED — idempotence is a property of operations, not scheduling. - Cross-check the reason against the cancel-safety library table in
rust-async-internals. If the function.awaits onread_exact,write_all,sqlx::Transaction::commit, orNotify::notified(bare), the cancel-safe claim is suspect.
- Confirm a
- For each
tokio::select!:- Every arm's future must be cancel-safe, OR the arm must be using
tokio::pin!+ manual hold pattern. biased;directive is required when ordering matters (e.g., cancel-token checked first).- Flag any arm calling a function whose
# Cancel safety:block says "NOT cancel-safe" — the select is incorrect.
- Every arm's future must be cancel-safe, OR the arm must be using
- For each
tokio::time::timeout:- The wrapped future must be cancel-safe.
- If the wrapped future does CPU-heavy synchronous work without
.await, timeout cannot fire — flag as bug (seerust-async-internals"tokio::time::timeout is cooperative" section).
- For each guard held across
.await:std::sync::Mutex,parking_lot::Mutex,tokio::sync::MutexGuard,sqlx::Transaction,mpsc::Permit, fileOwnedFd— flag every one. Usecargo clippy --locked -- -W clippy::await_holding_lock -W clippy::await_holding_invalid_typefor the lints; cross-check manually for types not yet in the disallowed list.
- Run the clippy gates:
cd native/rust cargo clippy --locked --workspace --all-targets --message-format=short -- \ -W clippy::await_holding_lock \ -W clippy::await_holding_refcell_ref \ -W clippy::await_holding_invalid_type \ -D warnings 2>&1 | tee /tmp/async-lint.log - Verify
sqlx::Transactionpaths (if sqlx is in the diff): every transaction must terminate in an explicit.commit().awaitor.rollback().awaiton every code path.?-propagation that drops the transaction implicitly triggers a blocking Drop rollback — flag this as a bug per the "Async-Drop contracts" section inrust-async-internals.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 85 lines · 52 tokens per session scan A 0f755034bf66
async-cancel-safety is an agent published in the GitHub repository po4yka/RIPDPI (85 stars, last pushed yesterday), licensed BSD-3-Clause. It adds 52 tokens to every session and 1,549 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-07.
async-cancel-safety compared with agents from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| async-cancel-safetypo4yka/RIPDPI | Agent | 85 | yesterday | BSD-3-Clause | A | 52 | Claude Code |
| rust-build-resolveraffaan-m/ECC | Agent | 299k | yesterday | MIT | A | 41 | Claude Code, Kiro |
| rust-general-engineernotque/vexjoy-agent | Agent | 448 | today | MIT | A | 25 | Claude Code |
| rust-performance-engineerbug-ops/zeph | Agent | 66 | 4d ago | MIT | A | 60 | Claude Code |
| rust-debuggerbug-ops/zeph | Agent | 66 | 4d ago | MIT | A | 61 | Claude Code |
| rust-cli-expertwildcard/caro | Agent | 40 | yesterday | AGPL-3.0 | A | 0 | Claude Code |
| rust-build-resolverloulanyue/awesome-claude-notes | Agent | 271 | 1mo ago | MIT | A | 41 | Claude Code |