Skip to content

Conversation

@ibetitsmike
Copy link
Contributor

Summary

Adds a text-based fallback parser to workspace title generation so it succeeds even when models ignore the Output.object structured output instruction and return conversational prose instead of JSON.

Background

Some models (observed with claude-haiku-4-5-20251001) respond to the workspace identity generation prompt with conversational markdown like:

**name:** `testing`
**title:** `Improve test coverage`

instead of the expected JSON object. The AI SDK's Output.object parser throws NoObjectGeneratedError (with the raw text in .text), and the catch block previously only logged the error and moved to the next candidate — wasting valid data.

Implementation

  • In the catch block of generateWorkspaceIdentity, detect NoObjectGeneratedError and extract name/title from its .text property using extractIdentityFromText()
  • The new extractIdentityFromText() function tries multiple extraction strategies in order:
    1. Embedded JSON objects (both field orders)
    2. Markdown bold + backtick patterns (**name:** \value``)
    3. Quoted prose patterns (name: "value")
  • Extracted values are validated against the same constraints as the Zod schema (length, git-safe characters)
  • Added 12 unit tests covering all extraction patterns, edge cases, and the exact failing response from the bug report

Validation

  • 12/12 unit tests pass
  • make typecheck passes
  • make static-check passes (lint, format, docs links, shellcheck)

Generated with mux • Model: anthropic:claude-opus-4-6 • Thinking: high • Cost: $0.00

When Output.object fails to parse structured JSON (because some models
return conversational text instead), catch NoObjectGeneratedError and
attempt to extract name/title from the raw text using regex fallback.

This handles patterns like **name:** `testing` and embedded JSON
objects in prose, so title generation succeeds even with models that
ignore the structured output instruction.
@ibetitsmike ibetitsmike force-pushed the mike/fix-title-generation-fallback branch from af0ce7d to c0438fc Compare February 6, 2026 15:56
@ibetitsmike ibetitsmike merged commit 01d8935 into main Feb 7, 2026
23 checks passed
@ibetitsmike ibetitsmike deleted the mike/fix-title-generation-fallback branch February 7, 2026 14:50
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.

1 participant