Files
pipelines/docs/native-structured-output.md

2.9 KiB

Native structured-output regression (2026-10-09)

The supplied ~/findings.md describes Math Demo run #12 on another computer, using OpenCode 1.18.35 and opencode-go/deepseek-v4.1-flash. Its recorded response contains StructuredOutputError and DSML as text, with flattened output fields. The supplied evidence does not identify the component responsible for converting that provider tool call into text. That upstream cause remains unconfirmed.

Confirmed independently

On a fresh ghcr.io/anomalyco/opencode:1.18.35 container, without credentials or inference:

  • POST /session/ID/message with noReply:true and an explicit JSON-schema format succeeds, but subsequent HTTP message readback fails with HTTP 400.
  • Omitting retryCount does not fix it. Explicit format:{type:"text"} also fails.
  • Omitting format makes both POST and message readback succeed.
  • opencode export ID recovers the original format-bearing messages which the HTTP readback cannot encode. No stored message needs to be modified.

The adapter now probes this contract without inference. Affected native backends omit the incompatible field and enforce the outcome/output envelope locally. Compatible native schema mode is retained and covered by the mock HTTP contract tests; a real schema-tool invocation on a compatible native release is not tested. No automatic stage/tool replay or DSML-to-result interpretation was added.

Real provider regression

The opt-in server test uses an equivalent math graph, not a copy of the remote immutable definition (its complete source was not supplied). It deliberately uses small-map output-contract prose to exercise the envelope clarification. Using the existing local native OpenCode 1.18.35/OpenCode Go credentials, it passed:

  • 7 + 2: sum → multiply → parity → add_one → report; result 28; 7 + 2 = 9; 9 * 3 = 27; 27 + 1 = 28 (odd branch).
  • 7 + 3: sum → multiply → parity → halve → report; result 15; 7 + 3 = 10; 10 * 3 = 30; 30 / 2 = 15 (even branch).
  • Native retained-session readback through server evidence retrieval passed.

The first inference check reached result 28 but caught an ambiguous test prompt that yielded the literal word previous in an equation. The fixture now explicitly specifies numeric substitutions; the full odd/even check then passed. Published pipeline definitions were not rewritten.

Commands (supply a native CLI path on your computer):

PIPELINES_TEST_OPENCODE_V1=/path/to/opencode-1.18.35 \
  go test -count=1 -run TestStableNativeSessionContractLive -v ./internal/opencode

# Explicit opt-in: existing credentials, ten small paid-provider calls,
# retained stage/probe sessions, and no project tools.
PIPELINES_TEST_OPENCODE_V1=/path/to/opencode-1.18.35 \
PIPELINES_TEST_NATIVE_INFERENCE=1 \
  go test -count=1 -run TestNativeMathDemoLive -v ./internal/server

The other computer's original run/session was not accessed or modified here.