Skip to content

Transcript cleanup fails with invalid structured output when the cleanup model does not enforce the schema #32049

Open

Description

@vibhor1102

What happened

Transcript cleanup never succeeds when the cleanup model is an OpenCode (or Antigravity) model. Each dictation ended with the "Transcript cleanup failed" toast and the raw transcript was inserted. In one session four attempts failed and none succeeded; durations were 90.5s, 3.8s, 7.2s and 6.1s.

Diagnosis

The cleanup prompt and the operation's output contract disagree.

  • apps/server/src/textGeneration/TranscriptionPostProcessing.ts:32 ends the prompt with "Return only the cleaned transcript" (plain text).
  • packages/provider-core/src/server/textGenerationOperations.ts:22 declares TranscriptionPostProcessingOutput = Schema.Struct({ transcription: Schema.String }), and decodeJsonReply (line 56) parses the reply as JSON.

Codex (--output-schema) and Claude (structured output) enforce the schema natively, so the mismatch never shows there. OpenCode2 and Antigravity only prepend "Return only the requested JSON object" to the prompt, so the model answers with plain text and decoding fails with SchemaError: Expected a valid JSON string / "invalid structured output".

The schema and operation were added in #30625 (commit b8dce83) without updating the prompt. The bug is still on main.

Steps to reproduce

  1. Set the transcript cleanup model (Settings -> Voice -> Cleanup) to an OpenCode or Antigravity model.
  2. Turn on "Clean up transcripts with a provider".
  3. Dictate one sentence and stop.
  4. Cleanup fails after 4-90s; server.trace.ndjson records SpeechPostProcessing.process as Failure with "invalid structured output".

Version

0.1.8-nightly.20261106.4262 (server commit c55db3e); still present on main as of 2026-11-06

Environment

Fedora Linux 44 (KDE Plasma), T3 Code desktop app with a local server, Intel i5-8350U, Intel UHD Graphics 620 (Vulkan), 15 GB RAM, parakeet-unified-en-0.6b-Q8_0

Evidence

SpeechPostProcessing.process spans, all four failed:
19:20:45  90545 ms  Failure
19:22:37   3808 ms  Failure
19:23:15   7230 ms  Failure
19:25:28   6123 ms  Failure

Cause: TextGenerationError: Text generation failed in generateTranscriptionPostProcessing: invalid structured output
SchemaError: Expected a valid JSON string

Related issues

#30625 added the JSON output schema and the operation. No existing issue reports this failure.

Fix applied or workaround

Disable transcript cleanup, or set the cleanup model to Codex/Claude, which enforce the schema natively.

Filed by

opencode/deepseek-v4.1-flash-free via the OpenCode harness (T3 Code triage)

Activity

  1. MayankXDev13 commented on Nov 21, 2026

    @MayankXDev13

    Confirming this still reproduces on 0.1.12-nightly.20261121.5038 (Linux x64 desktop app with local server; triage CLI 0.1.11), failing 100% of the time with both OpenCode (google-vertex/openai/gpt-oss-120b-maas) and Antigravity models configured as the transcript cleanup model.

    Evidence (server.trace.ndjson)

    6 consecutive SpeechPostProcessing.process attempts (4 OpenCode, 2 Antigravity) all failed with SchemaError: Expected a valid JSON string:

    # OpenCode (OpenCode2TextGeneration.generateTranscriptionPostProcessing)
    2026-11-21T14:15:29Z  16022.6ms  Failure  TextGenerationError: OpenCode returned invalid structured output. [cause]: SchemaError: Expected a valid JSON string
    2026-11-21T14:22:47Z  19182.3ms  Failure  TextGenerationError: OpenCode returned invalid structured output. [cause]: SchemaError: Expected a valid JSON string
    2026-11-21T15:33:48Z  12751.0ms  Failure  TextGenerationError: OpenCode returned invalid structured output. [cause]: SchemaError: Expected a valid JSON string
    2026-11-21T15:39:34Z  15072.1ms  Failure  TextGenerationError: OpenCode returned invalid structured output. [cause]: SchemaError: Expected a valid JSON string
    
    # Antigravity (AntigravityTextGeneration.runJson -> generateTranscriptionPostProcessing)
    2026-11-21T15:53:58Z  59604.2ms  Failure  TextGenerationError: Antigravity returned invalid structured output. [cause]: SchemaError: Expected a valid JSON string
    2026-11-21T15:58:12Z  39227.9ms  Failure  TextGenerationError: Antigravity returned invalid structured output. [cause]: SchemaError: Expected a valid JSON string

    On the user side, each failure only surfaced the generic "Transcript cleanup failed / The original transcript was added." toast with no reason shown (filing a separate issue for that error-surfacing gap).

    Submitted via t3 triage using Gemini 4 Neon (High) in Antigravity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions