Community寫作與編輯github.com

qsssrg/subagent-completion-check-skill

Detects Claude Code's silent subagent completion bug (async Agent tool stops after tool_use without a result, reported completed anyway). See anthropics/claude-code#47936.

subagent-completion-check-skill 是什麼?

subagent-completion-check-skill is a Claude Code agent skill that detects Claude Code's silent subagent completion bug (async Agent tool stops after tool_use without a result, reported completed anyway). See anthropics/claude-code#47936.

相容平台Claude Code~Codex CLI~Cursor
npx skills add qsssrg/subagent-completion-check-skill

Installed? Explore more 寫作與編輯 skills: steipete/notion, affaan-m/seo, affaan-m/brand-voice · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

/subagent-completion-check-skill — Silent Subagent Failure Detector

You are a diagnostic assistant for a specific, confirmed Claude Code bug: background subagents launched via the Agent tool (non-fork, async) can stop executing the instant they call a tool, before the tool's result is ever delivered back to them — and the harness still reports the task as status: completed, with no error surfaced anywhere. From the dispatching session's point of view this is indistinguishable from a subagent that finished successfully and simply had nothing more to say.

This is not a hypothetical. It's tracked upstream at anthropics/claude-code#47936, where users report it occurring in roughly 14-30% of tool-using background dispatches. See references/background.md for a full writeup, including an independent reproduction (control experiments isolating tool type, tool latency, and prompt size as non-factors) and a retrospective audit of 201 historical subagent transcripts.

Trigger

Invoke /subagent-completion-check-skill after dispatching any subagent that uses tools, whenever you want to confirm it actually did its job:

/subagent-completion-check-skill check /path/to/agent-<id>.jsonl
/subagent-completion-check-skill did my reviewer subagent actually run?
/subagent-completion-check-skill verify this background task completed for real

You can also invoke it naturally without the prefix — e.g. "check if that subagent actually finished" or "this agent said it was done but the file it was supposed to write isn't there."

What to do

  1. Locate the subagent's transcript. When a background Agent tool call completes, the task-notification you receive includes an output_file path (usually a symlink to the real transcript, e.g. .../subagents/agent-<id>.jsonl). That path is what this skill checks. Do not Read/cat that file directly into your own context — it can be a large, full conversation transcript. Let the script inspect it instead.

  2. Run the checker:

    python3 scripts/check_subagent_completion.py <output_file_or_transcript_path>
    

    It prints exactly one line and exits with a matching code:

    • OK: ... (exit 0) — either the subagent never needed a tool, or its last tool call got a result back. Trust the completion (but still apply ordinary skepticism to what the subagent claims it did — this check only rules out the specific silent-stop failure mode).
    • SILENT_FAILURE: ... (exit 1) — the exact bug signature: the last tool_use in the transcript has no matching tool_result anywhere after it. The subagent produced nothing real, no matter what the orchestrator told you.
    • ERROR: ... (exit 2) — the transcript couldn't be read (missing, empty, unreadable). Treat this the same as SILENT_FAILURE — a check that couldn't run is not a check that passed.
  3. Act on the result:

    • SILENT_FAILURE or ERROR → don't trust the subagent's output. Re-dispatch the same task once (this failure is intermittent, not deterministic — see references/background.md for the measured rate). If it fails a second time, stop retrying and either do the work yourself or tell the user/orchestrator plainly that the delegated task could not be completed. Never silently substitute a partial or fabricated result.
    • OK → proceed normally, but remember this check only rules out the silent-stop bug — it says nothing about whether the subagent's actual output is correct or complete.
  4. If you're designing a new delegation pattern from scratch, consider the complementary mitigation described in references/background.md: subagents that need zero tool calls (because all required context was embedded as plain text in the prompt, and the actual side effect — a post, a file write — is performed by the caller instead of the subagent) are structurally immune to this bug. That's not always practical (a code reviewer's whole job is to use tools), which is exactly why this detection-based approach exists as the general-purpose fallback.

Reference

FileContents
references/background.mdFull bug writeup, reproduction methodology, historical data, and the two complementary mitigation strategies (tool-free subagent design vs. post-hoc detection)

Notes

  • This is a diagnostic/detection tool, not a fix. The underlying bug lives in Claude Code's subagent execution runtime and can't be patched from user-space; see the linked GitHub issue for the authoritative status.
  • The detection logic is intentionally simple and mechanical (inspect the last tool_use block and everything after it) rather than heuristic (e.g. "duration was suspiciously short") — every reproduced failure case during development matched this exact structural signature, and it has no false positives against 181 known-good historical transcripts.

相關技能

steipete/notion

Notion CLI/API for pages, Markdown content, data sources, files, comments, search, Workers, and raw API calls.

community

affaan-m/seo

Audit, plan, and implement SEO improvements across technical SEO, on-page optimization, structured data, Core Web Vitals, and content strategy. Use when the user wants better search visibility, SEO remediation, schema markup, sitemap/robots work, or keyword mapping.

community

affaan-m/brand-voice

Build a source-derived writing style profile from real posts, essays, launch notes, docs, or site copy, then reuse that profile across content, outreach, and social workflows. Use when the user wants voice consistency without generic AI writing tropes.

community

affaan-m/crosspost

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

community

affaan-m/x-api

X/Twitter API integration for posting tweets, threads, reading timelines, search, and analytics. Covers OAuth auth patterns, rate limits, and platform-native content posting. Use when the user wants to interact with X programmatically.

community

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

community