Fix argparse nargs="*" → REMAINDER for forwarded task args in run_tasks_in_agents_if_exists.py#89
Open
Fix argparse nargs="*" → REMAINDER for forwarded task args in run_tasks_in_agents_if_exists.py#89
nargs="*" → REMAINDER for forwarded task args in run_tasks_in_agents_if_exists.py#89Conversation
Co-authored-by: pmalarme <686568+pmalarme@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix argparse
Fix argparse Feb 19, 2026
nargs="*" to use REMAINDER in scriptnargs="*" → REMAINDER for forwarded task args in run_tasks_in_agents_if_exists.py
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the run_tasks_in_agents_if_exists.py script where argparse was incorrectly treating flag-like arguments (e.g., --fix, -k) as unrecognized options instead of forwarding them to the underlying Poe task. The fix changes the extra argument from nargs="*" to nargs=argparse.REMAINDER, which captures all trailing tokens verbatim—including flags—and forwards them correctly.
Changes:
- Updated
scripts/run_tasks_in_agents_if_exists.pyto useargparse.REMAINDERinstead ofnargs="*"for theextraargument, enabling proper forwarding of flag arguments to Poe tasks
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
nargs="*"causes argparse to treat any--prefixed token as an option flag, so args like--fix,-k, or--passed after the task name would raiseunrecognized argumentsinstead of being forwarded to Poe.scripts/run_tasks_in_agents_if_exists.py: Changeextraargument fromnargs="*"tonargs=argparse.REMAINDER, so all trailing tokens—including flags—are collected verbatim and forwarded to the underlying Poe task.Testing
uv run poe checkChecklist
Additional context
Original prompt
nargs="*"inrun_tasks_in_agents_if_exists.pyto useREMAINDERfor forwarded task args #69🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.