ContainerCodeExecutor drops output files that are hard links
维护者通常 4 天内回复
评估
调研方向
阅读 src/google/adk/code_executors/container_code_executor.py 中的 _extract_output_files,以及 tests/unittests/code_executors/test_container_code_executor.py 中模拟容器的模式。添加一个回归测试,用于构建包含硬链接的归档,然后运行该测试文件。当 CodeExecutionResult.output_files 包含两个链接名称且内容相同时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
ContainerCodeExecutor (input/output files added in effd641) returns only the first name when the executed code leaves two hard-linked names in the output directory, for example after os.link("a.csv", "b.csv") or cp -l. The second file is silently missing from CodeExecutionResult.output_files.
Docker's get_archive writes the second path to an inode it has already archived as a hard-link entry (type LNK, size 0), as Python's tarfile.add does. _extract_output_files keeps only entries where member.isfile() is true, and that is false for link entries.
src/google/adk/code_executors/container_code_executor.py, in _extract_output_files:
for member in tar.getmembers():
if member.isfile():
To Reproduce
The repro builds the archive from a real directory with tarfile, as Docker would return it, and feeds it to the executor through a mocked container, the same way tests/unittests/code_executors/test_container_code_executor.py does.
archive members: [('outputs', 'DIR'), ('outputs/a.csv', 'REG'), ('outputs/b.csv', 'LNK')]
output_files: ['a.csv'] # expected ['a.csv', 'b.csv']
Expected behavior
Both names are returned with the same content.
Suggested fix
if member.isfile() or member.islnk():
tar.extractfile() already resolves a hard-link member to its target's data inside the archive, so no other change is needed. Plus a regression test that builds the archive from a directory containing a hard link.
Question (separate, smaller)
CodeExecutorContext.add_input_files() only appends. If code adds data.csv in one turn and an updated data.csv in a later turn, every later execution fails with ValueError: Duplicate input file name: 'data.csv', and since the list lives in session state the session can't recover. The flow's own inline-file path avoids this by skipping known names. Should add_input_files replace an existing file with the same name, or is the error intended?
I can open a PR for the hard-link fix if that's welcome.
Desktop (please complete the following information):
- OS: macOS
- Python version: 3.12
- ADK version: main (8cd3b12, 2.13.0)
- 主要语言
- Python
- 星标
- 22.1k
- 派生
- 4.3k
- 平均合并
- 1 天 10 小时
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
google/adk-python 的其他 Issue
-
[LiteLLM] role='tool_responses' for Gemma 4 breaks tool calling on Vertex AI Model Garden MaaS (400 INVALID_ARGUMENT)可能已有人在做 @surajksharma07 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
google/adk-python#7977 · 1 条评论 · 已指派 1 人 ·
维护者通常 4 天内回复
-
FileArtifactService changes CRLF and CR line endings in text artifacts可能已有人在做 @sanketpatil06 于 3 天前认领。 未关闭request clarification services
难度 2/5 1-3 小时 新手友好度 85/100
google/adk-python#7914 · 1 条评论 · 已指派 1 人 ·
维护者通常 4 天内回复
-
GCS skill loaders ignore a skill.md manifest that the local and zip loaders accept可能已有人在做 @surajksharma07 于 6 天前认领。 未关闭tools
难度 2/5 1-3 小时 新手友好度 84/100
google/adk-python#7842 · 2 条评论 · 已指派 1 人 ·
维护者通常 4 天内回复
-
RestApiTool crashes on a request body media type that has no schema可能已有人在做 @llalitkumarrr 于 6 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
google/adk-python#7838 · 1 条评论 · 已指派 1 人 ·
维护者通常 4 天内回复
-
LiteLlm with SSE streaming records the answer twice in gen_ai.output.messages可能已有人在做 @surajksharma07 于 13 天前认领。 未关闭models
难度 2/5 1-3 小时 新手友好度 78/100
google/adk-python#7630 · 11 条评论 · 已指派 1 人 ·
维护者通常 4 天内回复
查看 google/adk-python 的全部 Issue
相似的 Issue
-
area:docs documentation effort:M ready-for-agent
难度 2/5 1-3 小时 新手友好度 76/100
mczielinski/ob-analytics#423 ·
维护者通常 1 天内回复
-
needs-triage
难度 2/5 1-3 小时 新手友好度 68/100
gke-labs/kube-agents#4838 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
danyuchn/asd-ste100-skill#60 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 64/100
Gathin23/cleanyourtv#3299 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
autowarefoundation/autoware_carla_scenario#1485 ·
维护者通常 1 天内回复