Skip to content

sidecall: fall back to omp for Pi side calls and drop unknown flags - #325

Open
Emre Sırmalı (lynicis) wants to merge 2 commits into
microsoft:mainfrom
lynicis:feat/pi-sidecall-omp
Open

Emre Sırmalı (lynicis) wants to merge 2 commits into
microsoft:mainfrom
lynicis:feat/pi-sidecall-omp

Conversation

@lynicis

Copy link
Copy Markdown

Problem

  1. When pi_cli is unset, _host_call("pi", ...) defaulted to "pi", so side calls (the micro-skills proposer and the loop guard's judge/redirect writer) failed in oh-my-pi (omp) environments where pi is not on PATH.
  2. pi_call() only retried when stderr contained Unknown option: --no-mcp. oh-my-pi rejects unsupported Pi flags together on one line (Error: unknown flags: --no-prompt-templates, --no-mcp), causing side calls on omp to fail rather than dropping unknown flags and retrying.

Fix

  • Add sidecall.pi_cli() in tokeneconomizer/plugin/sidecall.py: prefer pi on PATH, fall back to omp on PATH (or bare "omp" when OMPCODE is set), and otherwise return "pi" so missing-CLI errors stay unchanged.
  • Generalize pi_call() flag stripping via _unknown_flags(stderr): extract all --flag names reported on an unknown option(s) / unknown flag(s) line in stderr, omit them from the flag list, and retry without a separate --help subprocess probe.
  • Document experimental oh-my-pi (omp 19.1.1) support in README.md and pi_cli fallback / unknown-flag handling in plugin/README.md.

Verification

  • Added unit tests in tests/test_live_core.py:
    • test_a_pi_side_call_drops_every_flag_the_cli_reports_unknown
    • test_a_pi_side_call_prefers_pi_and_falls_back_to_oh_my_pi_s_omp
  • pytest tests/test_live_core.py: 318 passed.
  • Full test suite (tests and experiments/tests): 1,792 passed, 46 skipped (only the 3 pre-existing local marketplace install-copy failures in tests/test_plugin_package.py, unchanged from main).
  • python scripts/dead_code.py --json (no new findings) and git diff --check (clean).

When pi_cli is unset, resolve the Pi executable via pi on PATH first, then oh-my-pi's omp on PATH (or bare omp when OMPCODE is set), falling back to pi so missing-CLI errors stay unchanged.

Generalize pi_call's flag retry from --no-mcp alone to all --flags named as unknown options/flags in stderr, so oh-my-pi's multi-flag error (--no-prompt-templates, --no-mcp) strips both and succeeds in one retry.

Document oh-my-pi (omp 19.1.1, experimental) and pi_cli fallback behavior, and cover both behaviors in tests/test_live_core.py.
@lynicis

Copy link
Copy Markdown
Author

Emre Sırmalı (@lynicis) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

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.

1 participant