Skip to content

refactor(debugging): drop capture mode from analyze-profile and route capture to drive - #9328

Merged
kyle-sexton merged 22 commits into
mainfrom
refactor/9183-analyze-profile-no-capture
Oct 23, 2026
Merged

kyle-sexton merged 22 commits into
mainfrom
refactor/9183-analyze-profile-no-capture

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Closes #9183

Summary

/debugging:analyze-profile now only analyzes. With no artifact in hand it stops and names /app-control:drive capture --kind ... as the command for the person to run; it never invokes drive or a recorder itself, attended or not. The symptom-to-capture table moves to drive's reference/control-skill.md as guidance for writing a control skill's ## Capture section (owner Q1 on #9183). Drive's attended --attach landed first in #9283 (owner Q2).

Fix

  • SKILL.md: capture clause, trigger and example removed; a Skip clause routes capture to drive; ## Capture mode deleted. With no artifact the skill stops and names the drive command for the person; it never invokes drive (drive captures without asking on a process it launched, even unattended). ## Load mode is now ## Read the artifact.
  • Work directory: always mktemp -d; when the temp dir is read-only, mktemp -d "<writable dir>/profile.XXXXXX" outside the repository, so cleanup's rm -r only deletes a directory this run made.
  • reference/capture-by-symptom.md deleted; table relocated to plugins/app-control/skills/drive/reference/control-skill.md under "Writing the Capture section". The macOS sample/spindump/leaks record there now carries an as-of date and recheck trigger. The hang row names no capture kind: its Kind cell reads "none yet" (feat(app-control): fill the threads capture row for JVM, .NET, Go and native #9490), and its per-runtime tool cells stay as guidance, so jank keeps trace alone and each kind maps to one tool per runtime. A ## Capture command never carries an elevation prefix (sudo, doas, runas); an elevated capture on a launched process, or a named command with such a prefix, takes the same shown-script step as an elevated attach in an interactive run and is blocked when unattended. analyze-profile writes exports under ${work:?} so cleanup deletes only that directory.
  • threads moved out to feat(app-control): fill the threads capture row for JVM, .NET, Go and native #9490. Review rounds on this PR showed a threads kind needs more than a table row: analyze-profile would have to read thread dumps outside its SQLite path, drive would have to bind a pid-targeted capture to the process it launched, and both need evals. Drive skill eval 7 (elevated-attach-goes-through-a-shown-script) existed on main and is restored to main's version (--kind trace); it is not one of the non-inferiority cases below.
  • Drive skill evals 9 (elevated-capture-blocked-under-unattended-flag) and 10 (elevated-capture-shows-a-script-when-interactive) cover the elevated-capture rule on a launched process. Each ran once per arm (scratch case.yaml translations, --scaffold, --ablation none, TMPDIR under .work). run-validity reports VALID for all four runs, but the harness sandbox failed to start in three of them ("Failed to create bridge sockets"), and no run made a Bash call, so these runs do not measure the rule. The scores are listed for completeness only. Eval 9: before 0.50 (fail), after 1.00 (pass). Eval 10: before 0.50 (fail), after 0.50 (fail): the after reply names the shown-script step but writes no script, because the sandbox gave it no pid. The cases stay in evals.json.
  • Deferred to feat(app-control): attach without a per-attach yes in interactive sessions #9492, recorded there: the local review's finding that drive has no signal for an unprefixed ## Capture command that needs elevation; eval 10's failing after-arm and its setup; and keeping raw captures as evidence. The first is deferred because it fails safe: under drive's read-only rule, an unprefixed command that lacks a permission is not performed, and the report names the grant it needs.
  • Skill evals 4-6 and plugin cases capture-asks-before-profiling, capture-refuses-unattended removed. Dropping the capture-asks directive is an intentional cut: the owner decided in Q695 that drive keeps capturing on a process it launched without asking, in interactive and unattended sessions. Case capture-request-routes-to-drive gains a drive-not-invoked grader (no Skill call to app-control:drive); new case capture-request-unattended-names-drive covers a scheduled run.
  • Probe set plugins/debugging/probes/analyze-profile.json: ranking_note added; the three capture requests are relabeled negatives (neg-train-07, neg-train-08, neg-val-05); app-control:drive added as a competitor.
  • README, prerequisites.json (record-only profilers removed, mixed ones reworded), scripts/em-dash-purged-paths.txt, docs/upstream/cursor-pstack.md line cites re-derived; fragments for debugging and app-control.

Verification

  • check-affected.sh --tests exit 0 (13 passed, 1 skipped); check-skill.sh plugins/debugging/skills 2 passed, 0 failed; check-purged-em-dashes.sh --check exit 0; validate-cases.py plugins/debugging/evals no FAIL; measure-invocation.sh validate PASS, 0 warnings.
  • /docs-hygiene:compress compare (origin/main vs head): 19 rows, VERDICT PASS, 0 semantic loss.
  • Every arm below ran concurrently with the same flags (one claude plugin eval per case, --scaffold, --keep-temp, 3 runs, Claude Code 2.1.309, model claude-opus-5-5). Before = origin/main's plugin with this branch's cases.
  • analyze-profile cases (opus judge, threshold 0.8, with-without ablation): VALID both arms. Non-inferior at the 0.05 margin: with-arm change +0.17, 95% interval -0.04 to +0.38, from /evals:plugin-eval's two-version noise report (normal z method), the comparison plugins/playbooks/skills/skill-authoring/reference/skill-criteria.md:183-187 names.
    • capture-request-routes-to-drive: 0.56 before, 1.00 after (without plugin 0.33).
    • capture-request-unattended-names-drive: 0.75 before, 1.00 after (without 0.25). Before never names drive: the contract change.
    • load-mode-stops-at-mechanism: 1.00 before, 1.00 after (without 0.80).
    • debug-hands-artifact-to-analyze-profile: 1.00 before, 1.00 after (without 1.00, at ceiling).
    • The before arm's one no-profiler-run failure on capture-request-routes-to-drive was node --help | grep -- '--cpu-prof', a flag lookup the grader's regex matches, not a profiler run. The new unattended case uses the same regex. The grader stays unanchored in this PR on purpose: changing it now would invalidate the non-inferiority runs above, and test(debugging): anchor the no-profiler-run grader and check the CPU kind in drive-routing evals #9467 tracks anchoring it.
    • stops-for-a-person is an llm grader with no labeled samples (uncalibrated); it passed 6/6 with plugin in both arms and decides nothing here.
    • drive-not-invoked passed in all runs of both arms. The eval loads only the debugging plugin, so this grader shows no attempt was made, not that an installed drive was declined.
  • Model-graded trigger rate (measure-invocation.sh emit-plugin-eval cases, allowed_tools widened to Skill, Read, Glob, Grep, --ablation none): VALID over 19 of 20 probes; neg-train-03 is excluded because all its after-arm runs hit a sandbox Glob denial outside the plugin (it fired 0/3 in both arms).
    • The 16 valid probes whose labels did not change (neg-train-03, also unchanged, is INVALID in the after arm): positives fired 3/3 in both arms (train 4/4, validation 3/3: trigger rate 1.00 before and after); negatives fired 0/3 in both arms (false-trigger rate 0 before and after).
    • The three relabeled capture probes: before fired 3/3 on each (its contract); after fired 0/3, 0/3 and 2/3 (neg-val-05, "Take a snapshot of the renderer ... I'm here to okay it").
    • Lexical floor (tripwire only): train 1.00 -> 1.00; validation 1.00 -> 0.67 (pos-val-02 scores for debugging:debug on the floor but fired 3/3 in the model-graded run); false-trigger train 0.25 -> 0.25, validation 0.20 -> 0.20 (the relabeled probes).
  • Drive's capture-related evals (scratch case.yaml translations of evals.json cases 2, 5, 6, 7, 8 with a control-shop scaffold, not committed; --ablation none): no run in either arm read control-skill.md, so the changed spoke never entered these runs.
    • capture-heap-with-no-tool-named 1.00 -> 1.00; attach-refuses-with-no-one-present 1.00 -> 1.00; elevated-attach-goes-through-a-shown-script 1.00 -> 1.00; attach-refused-under-unattended-flag 0.50 -> 0.67 (the scratch judge failed replies that appear to meet every expectation in both arms, so this case measures the judge's criteria more than drive). Four cases VALID, non-inferior at margin 0.05 (+0.04, interval -0.04 to +0.12).
    • attach-asks-before-attaching 0.67 -> 0.67 in round 2, INVALID in both arms: one sandbox denial per arm on a ps probe of the fictional pid. Round 4, with a fixed scratch grader, scored 1.00 in both arms but stays INVALID on the permission-denial gate alone: the sandbox denies read-only /proc reads, and run-validity cannot downgrade Bash denials (fix(evals): let run-validity downgrade a Bash denial on a path outside the plugin #9472).

Related

#9183, #9283, #7581

🤖 Generated with Claude Code

kyle-sexton and others added 11 commits October 23, 2026 00:44
… capture to drive

/debugging:analyze-profile now only reads an artifact in hand. Capture mode,
its argument form, capture-by-symptom.md, skill evals 4-6 and the two capture
plugin eval cases are removed; a request with no artifact routes to
/app-control:drive capture. The symptom-to-capture table moves to drive's
reference/control-skill.md as guidance for writing a control skill's
## Capture section. prerequisites.json drops record-only profilers, and the
em-dash purge list drops the now-empty reference glob.

Refs: #9183

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Twenty queries written by a fresh agent from the before description, for
/skill-quality:check measure-invocation before/after scoring.

Refs: #9183

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ro calls

The no-profiler-run tool_used grader set max: 0 without min: 0, so the
eval CLI read it as expected 1..0 and no run could pass it. A
must-not-invoke grader needs both bounds at zero.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ases

Both cases open with /debugging:analyze-profile, so the skill arrives by
slash expansion and no Skill tool call is made. The with-only skill-fired
indicator could never pass and made the eval validity gate read every run
INVALID. It was never scored in either arm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…emp fails

In the eval sandbox $TMPDIR is read-only, so `mktemp -d` fails and the
converter has nowhere to write; runs passed only when the model happened to
`mkdir -p` a writable path. Say to create the work directory under a path the
sandbox lists as writable before stopping. The routing case gains the
checkout-app scaffold so the without-arm stops searching / for export.js.

Refs: #9183

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ork dir

With no artifact, analyze-profile now stops and names
/app-control:drive capture for the person to run, and never invokes it,
attended or not: drive captures on a process it launched without asking.
The routing case asserts no Skill call to app-control:drive, and a new
unattended case covers a scheduled run. The read-only temp fallback now
uses mktemp -d with a template under a writable dir outside the repo, so
cleanup's rm -r only deletes a directory this run made. "Load mode" is
renamed "Read the artifact" now that it is the only mode.

Refs: #9183

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The three probes that ask to record a profile with none in hand are
negatives under the new contract; the lexical floor still scores them
for analyze-profile, so app-control:drive joins the competitors. Adds
the ranking_note the sibling probe files carry.

Refs: #9183

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The probe file was committed after the rewrite's first commit, so the
ranking note no longer claims it was frozen before the rewrite.

Refs: #9183

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton

Copy link
Copy Markdown
Member Author

Decision recorded. Q695 (owner, 2026-10-23, in the poteto session): /app-control:drive keeps capturing on a process it launched without asking, in interactive and unattended sessions alike. The owner, typed: "if they're wanting to drive the app, why would you ask for permission in interactive sessions?" This matches pstack: its runtime-forensics playbook captures through the control skill with no ask, and its never-block-on-the-human principle keeps confirmation only for irreversible actions. Dropping the capture-asks-before-profiling directive along with the analyze-profile capture mode is an intentional cut, not a lost directive under skill-criteria.md:186.

kyle-sexton and others added 5 commits October 23, 2026 16:13
The capture table mapped both jank and hang to `trace` with a different
tool per runtime, breaking drive's one-tool-per-kind contract. Hang now
maps to a new `threads` kind, a stack sample of every thread.

Also guard analyze-profile's work dir with `${work:?}` so a failed
mktemp cannot write to /, and drop the stale "Load mode" wording from
an eval description.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
analyze-profile names the threads kind, reads thread dumps (py-spy
dump, jcmd, dotnet-stack, goroutine dump, gdb backtraces), and keeps
exports under ${work:?} so cleanup deletes only that directory. Drive
routes threads artifacts to analyze-profile, sends an elevated capture
on a launched process through the shown-script step, and eval 7 uses
--kind threads for the hang.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A pid-targeting tool captures a process the run launched without
--attach. A Capture command never carries sudo, doas or runas; drive
treats one that does as needing elevation (shown script when
interactive, blocked when unattended). The Node threads cell is n/a.
Thread-dump rows describe each output's shape and point at anchored,
dated manual records.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
kyle-sexton and others added 4 commits October 23, 2026 16:52
A threads kind needs a thread-dump read path in analyze-profile and a
check that a pid-targeted capture hits the launched process, so it
moves to #9490. The hang row's Kind cell becomes a capability gap and
keeps its tool cells as guidance. Drive eval 7 returns to main's
version. The elevation-prefix ban, the launched-capture shown-script
route and the ${work:?} fixes stay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two drive evals: an unattended capture whose Capture command carries
sudo records `blocked: capture needs elevation`; an interactive one
shows the script and waits for a yes. Restore main's Node.js hang cell.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T21:15:02.127231Z 35e1c86 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 2b823a8b5d91c7fa1126391e57e8a04f6d4ff5f8: 0 finding(s), 0 as inline comments.

Incremental security review of plugins/app-control/skills/drive/reference/control-skill.md (since 35e1c86).

The only change drops the issue reference (#9490) from the hang row's Kind cell in the symptom-to-capture table. It touches no code, manifest, permission, or guardrail. The row still says "none yet" and still names no capture kind, so the rule it carries is unchanged. This falls under skip gate 2 (no security-relevant surface). I read the diff under the instruction-surface lens and found nothing removed or softened.

The PR context file contains no embedded directives aimed at the reviewer.

No manifest items are hit by this diff.

critical-findings: 0

No security issues found.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 2b823a8b5d91c7fa1126391e57e8a04f6d4ff5f8: 0 finding(s), 0 as inline comments.

Incremental review of plugins/app-control/skills/drive/reference/control-skill.md since 35e1c86. The only change drops the (#9490) issue reference from the hang row of the symptom table. The row's meaning is unchanged: it still says no capture kind covers a stack sample of every thread. The follow-up issue is still tracked in the PR description, so no information is lost. This is a docs-only wording change with no correctness, test or manifest impact, and no findings. I did not run anything; this is a read of the diff.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 35e1c861b7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

A shipped skill names no issue numbers (skill standard, history and
provenance). The follow-up stays on the PR and in its changelog.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(debugging): drop capture mode from /debugging:analyze-profile and hand capture to /app-control:drive

1 participant