Repository navigation
feat(agent-isolation): hint when gh ran inside the sandbox and catalogue the TLS -26276 shape - #1289
Merged
Merged
Conversation
…gue the TLS -26276 shape A `gh` call that is not excluded from the sandbox fails on macOS with `tls: failed to verify certificate: x509: OSStatus -26276` (or an `HTTP 401`), because Go verifies TLS through Security.framework and the Seatbelt profile blocks the trustd / keychain mach services. Nothing on the Go side can route around that, so the `gh *` exclusion in `sandbox.excludedCommands` is the only remedy — and it applies only when every part of the Bash invocation is `cd …` or `gh …`. A pipe, a `$(…)` substitution, a loop, or any file redirection (even `> /dev/null`) puts `gh` back in the sandbox. The redirection case is a Claude Code regression reported as anthropics/claude-code#95532. - sandbox-troubleshooting.md: new catalog entry with the measured invocation-shape table, the reason it cannot be fixed in-sandbox, and the `gh tofile` alias that moves a redirection inside `gh`. - sandbox-error-hint.sh: recognise the two signatures and point at the entry; first test file for the hook (14 cases). - isolated-setup-doctor: Probe 6 runs `gh` through `sh -c` so the exclusion cannot apply, then checks the exclusion is configured; the interpret-probes eval gains a `gh_sandbox_status` field and a case-9 fixture for the ✗ shape. - isolated-setup-verify: check 11 requires `"gh *"` in `excludedCommands`; the canonical prompt in secure-agent-setup.md gains the same item. - secure-agent-setup.md: hint-signature table gains the missing /tmp row and the new gh row; the annotated settings comment explains the shape rule. - spec: new tools/spec-loop/specs/sandbox-diagnostics.md covering the catalog, the hint hook, the doctor probes and the verify checks as one contract (catalog is the source of truth; the other three are discoverability layers); cross-linked from agent-isolation-sandbox.md. Generated-by: Claude Opus 5
Member
Author
|
Hopefully one of the last to avoid unnecessary prompts and bypassing sandbox. |
This was referenced Sep 19, 2026
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ghcall that does not get excluded from the sandbox fails on macOS withx509: OSStatus -26276(orHTTP 401): Go verifies TLS through Security.framework and the Seatbelt profile blocks the trustd / keychain mach services. This cannot be fixed in-sandbox (no fallback roots in the Homebrewgh,SSL_CERT_FILEignored on darwin, no mach-service setting in Claude Code), so thegh *exclusion is the only remedy — and it applies only when every part of the Bash invocation iscd …orgh …. A pipe,$(…), a loop, or any file redirection (even> /dev/null) putsghback in the sandbox. The redirection case is a Claude Code regression, reported as anthropics/claude-code#95532.docs/setup/sandbox-troubleshooting.md(measured shape table, root cause, thegh tofilealias workaround), a matching[sandbox-hint]signature insandbox-error-hint.sh, a sixth doctor probe with an eval fixture, an eleventh verify check, and a new spectools/spec-loop/specs/sandbox-diagnostics.mdthat describes the catalog / hook / doctor / verify surface as one contract.secure-agent-setup.mdwas missing the/tmprow.Type of change
.claude/skills/<name>/) — eval fixtures updated belowtools/<system>/*.md)tools/*/withpyproject.toml)docs/,README.md,CONTRIBUTING.md)projects/_template/)prek, workflows, validators)Test plan
prek run --files <all changed files>passes every hook (rebased on fix(agent-isolation): show the touch overlay on macOS and for ssh-signed commits #1288, which fixed the pre-existingtest_gpg_touch_overlayfailure that blocked the earlier commit)uv run --project tools/agent-isolation --group dev python -m pytest tools/agent-isolation/tests/test_sandbox_error_hint.py— 14 passed (written red first: the four gh cases failed before the hook change)gh tofilealias verified from a sandboxed call: writes to the scratch tree, refuses a path outside$PWD/ the scratch tree with exit 2setup-isolated-setup-doctor(interpret-probes,after-report) andsetup-isolated-setup-verify(step-1-classify) — the renamed sections extract and include the new probe / checkinterpret-probesgains agh_sandbox_statusfield (schema extended the same way fix(agent-isolation): show the touch overlay on macOS and for ssh-signed commits #1288 addedsigning_key_status), the eight existing fixtures carry"skip"for it, andcase-9-gh-sandbox-failcovers the ✗ shapespec-validateandcheck-doc-syncpass; the spec's own validation block cross-checks every hook anchor against the catalog headingsskill-token-count --write)RFC-AI-0004 compliance
gh tofilealias is documented as an operator-installed convenience and refuses paths outside the working directory / scratch treeLinked issues
Refs anthropics/claude-code#95532 (the upstream redirection regression), anthropics/claude-code#85857 (trustd mach-lookup root cause). Follows #1288 (Probe 5 / check 10 there; this PR adds Probe 6 / check 11).
Notes for reviewers (optional)
tools/spec-loop/specs/named the hint hook, the doctor probes, or the verify checks, so this PR addssandbox-diagnostics.mdfor that surface (catalog as source of truth; hook, doctor and verify as discoverability layers; theghexclusion shape rule as contract), cross-links it fromagent-isolation-sandbox.md, lists it in both spec indexes, and bumps.last-syncto the basemaintip.🤖 Generated with Claude Code