Skip to content

provider: preserve model discovery and harness protocol semantics - #4

Closed
samaluk wants to merge 7 commits into
massiveits:mainfrom
samaluk:review/harness-compatibility
Closed

samaluk wants to merge 7 commits into
massiveits:mainfrom
samaluk:review/harness-compatibility

Conversation

@samaluk

@samaluk samaluk commented Sep 13, 2026 •

Copy link
Copy Markdown

A single OpenCode Go connection should work across harnesses, but DeepSeek tool continuations fail when required reasoning data is dropped, and other valid requests lose meaning when translated: easy Responses messages are rejected, explicit Claude effort can be lost, and function-tool namespaces cannot round-trip through flat tool APIs. Synthesized Responses streams can omit completed output items, and operators with verified local model definitions cannot use them for discovery.

Normalize supported message forms, preserve explicit effort and tool identity across translation, and emit output-item completion before response completion. Add a file catalog using the existing parser, size limit and stale-data policy. Historical tool calls remain replayable when their definitions are removed; forced choices still require a current definition. Explicit auto/none efforts follow the existing Responses wire policy. Unsupported tool forms and ambiguous mappings still fail explicitly.

Preserve Chat Completions reasoning through streamed and non-streamed Responses turns, associating it with the assistant message and tool calls when replayed. Use an empty compatibility field for older DeepSeek assistant turns whose reasoning is unavailable; foreign summaries and encrypted reasoning are not treated as full upstream reasoning.

Validation: Go tests, review regressions for effort normalization and historical tool replay, vet and native shared-library build; synthetic protocol and tool round-trip tests with Claude Code, OpenCode and Pi; a live Responses reply. Upstream v0.1.7’s quota-usage endpoint fix is retained.

The DeepSeek regression was verified with a live reasoning/tool/result round-trip and an isolated Codex process executing a harmless command and finishing successfully. The new unit tests cover stream/non-stream parity, replay, old histories and reasoning boundaries between turns.

@massiveits

Copy link
Copy Markdown
Owner

Thanks for the contribution, @samaluk.

We are closing this PR because it bundles multiple unrelated features, architectural changes, and bug fixes into a single large diff. We prefer smaller, focused PRs so each change can be reviewed and tested on its own.

Here is a breakdown of what is acceptable versus what is not:

Acceptable (We welcome a targeted PR for these)

  • DeepSeek reasoning continuation: Preserving reasoning_content across tool turns and providing the empty-string fallback for assistant turns.
  • Streaming event ordering: Emitting response.output_item.done before response.completed for Responses streaming.
  • Input normalization: Handling missing type: "message" when role is present (e.g. Pi format), and preserving output_config.effort.

Not Acceptable

  • catalog-file: This plugin is focused strictly on OpenCode Go, which already serves model discovery dynamically via its /models endpoint. We do not want to add offline file-based catalog discovery.
  • Tool namespace rewriting (tool_namespaces.go): Parsing and mutating JSON payloads on the fly inside the active SSE streaming loop introduces unnecessary complexity and overhead.

If you would like to open a separate, clean PR containing just the protocol and streaming fixes listed above, we will be happy to review and merge it.

@massiveits massiveits closed this Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants