feat: detect agents hosted in editor-embedded terminals - #2606
Conversation
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.
|
Hi @devgony, thanks for your interest in contributing. Herdr does not accept unsolicited implementation pull requests from contributors who are not listed in 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. |
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Summary
Agents launched from nvim/vim
:terminalbuffers (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 — macOSproc_listpids(PROC_PPID_ONLY), Linux/proc/*/task/*/children, Windows snapshot reuse, fallback stubdetect::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)live_runtime_agent; descendants are scanned only when an editor is foreground and nothing else matched, so normal panes pay no extra costTesting
descendant_processesfinds a spawned child on macOS and Linuxnvim -c ':terminal codex'→ pane reportsagent: codex, detected through nvim →nvim --embed→ agent; clears after the agent exits while nvim keeps running, and when nvim exitscargo nextestgreen;cargo clippy -D warningsclean on host andx86_64-pc-windows-msvc;docs/nextchangelog updated