Summary
Arguments passed after the -- terminator are supposed to be treated as raw, untouched positional args (standard pflag/cobra behavior). Instead, pkg/registry/flag.go's indexNextPositional —
used by IndexVerbNoun/CanonicalizeNounArgs to locate/rewrite the noun token before cobra ever parses flags — does not special-case "--" as a terminator, and its "unknown flag consumes next
token as value" heuristic can eat the very next token after -- if it looks like an unrecognized flag.
Repro
harness execute artifact:pip_install -- -r requirements.txt
Expected: pip install -r requirements.txt is run (via nativeArgs forwarded to pipClient.RunCommand).
Actual: pip receives only requirements.txt as a bare positional arg — -r is dropped — producing:
ERROR: Could not find a version that satisfies the requirement requirements.txt
Confirmed via debug trace that args arriving at RunCommand in pkgmgr_pip.go is []string{"requirements.txt"}, i.e. -r is already gone before it reaches command execution.
Summary
Arguments passed after the -- terminator are supposed to be treated as raw, untouched positional args (standard pflag/cobra behavior). Instead,
pkg/registry/flag.go'sindexNextPositional —used by IndexVerbNoun/CanonicalizeNounArgs to locate/rewrite the noun token before cobra ever parses flags — does not special-case "--" as a terminator, and its "unknown flag consumes next
token as value" heuristic can eat the very next token after -- if it looks like an unrecognized flag.
Repro
harness execute artifact:pip_install -- -r requirements.txtExpected: pip install -r requirements.txt is run (via nativeArgs forwarded to pipClient.RunCommand).
Actual: pip receives only requirements.txt as a bare positional arg — -r is dropped — producing:
ERROR: Could not find a version that satisfies the requirement requirements.txt
Confirmed via debug trace that args arriving at RunCommand in pkgmgr_pip.go is []string{"requirements.txt"}, i.e. -r is already gone before it reaches command execution.