Skip to content

perf: skip unused Grok login-shell probe when installing agent hooks - #26241

Merged
nwparker merged 1 commit into
mainfrom
nwparker/perf-managed-hook-grok-probe
Oct 8, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/perf-managed-hook-grok-probe

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Installing hooks for Claude, Codex, or other agents unnecessarily started a login shell to discover Grok's home directory. Only start that shell when Grok is selected.

What Changed

Gate the existing Grok home probe on the existing selected-agent allowlist. Keep the same probe and fallback for Grok, and preserve cancellation, installation lock, host identity, version options, summaries, and generated hook files.

Why

Only the selected Grok installer consumes this directory. Skipping its unused probe removes one native subprocess without adding caching or changing agent detection. This is reached by background hook installation on the SSH execution host; it can make hooks available sooner, but is not a measured terminal typing or blocking SSH startup fix.

Seven alternating complete cold calls of the public installer, using real filesystem operations, installers, lock and process identity on macOS:

Selected agents Before After
Claude 71.51 ms 21.06 ms
Codex 85.28 ms 30.59 ms
Claude and Codex 102.42 ms 48.64 ms

These native Bash trials read the ordinary login profile; only hook homes and durable host-token writes were redirected to owned temporary directories. Profile side effects were not instrumented. An independent isolated Zsh run also removed the subprocess, saving about 3–14 ms per complete call. Selected Grok retains its original probe. No artificial profile delay was introduced.

Linked Issue

No linked issue; maintainer performance audit.

Visual Proof

N/A — background hook installation produces the same files and summaries; no rendered UI or interaction changes.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

macOS: the updated non-Grok regression fails on baseline with an extra login-shell invocation; selected Grok passes before and after. All nine runtime tests pass after the change. Entire agent-hook suite passes: 122 files, 1,250 tests, ten existing skipped tests. Node typecheck, changed-code quality, formatting, and fresh Electron build pass.

Seventeen temporary paired controls exercise all 21 non-Grok targets, omitted/empty selections, duplicates, Claude version, redirected/mixed Grok, invalid homes and shell failures, sh mode, and cancellation before/during the native probe. Complete summaries/errors and generated file hashes match. The controlled runs guard filesystem mutations and write only to owned temporary paths. Native Windows/Linux and physical SSH transport were not exercised.

Review

Independent review read the complete runtime installer, catalog, Grok consumer and actual relay caller/allowlist validation; no ordinary behavior tradeoff found. Root reviewed the diff and red/green tests.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer code or artifacts copied.

Notes

The execution host still owns all hook installation. No new cache, IPC, wire fields, polling, or folder/git-worktree assumptions. Windows relay hook installation remains gated by its existing host check. Combined with all 34 audit changes: 447 affected test files / 3,727 tests pass (two existing skipped files / 13 skipped tests), full pnpm tc passes, and the 106-file changed-code quality gate reports no new findings. All required selected hosted checks pass.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Visual proof is N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • Relevant tests, typecheck, quality checks, format and build pass; remaining checks in CI

@nwparker
nwparker merged commit f052e2f into main Oct 8, 2026
19 checks passed
@nwparker
nwparker deleted the nwparker/perf-managed-hook-grok-probe branch October 8, 2026 06:46
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.

1 participant