fix: register --force flag on agentCmd for cobra parsing#53
Conversation
Cobra was intercepting --force before the abort handler could read it, causing "unknown flag" errors. Register --force as a persistent flag on agentCmd so cobra recognizes it. Update abort handler to read via cmd.Flag() instead of custom hasFlag(). Add regression test ensuring --force works through cobra's flag API. Preserves friction telemetry: other unknown flags still trigger FailureUnknownFlag events for agent learning. Co-Authored-By: SageOx <ox@sageox.ai>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR refactors the agent session abort command to integrate Cobra's flag handling system. It introduces a hidden force flag on the ox agent command, changes the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixed
ox agent <id> session abort --forcefailing with "unknown flag" error. Cobra was intercepting the flag before the abort handler could read it via customhasFlag().Changes
--forceas a persistent flag onagentCmdso cobra recognizes itcmd.Flag()instead of customhasFlag()hasFlag()helperTestAbortForceViaCobraFlag) ensuring flag works through cobra's API in non-interactive modeFriction Telemetry
No impact — other unknown flags still trigger
FailureUnknownFlagfriction events for agent learning.Co-Authored-By: SageOx ox@sageox.ai
Summary by CodeRabbit
--forceflag to the agent session abort command, enabling non-interactive destructive operations without confirmation prompts.