Skip to content

fix(cli): parse flags correctly when mixed with positional args#7

Closed
echobt wants to merge 1 commit intomasterfrom
fix/bounty-issue-1523
Closed

fix(cli): parse flags correctly when mixed with positional args#7
echobt wants to merge 1 commit intomasterfrom
fix/bounty-issue-1523

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Jan 26, 2026

Summary

The cortex run command was failing to correctly parse flags like --continue or --session when they appeared after the message argument. This was because the message argument was configured to capture all trailing variable arguments.

Changes

  • Removed #[arg(trailing_var_arg = true)] from the message field in RunCli struct.
  • Fixed an unrelated compilation error in cortex-engine/src/tasks/snapshot.rs (unused variable permissions).

Testing

  • Verified with cargo check -p cortex-cli and cargo check -p cortex-engine.
  • Ran existing tests (some unrelated failures in auth/unified_exec, but cli tests passed).

Related

Fixes PlatformNetwork/bounty-challenge#1523

    Fixes bounty issue #1523

    The 'message' argument was configured with trailing_var_arg=true, which caused all subsequent flags to be treated as part of the message string. This prevented valid flags like --continue or --session from working when specified after the message. By removing this attribute, flags are now correctly parsed regardless of their position relative to the message argument.

    Also fixed a compilation error in cortex-engine/src/tasks/snapshot.rs where 'permissions' variable was ignored in pattern match but used in conditional compilation block.
@echobt
Copy link
Contributor Author

echobt commented Jan 27, 2026

Closing as this feature has already been implemented in a batch commit (see commit history). The changes are merged into master.

@echobt echobt closed this Jan 27, 2026
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.

[BUG] cortex run Allows Conflicting Flags Without Error

2 participants