Repository navigation
fix(responses): show GLM-5.3 thinking from its reasoning item - #225
Merged
Merged
Conversation
The Provider API returns the zai-org/GLM-5.3 chain of thought only as plaintext `encrypted_content` on the completed reasoning item, with an empty `summary` and no reasoning delta. pi-ai keeps that field as a replay signature and renders nothing, so the thinking was received and never shown. Rewrite the completed reasoning item into a canonical `response.reasoning_text.delta` before it reaches the host, gated per model because other providers use the same field for real ciphertext. Skip the rewrite when the item carries a summary or content, or when that output index already streamed reasoning text. Live evidence: two /responses requests on 2026-11-17 at effort high and max returned no reasoning delta and 63/725 characters of plaintext item content. Replaying those captures through pi-ai 1.5.2 yields 0 characters of thinking before this change and the exact text after it. Refs #221.
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
Memory benchmarkCompared base
Interpretation: No metric shows a clear Base-to-PR difference beyond its measured run-to-run variation. Extension overhead above pi baseline
Values are medians of 6 alternating, paired runs. The value after Environment: pi
|
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Show the
zai-org/GLM-5.3thinking that the Provider API returns but never streams.The model emits no
response.reasoning*.deltaevent. Its whole chain of thought arrives as plaintextencrypted_contenton thereasoningoutput item atresponse.output_item.done, withsummary: []. The host keeps that field only as a replay signature, so the content was received and never displayed. This PR rewrites the completed item into a canonicalresponse.reasoning_text.deltabefore it reaches the host.Fixes the behaviour reported in #221. The issue stays open until a release ships the fix.
Live evidence (2026-11-17)
Two bounded
/provider/v1/responsesrequests,reasoning.effort=highandmax,max_output_tokens= 512, cost about $0.0025 total. Both returned HTTP 200:highmaxControl:
mistral/mistral-large-4on the same endpoint emitted 106response.reasoning.deltaevents, which the existing normalizer already handles. The transport is not the cause.Behaviour and risk
PLAINTEXT_REASONING_CONTENT_MODELS). For OpenAI models the same field holds real ciphertext, so it must stay invisible; the compat test pinsmistral/mistral-large-4,z-ai/glm-5.3-flashandz-ai/glm-5.3-flashxas opt-out until a capture proves the shape for them.summaryorcontent, or when thatoutput_indexalready streamed reasoning text, so a canonical stream cannot be duplicated.Validation
thinking_endcontent and a cleandoneevent.npm testwith both hosts required (PI_LOCAL_REQUIRED=1 OMP_REQUIRED=1): PASS, including 5 new transport cases and 1 new compat case.typecheckandtypecheck:entrypointagainst installed Pi 1.5.2 declarations: PASS.format:check,git diff --check: PASS. No workflow files touched.Authorization boundary
This PR is code only. No release, tag, npm publication or production installation is included; a 0.8.6 release stays separately authorized. The live probes above were explicitly authorized and bounded; no other paid checks were run.