Skip to content

fix(agent-manager): resolve spaced argv0 in AGENTS matchers - #300

Merged
codeaholicguy merged 1 commit into
mainfrom
fix/297-agents-argv-spaces
Sep 29, 2026
Merged

codeaholicguy merged 1 commit into
mainfrom
fix/297-agents-argv-spaces

Conversation

@codeaholicguy

@codeaholicguy codeaholicguy commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Reuse executablePath() in matchArgv0, matchArgv0Name, and matchAnyBasename.
  • Detect agents whose executable is installed beneath a path containing spaces.
  • Avoid filesystem checks unless the command is a plausible spaced-path candidate.
  • Prevent words inside the installation directory from being treated as executable matches.

Closes #297

Validation

  • Includes regression coverage for spaced executable paths and false-positive directory tokens.

Follow-up

  • matchAnyToken intentionally continues scanning arguments for cases such as Gemini launched as a Node script.

matchArgv0, matchArgv0Name, matchAnyToken and matchAnyBasename split the ps command line on whitespace, so an agent installed under a directory containing spaces was not recognised as argv[0] when confirming the launched PID. Resolve argv[0] with executablePath() from utils/process and scan only the remaining arguments in the any-token matchers. Arguments are still never folded into the executable path unless the combined path exists, and the filesystem is only consulted when a later token could complete a matching argv[0].
@codeaholicguy
codeaholicguy merged commit 1e33f43 into main Sep 29, 2026
7 checks passed
@codeaholicguy
codeaholicguy deleted the fix/297-agents-argv-spaces branch September 29, 2026 14:14
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.

fix(agent-manager): utils/agents.ts argv matchers split on whitespace and miss agents under paths with spaces

1 participant