[Concept,16/29] patman: Let the apply agent edit files for manual fixups

Message ID 20260501110040.1874719-17-sjg@u-boot.org
State New
Headers
Series patman: Review-flow improvements and shared helpers |

Commit Message

Simon Glass May 1, 2026, 11 a.m. UTC
  From: Simon Glass <sjg@chromium.org>

The apply prompt tells the agent to fall back to editing the target
source file manually when 'git am' and 'patch --fuzz' both fail, but
the agent only has Bash, Read and Grep in its allowed-tools list.
Without Edit and Write it cannot make the manual adjustments and
reports back that it is waiting for file permission.

Add Edit and Write to the allowed tools so the apply-and-fix-up loop
described in the prompt can complete.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/patman/review.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/tools/patman/review.py b/tools/patman/review.py
index 92fbcfa8a2d..66580e48ee6 100644
--- a/tools/patman/review.py
+++ b/tools/patman/review.py
@@ -228,8 +228,8 @@  async def apply_series(pwork, link, branch_name, upstream_branch,
     # Build the prompt and run the agent
     prompt = _build_apply_prompt(mbox_path, branch_name, upstream_branch)
     options = ClaudeAgentOptions(
-        allowed_tools=['Bash', 'Read', 'Grep'], cwd=repo_path,
-        max_buffer_size=claude_mod.MAX_BUFFER_SIZE)
+        allowed_tools=['Bash', 'Read', 'Grep', 'Edit', 'Write'],
+        cwd=repo_path, max_buffer_size=claude_mod.MAX_BUFFER_SIZE)
 
     tout.notice(f'Applying series to branch {branch_name}...')
     success, _ = await claude_mod.run_agent_collect(prompt, options)