fix(cli): generic watch-path error message and sys.argv sync for programmatic main()#25
Conversation
…ys.argv for programmatic main(argv=...) Co-authored-by: mahimairaja <81288263+mahimairaja@users.noreply.github.com> Agent-Logs-Url: https://github.com/mahimairaja/openrtc-python/sessions/8c419ba3-63a6-4ee9-9afc-eed8d22cd894
a25b493
into
cursor/tui-watch-path-handling-3694
|
|
There was a problem hiding this comment.
Pull request overview
This PR improves OpenRTC CLI/TUI ergonomics by clarifying metrics watch-path validation and ensuring programmatic CLI invocations correctly mirror sys.argv for the LiveKit handoff logic.
Changes:
- Update
validate_metrics_watch_path()error text to avoid implying the path must come specifically from--watch(since it may be positional). - When calling
cli_app.main(argv=...)programmatically, setsys.argvto the injected/re-written args so LiveKit handoff logic sees the correct tokens (e.g.--reload).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/openrtc/tui_app.py |
Makes the directory-path validation error message more accurate and less flag-specific. |
src/openrtc/cli_app.py |
Ensures programmatic main(argv=...) updates sys.argv with injected args so LiveKit handoff logic observes the same argv as a real CLI invocation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## cursor/tui-watch-path-handling-3694 #25 +/- ##
=======================================================================
+ Coverage 90.14% 90.15% +0.01%
=======================================================================
Files 13 13
Lines 1420 1422 +2
=======================================================================
+ Hits 1280 1282 +2
Misses 140 140
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Two follow-up fixes from code review on the TUI defaults / positional-paths PR.
validate_metrics_watch_patherror message was--watch-specificThe error said
'--watch' must be a JSONL file path…but the watch path can also be supplied positionally (openrtc tui ./file.jsonl). Reworded toThe metrics watch path must be a JSONL file path….main(argv=...)didn't updatesys.argvWhen called programmatically, the
argv is not Nonebranch passed injected args tocli.main(args=…)but leftsys.argvunchanged. The LiveKit handoff (_livekit_sys_argv) inspectssys.argvto detect the subcommand and forward flags like--reload, so programmatic calls likemain(["dev", "./agents", "--reload"])would silently drop those flags. Now setssys.argv = [previous_argv[0], *injected_args]beforecli.main, matching the existingsys.argv-rewrite path for the no-argvbranch. Restored infinallyas before.📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.