fix: multi-protocol visual/websearch orchestration, tool_result role, and stability fixes#82
Merged
Conversation
- 默认关闭 codex_tool_proxy 扩展(DefaultEnabled: true → false) - README.md:移除不存在的 /health 端点 - docs/architecture.md:修正 ClientAdapter 接口签名([]byte → any),移除 /health 和 bridge 目录 - docs/api.md:管理 API 端点表与实际代码同步(router.go 26 个端点) - docs/extensions-overview.md:新增 codex_tool_proxy 扩展文档 - docs/development-conventions.md:补充 codex_tool_proxy/codextool 目录 - config.example.yml:添加 codex_tool_proxy 注释说明
- docs/architecture.md: 四层架构图 → flowchart TB + 4 个子图 - docs/architecture.md: 请求生命周期数据流 → flowchart TD - docs/development-conventions.md: 目录树 → flowchart TD + 嵌套子图
…arding, goroutine leak, ctx cancellation, HTTP client config
… Gemini ToolUseID matching, toolUseIDMap race, empty content filtering
…ategies Adds three core components for flexible namespace tool handling: - NamespaceSchemaBuilder (namespace_schema.go): BuildNamespaceTools converts namespace tools via NestedOneOf (oneOf Schema with action as single-value enum), NestedAnyOf (action enum + anyOf params), or Flat (current behavior). - NestedCallDecoder: DecodeNestedCall extracts action and params from both oneOf and anyOf response formats. TryExtractAction provides lightweight partial-JSON scanning for streaming extraction. - StreamBufferStrategy: two-level streaming buffer for nested tool calls — defers output_item.added until action is extracted from JSON stream, then replays buffered params deltas. Configuration via OpenAIAdapter.nsStrategy field (variadic constructor). Deduplication in flattenToolsWithNamespace prefers codex_namespace- annotated tools over flat functions with same name.
…dening, Tavily/Firecrawl retry, formatting dedup, Google multi-candidate, Message.Role defcheck
…system prompt, style dedup, clone isolation, assistant message selection, string Content handling
…e paths Chat streaming: inject visCoreProvider before StreamChat. When visual is enabled, calls CoreOrchestrator.CreateCore non-streaming, then produces synthetic SSE events via coreResponseToCoreStream. Google non-streaming: inject wrapWithVisual with googleProviderClient adapter (wraps *google.Client into provider.ProviderClient). Visual orchestrator runs before wsInjected/googleClient.GenerateContent. Google streaming: inject visCoreProvider with googleProviderClient, same synthetic-stream pattern as Chat streaming. wrapWithVisual extended with case ProtocolGoogleGenAI for visual provider side (uses activeGoogleClient + FirstUpstreamModelForKey). googleProviderClient adapts *google.Client to provider.ProviderClient by capturing model name at construction time.
Core format tool_result messages must use role tool — Anthropic adapter maps tool→user, Chat adapter relies on role tool to emit ToolCallID.
vfyjxf
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
修复 Visual 和 WebSearch 插件在多协议(Chat / Google GenAI)路径下的若干编排缺陷,包括跨协议 tool_result role 错误、mixed tool 泄露、streaming 路径阻断等。同时修复 ProviderManager、Anthropic adapter 和 stream 层的一组稳定性问题。
Key changes
Visual plugin
"user"修正为"tool"— Core 格式的 tool_result 消息必须用"tool"role。"user"导致 Chat adapter 无法生成ToolCallID,DeepSeek Chat API 拒绝请求(insufficient tool messages following tool_calls message)。Anthropic adapter 的mapRole已做"tool"→"user"转换,不受影响。(core_orchestrator.go)handleAdapterStream未走 Visual 包装,Chat 协议模型无法触发 visual_brief/visual_qa。(adapter_dispatch.go)googleProviderClient适配。(adapter_dispatch.go)orchestrator.go,core_orchestrator.go)WebSearch plugin
orchestrator.go)ProviderManager & Adapter fixes
manager.go,adapter_dispatch.go)anthropic/adapter.go)chat/adapter.go)Misc
NestedOneOf/NestedAnyOf/Flat策略支持。(codextool/namespace_schema.go)Verification
internal/extension/*全包测试通过(12 包)internal/protocol/{chat,anthropic,google}adapter 测试通过Files changed
81 files, +2258 −801