From patchwork Fri May 1 10:59:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2246 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1777633263; bh=W3K5uaTai6boFmoI0hpi4Vqs86TYxZbl93WtbslcflY=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Nu4HU5IwLwayXfwXRv9nl920h64NsRD34fBx32VYEJLAS+eUsceRhKuKvi8lFkMmR 3rNGaAiWijX4d+PL5bmOyEwRdLxjb+f5exMHF6mG2mlLQI27rwenAmL524nv7i2nO3 GhFHwWk9/DwKd8XehBhUeqMewhWOvz3TIjYggyUI= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ADE9B6A840 for ; Fri, 1 May 2026 05:01:03 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id mVHNK2s33Mnv for ; Fri, 1 May 2026 05:01:03 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1777633262; bh=W3K5uaTai6boFmoI0hpi4Vqs86TYxZbl93WtbslcflY=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=FJ7pTPk69TOtP9+i5ZoElH/ig3fsfX7qc6suIJlZsB2LYUflCZlu0t3ernuMNa67t qIS1qHPhlQnqyKWYvGFwmQocw0BN56JAXO1zFJlAFf6rdpifFW50JHvp0tva2IKvME PTGQLaoFbatQ6Ye2s6ZtgMowpTGW124EJkuozIVM= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C75A76A841 for ; Fri, 1 May 2026 05:01:02 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1777633260; bh=StlHkPj5/3ZKYLgcCar8pWiHLFNJf9dpdd3UefDnP5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cc2CyHTUKOxZVQ6vUYAO4iqOeA+kyC2r7G+s2eNLDr2LdJm4QfxQWh7RW9tjuMGqo O1d0F/RNqbNQfovzWB+DNzZPLsNhynvxIGQf/wQ3C5DtrNT8bC9qvm66fw2vdp+Thq WEXnT43HqUJRlVxhsnSvVhYUVHZZvDXrFSxBB8ZQ= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DB40C6A833; Fri, 1 May 2026 05:01:00 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id at1zd5bu9bJl; Fri, 1 May 2026 05:01:00 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1777633260; bh=r7LJ+/XP1DEldt/QiSljJ3h7muJ5oVZrQFei9U3JSu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nZOf/lJrpAAA8O2NR6wRzp8fNCatp+cSr5IJZL4S/07ZeQhw8wekmkp31p/ox8AqW odKw6X40MLJ3wYpSgXJbrOPInWfjRwN8Jejj660/ltdlLTKD6k5fL5L8BrIzBRe5CZ oi0nDEE988Ls5459SBZKVhdQ9PU111+X3GtskAhE= Received: from u-boot.org (unknown [174.51.25.52]) by mail.u-boot.org (Postfix) with ESMTPSA id 5598A6A7AF; Fri, 1 May 2026 05:01:00 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 1 May 2026 04:59:55 -0600 Message-ID: <20260501110040.1874719-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260501110040.1874719-1-sjg@u-boot.org> References: <20260501110040.1874719-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 4SJX3CRJ5YKLA25P5UTV2BBOETP2MTLO X-Message-ID-Hash: 4SJX3CRJ5YKLA25P5UTV2BBOETP2MTLO X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/29] u_boot_pylib: Add a way to inspect agent output List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass When the Claude Agent SDK interrupts mid-run (e.g. due to a blocked tool or an internal limit), only the text blocks are printed and any surrounding message metadata is lost. This makes it hard to see why the interruption happened. Add an env-var hook: setting PATMAN_DEBUG_AGENT=1 dumps every message and block received from the SDK to stderr. This is verbose so it is off by default, but invaluable when diagnosing a stuck apply or review run. Signed-off-by: Simon Glass --- tools/u_boot_pylib/claude.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/u_boot_pylib/claude.py b/tools/u_boot_pylib/claude.py index 6ba980b6b2e..82fd29ea8d7 100644 --- a/tools/u_boot_pylib/claude.py +++ b/tools/u_boot_pylib/claude.py @@ -50,11 +50,19 @@ async def run_agent_collect(prompt, options): tuple: (success, conversation_log) where success is bool and conversation_log is the agent's output text """ + import os + debug = os.environ.get('PATMAN_DEBUG_AGENT') conversation_log = [] try: async for message in query(prompt=prompt, options=options): + if debug: + tout.error(f'AGENT MSG: {type(message).__name__}: ' + f'{message!r}') if hasattr(message, 'content'): for block in message.content: + if debug: + tout.error(f' BLOCK: {type(block).__name__}: ' + f'{block!r}') if hasattr(block, 'text'): print(block.text) conversation_log.append(block.text)