Skip to content

fix(agent-isolation): show the touch overlay for agent-run git on Linux - #1365

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:fix/gpg-touch-overlay-hook-parent
Sep 23, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
potiuk:fix/gpg-touch-overlay-hook-parent

Conversation

@potiuk

@potiuk potiuk commented Sep 23, 2026

Copy link
Copy Markdown
Member

Summary

  • The touch overlay never appears for a git commit / push the agent runs on Linux. arm gave the watcher $PPID as its owner, but Claude Code runs a hook command through sh -c, so $PPID is that shell — which exits the moment the hook returns. The parent-liveness check in _watch then ends the watch on its first poll, before the key has blocked. The wrap path (commits from the operator's own terminal) passes $$ and is unaffected, which is why the overlay still shows there.
  • arm now resolves the owner by walking up from $PPID past shell processes to the harness itself, and uses that pid for the watcher's parent check, the registration's owner (so the next arm's sweep does not kill a live session's watcher), and the h-<pid> owner id fallback. Where the harness starts the hook directly (possibly macOS), the walk stops at $PPID and nothing changes.

Type of change

  • Cross-cutting (RFC, AGENTS.md, sandbox, privacy-LLM)
  • Other: tools/agent-isolation hook script + its regression test

Test plan

  • New test_watcher_outlives_the_shell_the_hook_ran_in arms through sh -c 'bash gpg-touch-overlay.sh arm'; it fails on main (the registered owner is the exited sh, not the test process) and passes with the fix.
  • uv run pytest in tools/agent-isolation — all tests pass (run outside the Claude Code sandbox: test_agent_socket_rows_follow_the_connections_held_open needs socket(AF_UNIX), which the Linux sandbox's seccomp filter rejects).
  • prek run on the changed files passes.
  • End to end on Linux (Ubuntu, GNOME, YubiKey via gpg-agent ssh socket): before the fix the watcher log showed kill -0 <sh pid> failing and break on the first iteration; after it, the watcher tracked the claude process, counted the blocked polls, and raised the GTK overlay during a git ls-remote over ssh.

RFC-AI-0004 compliance

  • Sandbox — no new host access; the hook still runs outside the sandbox as before, it only reads ps for its own ancestors.

Linked issues

Regression from #1296, which added the parent-liveness check.

Notes for reviewers (optional)

The shell names skipped are sh, bash, dash, zsh (plus login-shell - forms). A harness that wraps hooks in some other interpreter would still hit the old behaviour; widening the list is cheap if one turns up.

🤖 Generated with Claude Code

… touch watcher's owner

Claude Code on Linux runs a hook through `sh -c`, so the hook's $PPID is
a shell that exits as soon as the hook returns, and the watcher's
parent-liveness check ended the watch before the key ever blocked.

Generated-by: Claude Code (Opus 5.5)
@potiuk
potiuk merged commit 0bcbf4c into apache:main Sep 23, 2026
9 checks passed
potiuk added a commit that referenced this pull request Sep 24, 2026
Reconciles the spec-loop specs with the functionality that shipped
between 5c75abd and bcd8b7f:

- agent-isolation-sandbox: the hardware-key touch policy (sig cached +
  aut off with OpenPGP signing, aut cached with gpg.format=ssh) (#1367);
  touch-watcher owner is the harness (#1365); macOS overlay closes on
  deactivation (#1325); whole-user git hooks allowRead and dispatcher
  flavour (#1364, #1322, #1358); agent-guard finds the git subcommand
  past global flags (#1330); agent-guard plugin counts as a complete
  install (#1323); per-tool cooldown_days, bubblewrap 0.13.0 (#1360).
- sandbox-diagnostics: ten catalogue entries (prek/uv not found, git
  hooks silently skipped) (#1359, #1364); doctor probes as scripts, with
  probes 7 and 8 (#1336, #1362, #1364); verify's 12 checks and
  conditional-checks.md (#1334).
- vetted-command-surface: HTTP read backend with the OSV and CVE.org
  operations (#1326); the vetted-op-read recipe spelling (#1339); the
  plugin copy resolves standalone (#1357).
- cve-tooling: tools/osv (contract:security-cross-ref) and the cve-org
  check through vetted-ops (#1297, #1326).
- security-issue-lifecycle: step 2b proposes going ahead on a quiet
  reporter (#1340); the post-advisory security-pages update (#1355).
- meta-and-quality-tooling: name: must match the skill directory
  (#1361); skill-evals fixture containment and grader retry (#1315,
  #1341); optimize-skill budgets, eval gate, rewrite and extract-code
  passes (#1331, #1332, #1335, #1338); diff-scoped prek CI (#1317).
- marketplace-distribution: substrate plugins (#1368, #1357).
- adversarial-review (new): the tool and substrate plugin as shipped
  (#1368), with its known gaps.

Generated-by: Claude Opus 5
@potiuk potiuk added the substrate:sandbox Tool substrate: agent isolation, egress control, settings audit label Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

substrate:sandbox Tool substrate: agent isolation, egress control, settings audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant