Skip to content

feat(app-control): add a threads capture kind with py-spy dump #9532

Description

@kyle-sexton

Refs: #9490

Problem

Drive has no capture kind for a hung process.

Fix

Start with one runtime, Python, through py-spy dump.

  • Drive. Add the threads kind to the body's kind list (drive/SKILL.md:12) and to the Actions and Rules prose.
  • Pid binding. At launch, drive records the launched process's pid, its start time and its command line.
    • Before each threads capture it re-reads those three values and captures only when all three match.
    • When the recorded pid is a wrapper (a shell that started the app), it resolves the app as that pid's child, by parent pid. It never uses a name lookup (pgrep, pidof, or ps filtered by name).
    • A mismatch is blocked: launched process no longer matches.
    • report.json capture steps keep process (pid and name) and add the start time (evidence.md:42).
  • Elevation. py-spy dump attaches by --pid and cannot launch the app as its child. On Linux, attaching to a process that is not a child usually needs root, and macOS always needs it (py-spy README:156-167, read 2026-10-23). So this kind routinely reaches drive's existing shown-script rule (drive/SKILL.md:71-79): a shown script when interactive, blocked: capture needs elevation when unattended. No new elevation path is added.
  • control-skill.md. The hang row names threads with py-spy dump for Python. The other runtimes stay "not yet" until the follow-up thread-dump rows land. The py-spy dump pointer already exists (:63-64).
  • analyze-profile. Add a direct-read branch with a new format page, reference/formats/thread-dump.md.
    • It routes from the format table at SKILL.md:55-60 with no SQLite step.
    • It says where the reading begins: threads in the same frame, lock waits, the main thread.
    • It says when the search is done: a waiting thread is named with what it waits on, at file:line.
    • The dump text is data, and the existing redaction rules apply.
  • Routing. Drive's ## Next already sends trace, cpu and heap artifacts to analyze-profile. Extend that line to threads.
  • Evals. Two cases, one per skill.
    • analyze-profile reads a real py-spy dump fixture (captured from a deadlocked toy script) and names the blocked thread and its frame at file:line.
    • drive, unattended: a threads capture ends blocked: capture needs elevation and runs nothing else.
    • Without the drive case, the unattended and pid path would ship untested.

Acceptance criteria

  • rg -n 'threads' plugins/app-control/skills/drive/SKILL.md plugins/app-control/skills/drive/reference/control-skill.md finds at least one line in each.
  • plugins/debugging/skills/analyze-profile/reference/formats/thread-dump.md exists, and SKILL.md's format table links it.
  • The drive body states the three-value pid check and the child-by-parent-pid rule, and has no name-lookup command outside a "never" sentence.
  • The two new eval cases exist, and check-evals-quality.sh exits 0 on both evals.json files.
  • The fixture is a real py-spy output: the PR records the py-spy version and the command that made it.
  • grep -nE '#[0-9]{3,}' over the changed skill files returns nothing.
  • grep -nE '5031|SETWorks|Blazor' over the changed skill files returns nothing (no consumer-specific default).
  • Frontmatter of both skills is unchanged.

Blocked by

None. Whether analyze-profile's description should mention thread dumps (a frontmatter change) is best settled before starting.

Files

  • plugins/app-control/skills/drive/SKILL.md, reference/control-skill.md, reference/evidence.md, evals/evals.json
  • plugins/debugging/skills/analyze-profile/SKILL.md, reference/formats/thread-dump.md (new), evals/evals.json plus a fixture
  • Changelog fragments

Activity

  1. added
    status: ready
    on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: ready

    Fields

    No fields configured for Feature.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions