feat(detect): configurable wrapper process detection - #1
Draft
kimchh wants to merge 1 commit into
Draft
Conversation
Add a [detection] config section with a wrappers map that lets users configure custom wrapper processes for agent identification. Strategies per wrapper: - "inspect" — scan argv for a known agent name - "inspect:<default>" — same, with a fallback agent - fixed string — always resolve to that agent
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.
Summary
When an agent runs inside a wrapper process (a sandbox, a custom launcher, a container entry point), herdr can't identify it because the foreground process name is the wrapper, not the agent itself.
This adds a
[detection.wrappers]config map that teaches herdr how to see through wrapper processes to the agent underneath.Each entry maps a wrapper process name to a detection strategy:
"inspect"--flagmatching a known agent name. ReturnNoneif nothing matches."inspect:<default>"inspect, but fall back to<default>if no agent is found in argv.Example config
How it works
During process identification, if the normalized process name matches a configured wrapper, herdr applies the strategy against that process's argv before falling back to the standard detection path. This means existing detection behavior is unchanged when no wrappers are configured.
Changes
src/config/model.rs— newDetectionConfigstruct withwrappers: HashMap<String, String>src/config/io.rs— register thedetectionconfig sectionsrc/detect/mod.rs—configured_wrapper_agent()strategy resolver, plumbing throughidentify_agent_in_jobandnormalized_process_namesrc/pane.rs,src/app/agents.rs,src/platform/windows.rs— pass wrappers through call sites