On Fri, 3 Jul 2026 17:19:02 +0800 [email protected] wrote: > From: Chengwen Feng <[email protected]> > > Currently review-patch.py only supports cloud AI providers > (Anthropic, OpenAI, xAI, Google) via REST API, requiring API keys. > > Add a --via option that invokes the locally installed opencode CLI as > the review runner instead of making HTTP calls. opencode reads > AGENTS.md from the DPDK project directory automatically, needing no > configuration beyond opencode on PATH. > > The --via and -p/--provider options are independent -- via routes to > the local agent mode while -p continues to use the cloud API path. > > Signed-off-by: Chengwen Feng <[email protected]> > ---
So most of this script was AI generated, turned back to AI to look at this change... Thanks for the patch - the opencode integration looks sound. The --format json parsing matches what the CLI actually emits, and the _run_review refactor is a clean way to share the dispatch. A few items: Bug: - subprocess.run() can raise TimeoutExpired, but only FileNotFoundError is caught, so a timeout gives a raw traceback. Catch subprocess.TimeoutExpired and route it through error() like the cloud path does. Please clarify / fix: - -a/--agents is silently ignored in --via mode; opencode auto-loads AGENTS.md from --dir, which you set to the repo root while AGENTS.md lives under devtools/ai/. Does opencode actually find the guidelines? If not the review runs without them. - JSON metadata still reports "provider": args.provider (stays "anthropic" under --via); use (args.via or args.provider) as you already did for the token summary. - --large-file modes are silently skipped in via mode - intended? A warning would help. Nits: non-ASCII em-dash in a prompt string (use --); the trailing "--" before the message is unnecessary and may drop the prompt; redundant import tempfile; unused max_tokens param; f-string with no placeholder; run black on the full_message assignment.

