Skip to content

fix(detect): recognize grok agent launcher - #3274

Closed
akbash-bot wants to merge 2 commits into
herdrdev:masterfrom
akbash-bot:akbash/3273-detect-grok-agent
Closed

fix(detect): recognize grok agent launcher#3274
akbash-bot wants to merge 2 commits into
herdrdev:masterfrom
akbash-bot:akbash/3273-detect-grok-agent

Conversation

@akbash-bot

Copy link
Copy Markdown
Collaborator

Issue

Starting the official Grok CLI with agent leaves the pane unknown. It does not appear in the Agents panel or agent commands.

Problem

macOS reports agent as the launch name while retaining a truncated versioned Grok process name. Herdr trusted the launch name and discarded the Grok evidence.

How did we fix it?

Herdr now recognizes agent only when the independent process name matches the strict versioned macOS Grok shape. Ordinary agent processes and Cursor aliases remain unknown. Normal grok launches are unchanged.

Verification

The reporter's exact process snapshot failed identification before the change and resolves to Grok afterward. Canonical Grok and focused false-positive cases pass. Formatting, Clippy, Windows lint, architecture, asset, marketplace, and maintenance checks pass. Of 3,536 Rust tests, 3,535 pass; the existing live-handoff test cannot discover its replacement process with this harness's external CARGO_TARGET_DIR.

refs #3273

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e14cae87-f3ba-4dd8-8ac0-6b0ce414276f

📥 Commits

Reviewing files that changed from the base of the PR and between 833961f and 59bd984.

📒 Files selected for processing (3)
  • src/detect/mod.rs
  • src/platform/macos.rs
  • src/platform/mod.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Process detection now delegates process-specific alias resolution to the platform layer. macOS recognizes valid versioned Grok agent processes as grok. Non-macOS platforms return no alias. Tests cover valid and invalid matching and platform-specific identification.

Changes

Grok process detection

Layer / File(s) Summary
Platform alias validation and coverage
src/platform/mod.rs, src/platform/macos.rs
The platform layer validates the macOS Grok executable format and exact argv0 value, returns the grok alias for matches, and returns no alias on non-macOS platforms. Tests cover valid, invalid, and platform-specific cases.
Detector integration and legacy test removal
src/detect/mod.rs
Process-name normalization uses platform alias resolution. The local Grok validator, helper fixture, and obsolete invalid-name tests were removed. Canonical Grok launch coverage remains.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🔵 Low · up to 59bd9

The change enables Grok detection for the generic agent launcher, but the macOS-specific matching remains active on non-macOS targets and could misclassify some generic agent processes there. The PR is mergeable with explicit owner awareness or follow-up to confirm platform scoping.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: recognizing the Grok agent launcher in process detection.
Description check ✅ Passed The description explains the macOS Grok CLI detection issue, the strict matching fix, preserved behavior, and verification results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 26, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 93490484-6529-4816-9c00-b0f1b502ece2

📥 Commits

Reviewing files that changed from the base of the PR and between d79fd74 and 833961f.

📒 Files selected for processing (1)
  • src/detect/mod.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread src/detect/mod.rs Outdated
@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds a narrowly scoped macOS process alias so an official Grok launcher reported as agent is identified as Grok while preserving existing behavior on other platforms.

  • Adds strict recognition for the 15-byte truncated, versioned Grok process name paired with an agent launch name.
  • Applies the platform alias during foreground-process normalization.
  • Adds tests for canonical Grok launches, intended false-positive exclusions, and platform-specific identification behavior.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code failure identified.

The alias is restricted to macOS and requires both the exact normalized agent launch name and a strict versioned, truncated Grok process-name shape; non-macOS targets retain the existing behavior.

Important Files Changed

Filename Overview
src/detect/mod.rs Integrates platform-specific process aliases into agent-name normalization and verifies canonical Grok detection remains intact.
src/platform/macos.rs Maps the validated macOS Grok launcher process shape to the canonical grok identity.
src/platform/mod.rs Defines the cross-platform alias boundary, strict macOS matcher, and focused positive, negative, and platform-gating tests.

Reviews (1): Last reviewed commit: "fix(detect): scope grok alias to macos" | Re-trigger Greptile

@ogulcancelik

Copy link
Copy Markdown
Collaborator

@akbash-bot both cursor and grok uses "agent" as a cli alias. i'm not happy to reserve a general name as "agent" to a specific cli. wdyt?

@akbash-bot

Copy link
Copy Markdown
Collaborator Author

I agree that agent should not be reserved in the shared alias table. This patch does not do that: argv0 = agent alone stays unknown, and it maps to Grok only when macOS independently reports the versioned Grok executable name. Cursor’s agent launch remains distinguishable through its persistent bundled Node process.

That said, this is still a Grok-specific exception. If we do not want per-agent executable-identity exceptions, I would close this PR rather than broaden agent; the explicit workaround is HERDR_AGENT=grok agent. A more general future fix would expose and classify resolved executable identity, not claim the command alias.

@kangal-bot kangal-bot removed the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 27, 2026
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.

3 participants