Skip to content

Commit cf493bb

Browse files
committed
fix: reject unknown CLI args unless running in --reflect mode
Previously, agentmain.py used parse_known_args() and silently ignored unknown flags. A typo like `--goal` (intended for a different launcher) was accepted without warning, causing the process to fall through into interactive mode and hang without dispatching any work. Now, unknown arguments are only permitted when --reflect is set, since extra key/value pairs are forwarded to the reflect script as parameters. Otherwise parser.error() prints usage and exits non-zero. Closes #566
1 parent 889859d commit cf493bb

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

agentmain.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ def run(self):
204204
parser.add_argument('--verbose', action='store_true')
205205
parser.add_argument('--nobg', action='store_true')
206206
args, _unknown = parser.parse_known_args()
207+
if _unknown and not args.reflect:
208+
# Reject unknown CLI flags unless we are in --reflect mode, where
209+
# extra key/value pairs are forwarded to the reflect script.
210+
# Without this guard, typos like `--goal` silently fall through to
211+
# interactive mode and the process looks alive without doing any work.
212+
parser.error(f"unrecognized arguments: {' '.join(_unknown)}")
207213
_reflect_args = dict(zip([k.lstrip('-') for k in _unknown[::2]], _unknown[1::2])) if _unknown else {}
208214

209215
if args.task and not args.nobg:

0 commit comments

Comments
 (0)