Pass the call_id to ApplyPatchTool's editor
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 70/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
Start with ApplyPatchOperation in src/agents/editor.py and follow ApplyPatchAction.execute in src/agents/run_internal/tool_actions.py, including its approval and resume path. Pass the call ID through to every operation created for that tool call, preserving the existing default for editors that do not provide one. Done when an editor can read the same call ID for each operation, including after approval and resume.
索引モデルが issue の本文から書いたものです。
説明
Please read this first
- Have you read the docs? Yes.
- Have you searched for related issues? Yes. #1849 added
tool_call_idto function tool hooks and left built-in
tools for later, asking for a minimal reproduction for a specific built-in local tool with a practical consequence.
This is one forApplyPatchTool, and the change it needs doesn't touch the hook context.
Describe the feature
An ApplyPatchEditor can't tell which apply_patch call it is applying. Its methods get an ApplyPatchOperation
with type, path, diff, ctx_wrapper and move_to (src/agents/editor.py:15-23). ApplyPatchAction.execute
has the id (call_id = extract_apply_patch_call_id(...), src/agents/run_internal/tool_actions.py:928) and calls the
editor without it (:1017-1023).
needs_approval gets (ctx, operation, call_id), so today an editor that needs the id has to remember the
operation object in needs_approval and look it up by identity in the editor. That fails on the approval path. After
RunState.approve() and a resumed run, needs_approval isn't called again (:948-962), so the editor gets an
operation it has never seen and can't learn which approved call it belongs to:
from agents import Agent, ApplyPatchTool, Runner
from agents.editor import ApplyPatchOperation
class AuditEditor:
def update_file(self, op: ApplyPatchOperation):
print(getattr(op, "call_id", None)) # None: the operation doesn't say which call it is
return "done"
create_file = delete_file = update_file
agent = Agent(name="a", tools=[ApplyPatchTool(editor=AuditEditor(), needs_approval=True)])
result = Runner.run_sync(agent, "Fix the typo in README.md") # with a model that calls apply_patch
state = result.to_state()
for item in result.interruptions:
state.approve(item)
Runner.run_sync(agent, state) # the editor runs; nothing tells it which approved call_id this write is
So an editor can't write an audit record per call, check that the write it is about to make is the one a person
approved, or report progress per call in a UI.
Proposed shape: a call_id: str | None = None field, last in ApplyPatchOperation, set in
ApplyPatchAction.execute (or in coerce_apply_patch_operations, which receives the tool call). A call with several
operations gives each the same call_id. It's additive: existing editors ignore it, and positional construction
doesn't change.
Context: I maintain Tracekit (https://github.com/Cygnux-Labs/Tracekit), which records and gates agent tool calls; this would let it hold apply_patch calls for a person's approval (today it has to refuse an ask for them) and record each write under the call the model made.
- 主要言語
- Python
- スター
- 30.4k
- フォーク
- 4.9k
- 平均マージ
- 12時間 50分
- マージ済み PR(30日)
- 162
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openai/openai-agents-python のほかの issue
-
fix(typing): explicitly specialize ToolContext[Any] in ToolFunctionWithToolContext再び着手できるかも @AbarnaaSree が 10 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
openai/openai-agents-python#5387 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
function_tool on a callable object uses an inherited or generated class docstring as the tool description対応中かも @Narendra02053 が 1 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
openai/openai-agents-python#5443 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 44/100
openai/openai-agents-python#5416 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 53/100
openai/openai-agents-python#5413 · コメント 6 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
openai/openai-agents-python#5412 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
openai/openai-agents-python の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
521xueweihan/HelloGitHub#4150 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
aws-samples/sample-per-model-bedrock#595 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
bug connectors
難易度 1/5 1時間未満 初心者へのやさしさ 67/100
pyinfra-dev/pyinfra#2036 ·
メンテナーはふだん 9 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信