Skip to content

feat: detect agents hosted in editor-embedded terminals - #2606

Closed
devgony wants to merge 1 commit into
herdrdev:masterfrom
devgony:feat/editor-embedded-agent-detection
Closed

feat: detect agents hosted in editor-embedded terminals#2606
devgony wants to merge 1 commit into
herdrdev:masterfrom
devgony:feat/editor-embedded-agent-detection

Conversation

@devgony

@devgony devgony commented Aug 10, 2026

Copy link
Copy Markdown

Summary

Agents launched from nvim/vim :terminal buffers (e.g. opencode or codex started by an nvim plugin) run on their own pty and process group, so they never join the pane's foreground job and were invisible to herdr's process-based agent identification on Unix. Windows already finds them via descendant traversal; this brings Unix to parity.

Changes

  • platform::descendant_processes(root_pid): bounded (64) BFS descendant walk — macOS proc_listpids(PROC_PPID_ONLY), Linux /proc/*/task/*/children, Windows snapshot reuse, fallback stub
  • detect::identify_agent_hosted_by_editor: when the foreground job contains a terminal-hosting editor (nvim/vim/vi) and no agent was identified, identify agents among the editor's descendants using the existing scoring (including runtime-wrapped agents)
  • Wired as a last-resort fallback in the pane detection probe and live_runtime_agent; descendants are scanned only when an editor is foreground and nothing else matched, so normal panes pay no extra cost

Testing

  • Unit tests: editor-hosted identification (direct, runtime-wrapped, no-agent descendants, non-editor skip) and probe fallback wiring
  • Live tests: descendant_processes finds a spawned child on macOS and Linux
  • Manual (macOS, debug session): nvim -c ':terminal codex' → pane reports agent: codex, detected through nvim → nvim --embed → agent; clears after the agent exits while nvim keeps running, and when nvim exits
  • cargo nextest green; cargo clippy -D warnings clean on host and x86_64-pc-windows-msvc; docs/next changelog updated

Agents launched from nvim/vim :terminal buffers run on their own pty and
process group, so they never join the pane's foreground job. When the
foreground job contains a terminal-hosting editor and no agent was
identified, walk the editor's descendant processes and identify agents
there.
@kangal-bot

Copy link
Copy Markdown
Collaborator

Hi @devgony, thanks for your interest in contributing.

Herdr does not accept unsolicited implementation pull requests from contributors who are not listed in .github/APPROVED_CONTRIBUTORS.

The pull request author is not an approved contributor.

If you encountered a reproducible bug, report the observed behavior through the bug issue template. A report does not reserve the work or authorize a pull request; accepted fixes are normally implemented by Herdr’s maintainer-controlled agents.

Feature requests, behavior changes, and other proposals belong in GitHub Discussions. Do not open an issue merely to justify an implementation that was already written.

If a maintainer explicitly wants this implementation, they can reopen the pull request. Reopening by anyone else will be closed again automatically.

See https://github.com/herdrdev/herdr/blob/master/CONTRIBUTING.md for the contribution policy.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • ai-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6ce65d6d-1476-4c89-a438-447bdedf52a1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

@kangal-bot kangal-bot closed this Aug 10, 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.

2 participants