Skip to content

Thread title generation accepts placeholder "title" and branch rename fails silently when the text model returns bad JSON #23726

Closed

Description

@TheAsda

What happened

A new worktree thread started with the message $implement Issue #140 ended up with the title title, and its branch stayed the temporary t3/<hash> placeholder (t3/ae699bd5) instead of being renamed. Nothing in the UI said anything had gone wrong. The user has seen the hash-named branch once before.

Diagnosis

The text generation model is Pi with zai/glm-5.3-flash (thinking low), set in textGenerationModelSelection. For this thread it gave bad structured output twice, and T3 Code handled the two cases differently:

  1. Title: placeholder accepted as success. PiTextGeneration.generateThreadTitle exited with Success, and the thread-title.generate outbox effect is succeeded. Yet the thread.metadata-updated event at 08:18:24Z changed the title from $implement Issue #140 to title. The model evidently replied with a JSON object whose title value was literally title, probably echoing the Return JSON with keys title and needsRefinement instruction. decodeJsonReply (packages/provider-core/src/server/textGenerationOperations.ts) takes the first {...} that extractJsonObject finds. It only checks that title is a string. sanitizeThreadTitle (textGenerationUtils.ts) only trims, strips quotes and truncates. So a title equal to the schema key, or another obvious placeholder, gets written over the user's seed title.

  2. Branch: failure only logged. PiTextGeneration.generateBranchName failed with Pi returned invalid structured output / SchemaError: Expected a valid JSON string. ThreadLaunchService.prepareInBackground (apps/server/src/orchestration-v2/ThreadLaunchService.ts) then keeps the temporary t3/<hash> branch, logs a warning, and shows nothing in the UI.

In both cases, T3 Code never logs or traces the model's raw reply, so the bad output can't be inspected afterwards.

The same model failed the same way earlier that day: a generateThreadTitle call at 07:37:12Z failed with the same SchemaError, and a retry 8s later worked. Of 11 title and branch generations by this model in the trace window, 2 failed to parse and 1 returned the placeholder title.

Possible improvements:

Steps to reproduce

Not deterministic, because it depends on the model's output. The steps that hit it:

  1. Enable the Pi provider and set Settings → Text generation model to Pi / zai/glm-5.3-flash with thinking low.
  2. Start a new thread in worktree mode with a short first message, e.g. $implement Issue #140.
  3. Sometimes the title becomes title, and/or the branch stays t3/<hash>.

A deterministic way to see the title half: make a text-generation runner return {"title":"title","needsRefinement":false}, and generateThreadTitle returns title as a successful result.

Version

0.1.2-nightly.20261022.3512 (desktop app with the local server on the same machine; tag v0.1.2-nightly.20261022.3512). The triage CLI was 0.1.1-nightly.20261019.3373.

Environment

Linux x64 on WSL2 (kernel 6.18.54.1-microsoft-standard-WSL2), Node v26.8.2, pi 1.4.0, text generation model pi / zai/glm-5.3-flash (thinking low)

Evidence

# server.trace.ndjson: thread c2705bc8-0741-45c2-98e0-43574a6df378
2026-10-22T08:18:13.384Z PiTextGeneration.generateThreadTitle  exit=Success   (10976ms)
2026-10-22T08:18:14.358Z PiTextGeneration.generateBranchName   exit=Failure   (8071ms)
  TextGenerationError: Text generation failed in generateBranchName: Pi returned invalid structured output.
    at PiTextGeneration.runPiJson
    at PiTextGeneration.generateBranchName
    at ThreadLaunchService.generateBranchNameFor
    at ThreadLaunchService.prepareInBackground
    at ThreadLaunchService.schedulePreparation
    [cause]: SchemaError: Expected a valid JSON string

# orchestration_events for the thread
08:18:13.337Z thread.created           title="$implement Issue #140" branch=null
08:18:14.351Z thread.metadata-updated  branch="t3/ae699bd5"   (temporary worktree branch, never renamed)
08:18:24.361Z thread.metadata-updated  title="title"          (from generateThreadTitle, reported as success)

# orchestration_v2_effect_outbox
thread-title.generate  status=succeeded  attempt_count=1  last_error=null

# earlier the same day, same model
2026-10-22T07:37:12.037Z PiTextGeneration.generateThreadTitle Failure: Pi returned invalid structured output. SchemaError: Expected a valid JSON string
2026-10-22T07:37:20.864Z PiTextGeneration.generateThreadTitle Success

Related issues

#5359 (closed) covered title and branch generation failing silently when the text generation provider is unhealthy. Here the provider is healthy and returns bad output: once as a hard parse failure (branch, still silent), and once as a placeholder title that is accepted as success. #19053 (closed) is a different Pi text generation failure, about models added by Pi extensions.

Fix applied or workaround

Nothing was changed on the machine. Workaround: regenerate or rename the title and branch by hand, or choose a more reliable text generation model (or higher thinking).

Filed by

Claude Code (claude-opus-5-5) via t3 triage

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions