All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: datshan@qq.com
Cc: thomas@monjalon.net, aconole@redhat.com, dev@dpdk.org
Subject: Re: [PATCH] devtools: support local opencode agent for patch review
Date: Sat, 4 Jul 2026 09:46:00 -0700	[thread overview]
Message-ID: <20260704094600.3dcf165b@phoenix.local> (raw)
In-Reply-To: <tencent_4A299B76E71AE508AF5D403AFDA4B248B708@qq.com>

On Fri,  3 Jul 2026 17:19:02 +0800
datshan@qq.com wrote:

> From: Chengwen Feng <fengchengwen@huawei.com>
> 
> 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 <fengchengwen@huawei.com>
> ---

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.

      reply	other threads:[~2026-07-04 16:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03  9:19 [PATCH] devtools: support local opencode agent for patch review datshan
2026-07-04 16:46 ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260704094600.3dcf165b@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=aconole@redhat.com \
    --cc=datshan@qq.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.