[llm] Gemini 3 tool loop fails with 400: thought signature is not sent back
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- ai-infra-agents, backend-api-design
Hướng nghiên cứu
Start with the stream and non-stream parsers in ms_agent/llm/transport/openai_compat.py, then trace _merge_stream_message and Message.to_dict_clean. Keep extra_content through parsing, merging, and serialization; done means the thought signature survives the tool-call round trip. Run the relevant tests in tests/llm and tests/agent.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Found while testing LLM provider integrations in agent frameworks: an automated tool flags candidates and each one is reproduced before it is reported. Reproduced on 6d90d84 with a local stub that applies Google's documented rule, so the 400 below is mimicked, not from a live call.
Initial Checks
- I have searched related issues and docs but cannot get the expected help.
- The bug has not been fixed in the latest version.
A clear and concise description of what the bug is.
An agent on the built-in google provider with a Gemini 3 model (gemini-3.5-flash here) stops at its first tool result. On Gemini's OpenAI-compatible endpoint the signature comes on the tool call as extra_content.google.thought_signature. ms-agent does not keep that field, so the next request replays the call without it. Google's thought signatures page says: "If a required thought signature is not returned when using Gemini 3 models, the model will return a 400 error." The same message was reported from the real API on another project in shy3130/tick-stock-panel#452.
Repro against a local stub of that endpoint. Its first reply is a read_file call with a signature, and it answers 400 when the signature does not come back:
agent = LLMAgent(config=OmegaConf.create({
'llm': {'service': 'google', 'model': 'gemini-3.5-flash',
'google_api_key': 'test', 'google_base_url': STUB_URL},
'generation_config': {'stream': True},
'tools': {'file_system': {'mcp': False, 'include': ['read_file']}},
'output_dir': work_dir,
}))
asyncio.run(agent.run('read a.txt'))
openai.BadRequestError: Error code: 400 - Function call is missing a thought_signature in functionCall parts.
turn 1 reply signature: CsUBAY89a1_fake_signature_from_turn_1==
turn 2 request tool call: {"id": "call_1", "type": "function", "function": {"name": "file_system---read_file", "arguments": "{\"paths\": [\"a.txt\"]}"}}
Same result without streaming, and on the legacy OpenAI client with service: openai and a Gemini base URL. Expected: the tool call in the second request keeps its extra_content.
The parsers build ToolCall from id, index, type and function only (stream parser, and the non-stream one next to it), and Message.to_dict_clean rebuilds the wire tool call from those same keys. Thinking cannot be switched off on these models, so reasoning_effort: off does not avoid it.
Fix idea: keep extra_content on ToolCall in both parsers and in _merge_stream_message, and put it back in to_dict_clean. With that in the router transport and the legacy client the stub run finishes, the field survives the session log round trip, and the tests in tests/llm and tests/agent that I ran still pass.
Versions / Dependencies
ms-agent 1.6.0 at 6d90d84 (main), Python 3.12.4, openai 3.41.0, Linux.
- Ngôn ngữ chính
- Python
- Star
- 4.4k
- Fork
- 544
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelscope/ms-agent
-
Skill search returns stale results after all skills are disabled or removedCó thể đã có người làm @AWUQAQ đã nhận 63 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
modelscope/ms-agent#974 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
modelscope/ms-agent#1047 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fetch_page web tool performs unrestricted server-side HTTP fetch of agent-supplied URLs (SSRF)Có thể đã có người làm @SiyuanChenToDo đã nhận 27 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
modelscope/ms-agent#1018 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
modelscope/ms-agent#1011 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[tool] Document authenticated Streamable HTTP MCP setupCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
modelscope/ms-agent#1003 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của modelscope/ms-agent
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Sienna-Platform/SiennaSchemas#130 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
firedrakeproject/Irksome#293 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ida-arbeitszeit/workers-control#1578 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
aws-samples/sample-per-model-bedrock#898 ·
Maintainer thường phản hồi trong vòng 1 ngày