Repository navigation
perf: skip unused Grok login-shell probe when installing agent hooks - #26241
Merged
Merged
Conversation
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.
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:
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
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,
shmode, 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
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 tcpasses, and the 106-file changed-code quality gate reports no new findings. All required selected hosted checks pass.Checklist