<feed xmlns='http://www.w3.org/2005/Atom'>
<title>claude-plugins-official.git/plugins/security-guidance, branch bump/snowflake-cortex-code-e2a3cbb4</title>
<subtitle>Official Claude Code plugin directory
</subtitle>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/'/>
<entry>
<title>security-guidance: remove stash indexes older releases left in the git directory</title>
<updated>2026-10-07T15:40:40+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>mhegazy@anthropic.com</email>
</author>
<published>2026-10-07T15:40:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=f711194a9ecdf004b655dbc5006610fbb9e7c7bb'/>
<id>f711194a9ecdf004b655dbc5006610fbb9e7c7bb</id>
<content type='text'>
Releases before 2.0.10 ran `git stash create` on the real index. When that
git was killed, it left an `index.stash.&lt;pid&gt;` file the size of the index
in the git directory, and nothing removes those: a clone can hold hundreds.

Before it copies the index, the hook now deletes such files once they are
older than 30 minutes. It only touches regular files of the current user
whose name is exactly `index.stash.&lt;digits&gt;`, and never `index.lock`.

Co-Authored-By: Claude &lt;noreply@anthropic.com&gt;
Claude-Session: https://claude.ai/code/session_01QR7edfw5HHkxJvJVgZiWpM
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Releases before 2.0.10 ran `git stash create` on the real index. When that
git was killed, it left an `index.stash.&lt;pid&gt;` file the size of the index
in the git directory, and nothing removes those: a clone can hold hundreds.

Before it copies the index, the hook now deletes such files once they are
older than 30 minutes. It only touches regular files of the current user
whose name is exactly `index.stash.&lt;digits&gt;`, and never `index.lock`.

Co-Authored-By: Claude &lt;noreply@anthropic.com&gt;
Claude-Session: https://claude.ai/code/session_01QR7edfw5HHkxJvJVgZiWpM
</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: stop a killed hook from leaving index copies behind (2.0.10 → 2.0.11)</title>
<updated>2026-10-07T15:35:56+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>mhegazy@anthropic.com</email>
</author>
<published>2026-10-07T15:35:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=bfe21649b9ccdbc67599d6647ff139a4c34e4458'/>
<id>bfe21649b9ccdbc67599d6647ff139a4c34e4458</id>
<content type='text'>
In a clone with a very large git index, 2.0.10 could still fill the disk.
It copies the index for each git call that might write it, and a hook that
Claude Code cancels (SIGTERM, then SIGKILL) never reached its cleanup, so
every cancelled hook left index-sized files in the temp directory for up
to 30 minutes. With several agents in one clone the live copies alone
could take many GB.

- A hook told to terminate removes its copies before it exits.
- A copy's name records the hook's pid; the next run deletes copies whose
  hook is gone instead of waiting for the age limit.
- Diffs no longer need a copy: diff.autoRefreshIndex is off, so they only
  read the index. Only `git stash create` and `git add -N` get one.
- The copy is a hard link where the filesystem allows it.
- Only so many hooks hold a copy at once, fewer as the disk fills. A hook
  that gets no slot within 5 s goes without: the baseline falls back to
  HEAD, or new untracked files are left out of that review.

Co-Authored-By: Claude &lt;noreply@anthropic.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In a clone with a very large git index, 2.0.10 could still fill the disk.
It copies the index for each git call that might write it, and a hook that
Claude Code cancels (SIGTERM, then SIGKILL) never reached its cleanup, so
every cancelled hook left index-sized files in the temp directory for up
to 30 minutes. With several agents in one clone the live copies alone
could take many GB.

- A hook told to terminate removes its copies before it exits.
- A copy's name records the hook's pid; the next run deletes copies whose
  hook is gone instead of waiting for the age limit.
- Diffs no longer need a copy: diff.autoRefreshIndex is off, so they only
  read the index. Only `git stash create` and `git add -N` get one.
- The copy is a hard link where the filesystem allows it.
- Only so many hooks hold a copy at once, fewer as the disk fills. A hook
  that gets no slot within 5 s goes without: the baseline falls back to
  HEAD, or new untracked files are left out of that review.

Co-Authored-By: Claude &lt;noreply@anthropic.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: leave nothing behind when git is killed (2.0.9 → 2.0.10)</title>
<updated>2026-10-05T16:53:54+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>mhegazy@anthropic.com</email>
</author>
<published>2026-10-05T16:53:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=a22217bb450a6cc00d7a161566e7cc7d96dbf63a'/>
<id>a22217bb450a6cc00d7a161566e7cc7d96dbf63a</id>
<content type='text'>
With a very large git index the hook's git calls hit their time limits and
are killed, so git cannot clean up. Each kill could leave an index-sized
file in the temp directory, index.stash.&lt;pid&gt; files in .git, and a dead
.git/index.lock that fails the user's next git add or commit.

- `git stash create` and the work-tree diff run on a throwaway index copy.
- Every git the hook spawns gets GIT_OPTIONAL_LOCKS=0.
- Copies live in a private per-user folder and are removed together with
  the files git writes next to them.
- Leftovers older than 30 minutes are swept, including existing ones.

Co-Authored-By: Claude &lt;noreply@anthropic.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With a very large git index the hook's git calls hit their time limits and
are killed, so git cannot clean up. Each kill could leave an index-sized
file in the temp directory, index.stash.&lt;pid&gt; files in .git, and a dead
.git/index.lock that fails the user's next git add or commit.

- `git stash create` and the work-tree diff run on a throwaway index copy.
- Every git the hook spawns gets GIT_OPTIONAL_LOCKS=0.
- Copies live in a private per-user folder and are removed together with
  the files git writes next to them.
- Leftovers older than 30 minutes are swept, including existing ones.

Co-Authored-By: Claude &lt;noreply@anthropic.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: follow the newest Opus instead of a pinned release (2.0.8 → 2.0.9)</title>
<updated>2026-10-02T20:17:39+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>mhegazy@anthropic.com</email>
</author>
<published>2026-10-02T20:17:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=01f8be9b220b6e993a3c2cb219f28d7cc6fd3d6f'/>
<id>01f8be9b220b6e993a3c2cb219f28d7cc6fd3d6f</id>
<content type='text'>
The review model was hardcoded to claude-opus-4-7, so the plugin fell
behind each time a new Opus shipped.

- The diff review asks the configured endpoint (GET /v1/models) for the
  newest Opus it serves, cached for a day; claude-opus-5-5 if it can't say.
- The agentic commit review, and every review on Bedrock, Vertex and
  Foundry, use Claude Code's `opus` alias.
- SECURITY_REVIEW_MODEL and SG_AGENTIC_MODEL still pin a model.
- Adds pricing rows for the newer Opus models, and tests.

Co-Authored-By: Claude Code &lt;noreply@anthropic.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The review model was hardcoded to claude-opus-4-7, so the plugin fell
behind each time a new Opus shipped.

- The diff review asks the configured endpoint (GET /v1/models) for the
  newest Opus it serves, cached for a day; claude-opus-5-5 if it can't say.
- The agentic commit review, and every review on Bedrock, Vertex and
  Foundry, use Claude Code's `opus` alias.
- SECURITY_REVIEW_MODEL and SG_AGENTIC_MODEL still pin a model.
- Adds pricing rows for the newer Opus models, and tests.

Co-Authored-By: Claude Code &lt;noreply@anthropic.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Harden git invocation and repository hint handling</title>
<updated>2026-09-09T17:42:50+00:00</updated>
<author>
<name>Octavian Guzu</name>
<email>oct@anthropic.com</email>
</author>
<published>2026-09-09T17:42:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=debbe686ab74ec095436a499b1a59864037e46cf'/>
<id>debbe686ab74ec095436a499b1a59864037e46cf</id>
<content type='text'>
:house: Remote-Dev: homespace
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
:house: Remote-Dev: homespace
</pre>
</div>
</content>
</entry>
<entry>
<title>Adjust SubagentStop handling and repository precedence</title>
<updated>2026-09-09T16:46:55+00:00</updated>
<author>
<name>Octavian Guzu</name>
<email>oct@anthropic.com</email>
</author>
<published>2026-09-09T16:46:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=f03d41e2c96f30b7b59a05566e998e6236a943e7'/>
<id>f03d41e2c96f30b7b59a05566e998e6236a943e7</id>
<content type='text'>
- SubagentStop reviews without consuming or advancing the session's
  Stop state; an identical diff is not reviewed twice.
- SubagentStop from a different working tree than the project is skipped.
- An explicit `git -C &lt;dir&gt;` / `cd &lt;dir&gt;` naming another repository takes
  precedence over the hook cwd.
- Narrows the `git -C … commit` matcher; keeps Windows path separators
  when tokenizing; adds `--no-textconv` to diff/show invocations.
- Adds tests.

:house: Remote-Dev: homespace
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- SubagentStop reviews without consuming or advancing the session's
  Stop state; an identical diff is not reviewed twice.
- SubagentStop from a different working tree than the project is skipped.
- An explicit `git -C &lt;dir&gt;` / `cd &lt;dir&gt;` naming another repository takes
  precedence over the hook cwd.
- Narrows the `git -C … commit` matcher; keeps Windows path separators
  when tokenizing; adds `--no-textconv` to diff/show invocations.
- Adds tests.

:house: Remote-Dev: homespace
</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: resolve repository from command and edited paths (2.0.7 → 2.0.8)</title>
<updated>2026-09-09T13:41:46+00:00</updated>
<author>
<name>Octavian Guzu</name>
<email>oct@anthropic.com</email>
</author>
<published>2026-09-09T13:41:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=0b2f3e30a9c6f6e5ed7ca72408ffb957103174ca'/>
<id>0b2f3e30a9c6f6e5ed7ca72408ffb957103174ca</id>
<content type='text'>
- Adds repository resolution from `git -C &lt;dir&gt;` / `cd &lt;dir&gt;` in the hook
  command, from the commit SHA, and from edited file paths when the hook
  cwd is not a git repository.
- Adds PostToolUse matchers for `git -C … commit|push`.
- Registers SubagentStop.
- Adds `repo_resolution` / `cwd_is_repo` metric fields.
- Adds tests.

:house: Remote-Dev: homespace
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- Adds repository resolution from `git -C &lt;dir&gt;` / `cd &lt;dir&gt;` in the hook
  command, from the commit SHA, and from edited file paths when the hook
  cwd is not a git repository.
- Adds PostToolUse matchers for `git -C … commit|push`.
- Registers SubagentStop.
- Adds `repo_resolution` / `cwd_is_repo` metric fields.
- Adds tests.

:house: Remote-Dev: homespace
</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: probe for a non-PATH 3.10+ interpreter on HOOK_PY_INCOMPATIBLE (2.0.6 → 2.0.7) (#2854)</title>
<updated>2026-08-13T01:14:09+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>8000722+mhegazy@users.noreply.github.com</email>
</author>
<published>2026-08-13T01:14:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=222b19d2d1c635c440cc490364f5a88169ee31a7'/>
<id>222b19d2d1c635c440cc490364f5a88169ee31a7</id>
<content type='text'>
Instrument-first for the macOS Python-3.9 cohort.

v2.0.6 telemetry: ~13.6% of macOS sessions (~6,337 users) run on Apple's
Python 3.9 → HOOK_PY_INCOMPATIBLE → the agentic reviewer can't load (needs
3.10+ syntax). That's ~12x macOS's build-failure rate and the single
biggest macOS degradation. sg-python.sh only probes `python3.1x` on PATH,
so these users have nothing newer ON PATH — but they may still have a
3.10+ installed at a standard location that isn't on the hook's PATH
(Homebrew /opt/homebrew, python.org framework, etc.).

Before building an explicit-path interpreter search, size the RECOVERABLE
fraction: `_probe_alt_python()` checks Homebrew / python.org / distro
locations for a 3.10+ binary and emits the highest found as `sdk_alt_py`
(major*100+minor, or 0 = genuinely 3.9-only). Telemetry-only; probed ONLY
on the HOOK_PY_INCOMPATIBLE path, so healthy sessions never run it.

After a data cycle: non-zero sdk_alt_py = recoverable by an explicit-path
search in sg-python.sh; 0 = needs a user-side Python install (the one-time
notice is the only lever). That decides whether the search is worth building.

Verified locally on macOS Python 3.13:
  - py_compile clean; probe returns 314 on this Mac (homebrew 3.14 present).
  - 7 new tests (test_altpython_probe.py): highest-version selection,
    0-when-none (mocked os.access), framework/distro path parsing, only
    counts 3.10+, and emit gated on outcome==HOOK_PY_INCOMPATIBLE.
  - Full suite 575/575 + 2 skipped.

No behavior change — purely additive telemetry on the incompatible path.
Version 2.0.6 -&gt; 2.0.7 per the per-PR-bump policy (#2114).

Co-authored-by: Claude Opus 4.7 (1M context) &lt;noreply@anthropic.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instrument-first for the macOS Python-3.9 cohort.

v2.0.6 telemetry: ~13.6% of macOS sessions (~6,337 users) run on Apple's
Python 3.9 → HOOK_PY_INCOMPATIBLE → the agentic reviewer can't load (needs
3.10+ syntax). That's ~12x macOS's build-failure rate and the single
biggest macOS degradation. sg-python.sh only probes `python3.1x` on PATH,
so these users have nothing newer ON PATH — but they may still have a
3.10+ installed at a standard location that isn't on the hook's PATH
(Homebrew /opt/homebrew, python.org framework, etc.).

Before building an explicit-path interpreter search, size the RECOVERABLE
fraction: `_probe_alt_python()` checks Homebrew / python.org / distro
locations for a 3.10+ binary and emits the highest found as `sdk_alt_py`
(major*100+minor, or 0 = genuinely 3.9-only). Telemetry-only; probed ONLY
on the HOOK_PY_INCOMPATIBLE path, so healthy sessions never run it.

After a data cycle: non-zero sdk_alt_py = recoverable by an explicit-path
search in sg-python.sh; 0 = needs a user-side Python install (the one-time
notice is the only lever). That decides whether the search is worth building.

Verified locally on macOS Python 3.13:
  - py_compile clean; probe returns 314 on this Mac (homebrew 3.14 present).
  - 7 new tests (test_altpython_probe.py): highest-version selection,
    0-when-none (mocked os.access), framework/distro path parsing, only
    counts 3.10+, and emit gated on outcome==HOOK_PY_INCOMPATIBLE.
  - Full suite 575/575 + 2 skipped.

No behavior change — purely additive telemetry on the incompatible path.
Version 2.0.6 -&gt; 2.0.7 per the per-PR-bump policy (#2114).

Co-authored-by: Claude Opus 4.7 (1M context) &lt;noreply@anthropic.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: handle signal-killed venv builds (memory) + cooldown (2.0.5 → 2.0.6)</title>
<updated>2026-06-12T07:53:02+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>mhegazy@anthropic.com</email>
</author>
<published>2026-06-12T07:53:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=4e56d19dd8d3e4fb54ec8bcbec2669c248b056d9'/>
<id>4e56d19dd8d3e4fb54ec8bcbec2669c248b056d9</id>
<content type='text'>
The real dominant Linux failure, identified by a CCR Linux repro.

A CCR container reproduced the production signature — non-zero exit +
EMPTY stdout + EMPTY stderr (~60k fires/day, 4,485 Linux users on 2.0.4):
running `python -m venv` under a tight memory limit (ulimit -v) kills the
memory-heavy venv+ensurepip/pip subprocess with SIGSEGV (-11, RLIMIT_AS)
or SIGKILL (-9, kernel OOM-killer) BEFORE it writes anything. This is
NOT the ensurepip/packaging case (that always writes to stderr, code 11)
and NOT fixable by --target (a --target pip install is also memory-heavy
and gets killed too). Three earlier hypotheses (stdout, packaging,
Option A fixes Linux) were wrong — the repro corrected them.

Changes:
  - Detect the signal kill (rc&lt;0, or 128+sig: 134/137/139) in the venv/pip
    and --target paths → err_kind "signal_killed:&lt;rc&gt;" (new code 16). The
    returncode rides in a new sdk_bootstrap_rc metric so prod confirms
    which signal dominates (-9 OOM-killer vs -11 RLIMIT_AS).
  - Cooldown: on a signal kill, write a marker and return the new
    SKIP_COOLDOWN outcome (9) on subsequent sessions for 24h — stops the
    retry storm (every session was re-attempting a build that just gets
    re-killed, burning the user's memory/CPU). Retries once per window so a
    machine that frees memory still recovers.
  - --no-cache-dir on both pip installs (venv + --target) trims pip's peak
    memory; may get marginal machines under the OOM threshold.

No happy-path change: signal detection is at the top of the existing
failure handler; cooldown is checked only after all no-op probes
(NOOP_SYSTEM/VENV/TARGET short-circuit first).

Verified locally on macOS Python 3.13:
  - py_compile clean.
  - 35 new tests (test_signal_kill_cooldown.py): _is_signal_kill across
    signals/exit-codes, rc decode, signal_killed→code 16, cooldown
    lifecycle (none→write→expire), and an integration flow — simulated
    SIGKILL'd venv → BUILD_FAILED/signal_killed:-9 + cooldown written →
    2nd run SKIP_COOLDOWN without re-attempting → retry after window;
    non-signal failure does NOT cool down; --no-cache-dir present on both
    pip paths; sdk_bootstrap_rc emitted conditionally.
  - End-to-end harness: the full kill→categorize→cooldown→skip→retry
    chain confirmed in-process.

The original CCR repro (ulimit -v ≤7000 KB → rc=-11, empty streams) is
the ground truth this fix is built on. Can be re-validated on CCR with the
same ulimit approach.

Version 2.0.5 -&gt; 2.0.6 per the per-PR-bump policy (#2114).

Co-Authored-By: Claude Opus 4.7 (1M context) &lt;noreply@anthropic.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The real dominant Linux failure, identified by a CCR Linux repro.

A CCR container reproduced the production signature — non-zero exit +
EMPTY stdout + EMPTY stderr (~60k fires/day, 4,485 Linux users on 2.0.4):
running `python -m venv` under a tight memory limit (ulimit -v) kills the
memory-heavy venv+ensurepip/pip subprocess with SIGSEGV (-11, RLIMIT_AS)
or SIGKILL (-9, kernel OOM-killer) BEFORE it writes anything. This is
NOT the ensurepip/packaging case (that always writes to stderr, code 11)
and NOT fixable by --target (a --target pip install is also memory-heavy
and gets killed too). Three earlier hypotheses (stdout, packaging,
Option A fixes Linux) were wrong — the repro corrected them.

Changes:
  - Detect the signal kill (rc&lt;0, or 128+sig: 134/137/139) in the venv/pip
    and --target paths → err_kind "signal_killed:&lt;rc&gt;" (new code 16). The
    returncode rides in a new sdk_bootstrap_rc metric so prod confirms
    which signal dominates (-9 OOM-killer vs -11 RLIMIT_AS).
  - Cooldown: on a signal kill, write a marker and return the new
    SKIP_COOLDOWN outcome (9) on subsequent sessions for 24h — stops the
    retry storm (every session was re-attempting a build that just gets
    re-killed, burning the user's memory/CPU). Retries once per window so a
    machine that frees memory still recovers.
  - --no-cache-dir on both pip installs (venv + --target) trims pip's peak
    memory; may get marginal machines under the OOM threshold.

No happy-path change: signal detection is at the top of the existing
failure handler; cooldown is checked only after all no-op probes
(NOOP_SYSTEM/VENV/TARGET short-circuit first).

Verified locally on macOS Python 3.13:
  - py_compile clean.
  - 35 new tests (test_signal_kill_cooldown.py): _is_signal_kill across
    signals/exit-codes, rc decode, signal_killed→code 16, cooldown
    lifecycle (none→write→expire), and an integration flow — simulated
    SIGKILL'd venv → BUILD_FAILED/signal_killed:-9 + cooldown written →
    2nd run SKIP_COOLDOWN without re-attempting → retry after window;
    non-signal failure does NOT cool down; --no-cache-dir present on both
    pip paths; sdk_bootstrap_rc emitted conditionally.
  - End-to-end harness: the full kill→categorize→cooldown→skip→retry
    chain confirmed in-process.

The original CCR repro (ulimit -v ≤7000 KB → rc=-11, empty streams) is
the ground truth this fix is built on. Can be re-validated on CCR with the
same ulimit approach.

Version 2.0.5 -&gt; 2.0.6 per the per-PR-bump policy (#2114).

Co-Authored-By: Claude Opus 4.7 (1M context) &lt;noreply@anthropic.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: pip --target fallback when venv can't bootstrap pip (2.0.4 → 2.0.5)</title>
<updated>2026-06-12T06:31:55+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>mhegazy@anthropic.com</email>
</author>
<published>2026-06-12T06:31:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=e7fe15d9ba8bc02a40cdccdb184f6d61a58b33cc'/>
<id>e7fe15d9ba8bc02a40cdccdb184f6d61a58b33cc</id>
<content type='text'>
Option A, the data-gated fix for venv_ensurepip_fail (#2154 follow-up).

v2.0.4 telemetry made the call: of the venv_ensurepip_fail cohort, ~95%
HAVE pip (sdk_has_pip=true) and run Python 3.11–3.14 — so it's not the
Apple-3.9 problem; it's modern interpreters where `python -m venv` can't
bootstrap pip (Debian python3-venv absent, or python.org/pyenv builds
without ensurepip) but pip itself works. `pip install --target` needs only
pip, so it recovers the agentic reviewer for them instead of degrading to
pattern + single-shot review.

Producer (ensure_agent_sdk.py):
  - New outcomes BUILT_TARGET=7, NOOP_TARGET=8; new phase pip_target=5.
  - _build_via_target(): `pip install --target &lt;state&gt;/agent-sdk-libs
    --upgrade --prefer-binary claude-agent-sdk`. Failures categorized via
    _pip_err_from_stderr (sibling of main()'s pip chain — kept separate to
    avoid disturbing the working venv categorizer); errno embedded for
    OSError-family exceptions.
  - _target_sdk_importable(): probes a prior target install → NOOP_TARGET.
    Dir-check short-circuits before any subprocess, and it's only reached
    when there's no working venv, so the 81% NOOP_VENV cohort never pays.
  - main() falls through to the target build ONLY on venv_ensurepip_fail;
    every other venv/pip failure stays terminal BUILD_FAILED. The sentinel
    is released before the target build so a retry isn't seen as SKIP_SENTINEL.

Consumer (llm.py):
  - _inject_agent_sdk_venv_into_syspath() adds the flat agent-sdk-libs dir
    (packages sit directly in it, not under site-packages). The existing
    pywin32 .pth bootstrap applies (target installs don't run .pth either).

No change to the happy path — the new branch is taken only on the
ensurepip failure, and the extra candidate dir is a no-op when absent.

Verified locally on macOS Python 3.13:
  - py_compile clean.
  - 30 new tests (test_venv_target_fallback.py): outcome/phase codes
    (append-only, 4 stays retired), _pip_err_from_stderr categories,
    _build_via_target success/CalledProcessError/timeout/exc+errno (mocked
    subprocess), _target_sdk_importable dir-short-circuit, main() wiring
    (ensurepip→target fallthrough + NOOP_TARGET probe + sentinel release),
    consumer adds the flat dir. Full suite 533/533 pass + 2 skipped.
  - END-TO-END harness (real install, simulated ensurepip failure):
    main() → BUILT_TARGET, target dir has claude_agent_sdk; 2nd run →
    NOOP_TARGET; consumer _inject → `import claude_agent_sdk` resolves
    FROM the --target dir. Full chain proven without needing a
    broken-ensurepip box.
  - Real `pip install --target` + import confirmed independently (exit 0,
    SDK imports from the flat layout).

NOT validated in tmux: the ensurepip failure can't be reproduced on macOS
(working ensurepip), so the fallback was proven via the real-install
harness above instead. The happy path (NOOP_VENV / normal agentic review)
is unchanged and covered by the existing hook-smoke suite.

Version 2.0.4 -&gt; 2.0.5 per the per-PR-bump policy (#2114).

Co-Authored-By: Claude Opus 4.7 (1M context) &lt;noreply@anthropic.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Option A, the data-gated fix for venv_ensurepip_fail (#2154 follow-up).

v2.0.4 telemetry made the call: of the venv_ensurepip_fail cohort, ~95%
HAVE pip (sdk_has_pip=true) and run Python 3.11–3.14 — so it's not the
Apple-3.9 problem; it's modern interpreters where `python -m venv` can't
bootstrap pip (Debian python3-venv absent, or python.org/pyenv builds
without ensurepip) but pip itself works. `pip install --target` needs only
pip, so it recovers the agentic reviewer for them instead of degrading to
pattern + single-shot review.

Producer (ensure_agent_sdk.py):
  - New outcomes BUILT_TARGET=7, NOOP_TARGET=8; new phase pip_target=5.
  - _build_via_target(): `pip install --target &lt;state&gt;/agent-sdk-libs
    --upgrade --prefer-binary claude-agent-sdk`. Failures categorized via
    _pip_err_from_stderr (sibling of main()'s pip chain — kept separate to
    avoid disturbing the working venv categorizer); errno embedded for
    OSError-family exceptions.
  - _target_sdk_importable(): probes a prior target install → NOOP_TARGET.
    Dir-check short-circuits before any subprocess, and it's only reached
    when there's no working venv, so the 81% NOOP_VENV cohort never pays.
  - main() falls through to the target build ONLY on venv_ensurepip_fail;
    every other venv/pip failure stays terminal BUILD_FAILED. The sentinel
    is released before the target build so a retry isn't seen as SKIP_SENTINEL.

Consumer (llm.py):
  - _inject_agent_sdk_venv_into_syspath() adds the flat agent-sdk-libs dir
    (packages sit directly in it, not under site-packages). The existing
    pywin32 .pth bootstrap applies (target installs don't run .pth either).

No change to the happy path — the new branch is taken only on the
ensurepip failure, and the extra candidate dir is a no-op when absent.

Verified locally on macOS Python 3.13:
  - py_compile clean.
  - 30 new tests (test_venv_target_fallback.py): outcome/phase codes
    (append-only, 4 stays retired), _pip_err_from_stderr categories,
    _build_via_target success/CalledProcessError/timeout/exc+errno (mocked
    subprocess), _target_sdk_importable dir-short-circuit, main() wiring
    (ensurepip→target fallthrough + NOOP_TARGET probe + sentinel release),
    consumer adds the flat dir. Full suite 533/533 pass + 2 skipped.
  - END-TO-END harness (real install, simulated ensurepip failure):
    main() → BUILT_TARGET, target dir has claude_agent_sdk; 2nd run →
    NOOP_TARGET; consumer _inject → `import claude_agent_sdk` resolves
    FROM the --target dir. Full chain proven without needing a
    broken-ensurepip box.
  - Real `pip install --target` + import confirmed independently (exit 0,
    SDK imports from the flat layout).

NOT validated in tmux: the ensurepip failure can't be reproduced on macOS
(working ensurepip), so the fallback was proven via the real-install
harness above instead. The happy path (NOOP_VENV / normal agentic review)
is unchanged and covered by the existing hook-smoke suite.

Version 2.0.4 -&gt; 2.0.5 per the per-PR-bump policy (#2114).

Co-Authored-By: Claude Opus 4.7 (1M context) &lt;noreply@anthropic.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
