跳到正文
cccskills
免费在 GitHub 公开

blocking-io-guard

Find Python input/output calls that may stall asynchronous backend work, then fix or guard each relevant path with runtime tests. Verify that tests fail when blocking behavior returns and pass after the fix is restored.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Ensure async-path backend code that could block the asyncio event loop is protected by a teeth-verified runtime anchor in tests/blocking_io/. Use when changing backend Python under app/, packages/harness/deerflow/, or scripts/, when running a blocking-IO triage round over the whole repo, or when a reviewer/CI asks for blocking-IO coverage. Runs a deterministic scan (changed-lines or full-repo), routes each candidate, drafts/extends an anchor, and proves it fails when the blocking IO regresses.

查看安装方法

适用场景

  • Checking asynchronous Python changes before a pull request
  • Triaging blocking input/output across the codebase
  • Adding tests for cleanup and error branches
  • Verifying that tests catch blocking behavior returning

包含的文件(4)

  • SKILL.md6.7 KB
  • references/good-anchor-rules.md3.1 KB
  • references/sop-skeleton.md1.7 KB
  • templates/anchor.template.py1.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Blocking-IO Guard Skill

Help a contributor ship backend async changes together with the runtime anchor that lets DeerFlow's blocking-IO CI gate actually see the new code. The dynamic detector only catches blocking IO on paths a test executes — this skill closes that gap, either for your own diff or for a repo-wide triage round.

Read references/good-anchor-rules.md before writing any anchor. Only read references/sop-skeleton.md when generalizing this SOP to another detector domain — it is not needed to execute the steps below.

When to use

  • Your change touches Python under backend/app/, backend/packages/harness/deerflow/, or backend/scripts/ and may run on the async event loop (Mode A). If unsure, run Step 0 — it answers deterministically.
  • You are doing a maintenance triage round over the existing codebase (Mode B).

SOP (router)

Step 0 — Scope (deterministic)

Mode A — your own diff (default, pre-PR). From repo root:

uv run --project backend python scripts/scan_changed_blocking_io.py --base origin/main

Lists blocking-IO candidates your change introduces: findings on lines the diff added, plus findings that are new versus the merge base — the latter catches a new async caller exposing an old sync helper whose blocking line is not in the diff. The diff is <base>...HEAD, so commit your work first — uncommitted lines are not selected.

If the list is empty, this change introduces no blocking-IO surface that the static detector can see in the changed files. One residual blind spot remains: reachability is same-file only, so a new async caller of a sync helper defined in another file is invisible to both selections. If your diff adds an async call into a helper that lives elsewhere, check that helper manually (codegraph or git grep) before stopping.

Mode B — full-repo triage round. From repo root:

make detect-blocking-io

Prints a summary and writes the complete structured finding list to .deer-flow/blocking-io-findings.json. Work HIGH priority first; do not start MEDIUM until every HIGH is dispositioned (fixed, guarded, or recorded NO-ACTION).

Batching policy (PR sizing). One fix unit per PR while any HIGH remains: a fix unit is one root cause — usually a single HIGH, but two HIGHs resolved by the same one-place fix belong together. Once no HIGH remains, MEDIUM/LOW may be batched (about five per round, grouped by module or by disposition) so each PR stays reviewable. A new Blockbuster rule is never batched with anything — it always ships alone (see Step 5).

Both modes emit the same JSON shape per finding: priority, location (path/line/function), blocking_call (category/operation/symbol), event_loop_exposure, reason, code. Priority is a deterministic review ordering, not proof of a bug — Step 1 makes the actual call.

Step 1 — Judge each candidate (router)

Read the code around each candidate and route it:

  • Already offloaded (asyncio.to_thread, run_in_executor, async client) → GUARD: add/extend an anchor that locks the offload so a future edit cannot move it back onto the loop.
  • On the loop, not offloaded → FIX+ANCHOR: offload the production code (your fix), then add an anchor that guards it.
  • Not actually exposed / acceptable (rare: scanner false positive, startup-only code) → NO-ACTION: record one line of why.
  • Cross-file caveat: the scanner's async reachability is same-file only (ASYNC_REACHABLE_SAME_FILE). If the candidate is a sync helper, check for async callers in other files (codegraph or git grep) before deciding NO-ACTION.

Step 2 — Apply the fix, then re-scan (FIX+ANCHOR only)

Offload the blocking call in production code, then re-run the Step 0 scan and confirm the candidate no longer appears. If the offloaded call sits in a finally / cleanup path, keep it best-effort and bounded (swallow-and-log, asyncio.wait_for) so a failing or hung cleanup cannot mask the primary exception. Match by the stable key (path, function, symbol) — line numbers shift after edits, so never compare by line.

  • The finding must disappear. If it still shows, the fix did not remove the blocking pattern (e.g. the call is still a direct call, not offloaded) — go back before touching any test.
  • GUARD / NO-ACTION routes skip this step: a residual finding there is expected (the raw call still exists inside a sync helper with the offload at the caller, or the exposure was judged acceptable).

This is pattern-level feedback in seconds; it complements but never replaces Step 5 — only the runtime gate proves the event loop is actually protected.

Step 3 — Check existing anchors

Look in backend/tests/blocking_io/ for a test that drives the production async entry point reaching this candidate's branch.

  • Covers this branch already → go to Step 5 (re-verify teeth).
  • Covers the entry point but not this branch (e.g. happy path covered, cleanup/404/409 not) → extend that anchor.
  • None → create one from templates/anchor.template.py.

Step 4 — Generate / extend the anchor

Follow references/good-anchor-rules.md. Drive the specific branch (e.g. force the create failure that hits the cleanup shutil.rmtree). Never bypass the blocking surface with a test-only asyncio.to_thread wrapper.

Step 5 — Verify teeth (mandatory; also the anchor-vs-rule discriminator)

  1. Reintroduce the block (GUARD: temporarily revert the offload; FIX+ANCHOR: run against the pre-fix code).
  2. Run cd backend && make test-blocking-io (or target the one test). It must go RED.
  3. Restore the fix. It must go GREEN.

A real block that stays GREEN means Blockbuster has no rule for that primitive — that is the RULE route; see references/good-anchor-rules.md for the admission criteria before adding one.

Step 6 — Deliver

Commit the anchor(s) with your change; make test-blocking-io green. In the PR, note: candidates found, each disposition, the re-scan result (Step 2), and the teeth evidence (red→green). Include the reason for any NO-ACTION. A new Blockbuster rule, if any, goes in its own commit with the evidence from Step 5.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Turn academic papers into structured reviews that explain findings, strengths, weaknesses, and research methods. Assess originality and supporting evidence, compare relevant literature, and provide specific improvement suggestions in a detailed review or brief summary.

中文简介正在准备中。当前显示英语简介。

  • Understanding a paper's findings and limitations
  • Preparing a draft peer review
  • Checking experimental design and reproducibility
bytedance/deer-flow8.4万2026年10月19日 更新

bootstrap

免费

Create or update a SOUL.md file that defines an AI partner’s behavior through a guided conversation. Clarify communication style, autonomy, honesty, and expectations, then review a concise English profile before saving it with setup_agent.

中文简介正在准备中。当前显示英语简介。

  • Define an AI partner’s initial personality and role
  • Adjust tone and how the AI expresses disagreement
  • Clarify which decisions the AI can make independently
bytedance/deer-flow8.4万2026年10月19日 更新

Turn data into chart images by selecting a suitable format from 26 options. Visualize trends, comparisons, distributions, flows, or relationships, then receive the image URL and the complete settings used to generate it.

中文简介正在准备中。当前显示英语简介。

  • Visualize changes over time
  • Compare categories and proportions
  • Show distributions and correlations
bytedance/deer-flow8.4万2026年10月19日 更新

Send research and analysis tasks to a running DeerFlow instance through its HTTP API, an interface for exchanging requests. Retrieve responses, continue conversations, upload documents, and inspect available models, skills, agents, and service health.

中文简介正在准备中。当前显示英语简介。

  • Delegate research and analysis to DeerFlow
  • Upload documents for a conversation
  • Resume an earlier conversation
bytedance/deer-flow8.4万2026年10月19日 更新

Turn source code into project documentation, from a README with installation steps and examples to API references, architecture diagrams, developer guides, and changelogs. Match the scope and comment format to the project's size and programming language.

中文简介正在准备中。当前显示英语简介。

  • Creating a README with installation steps and usage examples
  • Documenting public functions, parameters, and return values
  • Preparing architecture and contributor guides for new developers
bytedance/deer-flow8.4万2026年10月19日 更新

Plan market, competitor, consumer, or financial research with chapter outlines, data requirements, and chart plans. Then turn collected evidence into a structured Markdown report with comparisons, citations, and strategic implications, while clearly identifying missing data.

中文简介正在准备中。当前显示英语简介。

  • Planning research chapters and data collection requirements
  • Turning market and competitor findings into a report
  • Organizing consumer insights and brand strategy analysis
bytedance/deer-flow8.4万2026年10月19日 更新

查看 bytedance 的全部技能

报告此技能的问题