Repository navigation
fix(ci): keep gpt-5.5 for issue triage by inlining encrypted reasoning - #942
Merged
Merged
Conversation
The Flue issue triage agent fails on multi-turn conversations with gpt-5 because @mariozechner/pi-ai hardcodes `store: false` in its OpenAI Responses provider. When tools are called, gpt-5 emits reasoning items with rs_* IDs that are replayed on the next turn, but OpenAI rejects them because no item was persisted server-side. Error: 404 Item with id 'rs_...' not found. Items are not persisted when `store` is set to false. Patch the bundled pi-ai provider to send `store: true`, matching the OpenAI Responses API default and unblocking the triage workflow until the upstream fix lands. Refs: earendil-works/pi#3369 Co-Authored-By: Cursor Agent <[email protected]>
…ue triage" This reverts the pi-ai pnpm patch from fb0bd97. Patching a hardcoded upstream value to its inverse is too blunt a hammer for what is, at its core, a model-selection problem in the triage agent. Drop the patch and pin to a non-reasoning model in the next commit instead. Co-Authored-By: Cursor Agent <[email protected]>
The Flue issue-triage workflow fails on every multi-turn call:
[flue] Error: skill("issue-triage") failed: 404 Item with id
'rs_...' not found. Items are not persisted when `store` is set
to false.
Root cause is upstream and not patchable from here:
- Flue 0.3.11 (latest) drives every chat through @mariozechner/pi-ai
with `thinkingLevel: "off"` hardcoded, no public option to override.
- pi-ai 0.73.1 is the last version under that npm scope (the project
migrated to @earendil-works/pi-ai 0.74.0 on 2026-05-07, which Flue
does not yet depend on).
- pi-ai's OpenAI Responses provider hardcodes `store: false` and,
for reasoning models, only requests `include:
["reasoning.encrypted_content"]` when a reasoning effort is passed.
With Flue passing none, gpt-5 emits `rs_*` items that have neither
server-side persistence nor inline encrypted payloads, and the next
turn 404s.
- The fix that would let us keep gpt-5 (Flue exposing `reasoning` /
`thinkingLevel` per call, withastro/flue#69) was merged into Flue
main on 2026-05-08 but is not yet released. The pi-ai-side fix
(earendil-works/pi#1504, defaulting `store: true`) was auto-closed
and never merged.
Until one of those lands, drop the default to `openai/gpt-4.1` — a
non-reasoning model on the same OpenAI Responses path that never
emits `rs_*` items, so multi-turn replay works without any patch.
Operators can still override via the `FLUE_TRIAGE_MODEL` repo
variable; once Flue picks up `reasoning` plumbing we can flip the
default back to `openai/gpt-5` and pass `reasoning: "minimal"`.
Refs:
- earendil-works/pi#3369
- earendil-works/pi#1504
- withastro/flue#69
Co-Authored-By: Cursor Agent <[email protected]>
pi-ai (the LLM client Flue uses) hardcodes store: false on the OpenAI
Responses API. With reasoning models (gpt-5, o-series, ...), every
multi-turn call 404s because pi-ai replays the rs_* reasoning IDs from
the previous turn and OpenAI cannot look them up when nothing was
persisted.
The supported escape hatch is to ask OpenAI to inline the encrypted
reasoning blob via include: ["reasoning.encrypted_content"]. pi-ai's
convertResponsesMessages then ships that blob back on replay, so no
server-side persistence is needed.
@flue/sdk 0.3.11 doesn't expose a reasoning/thinkingLevel knob, so we
reach into the Session's pi-agent-core harness and install pi-ai's
existing onPayload hook to add the include flag for any
openai-responses / azure-openai-responses reasoning model. The hook is
a no-op for non-reasoning models and other providers.
This unblocks gpt-5 as the default triage model. FLUE_TRIAGE_MODEL
still overrides if we want to pin a different model.
Verified by reconstructing the harness wiring (Agent + getModel) and
asserting:
1. The hook adds reasoning.encrypted_content to gpt-5 payloads.
2. Non-reasoning models (gpt-4.1) are left untouched.
3. pi-agent-core forwards onPayload into streamFn, which is the same
code path pi-ai's openai-responses provider invokes after building
the request.
Refs: earendil-works/pi#3369, earendil-works/pi#1504, withastro/flue#69.
Co-Authored-By: Cursor Agent <[email protected]>
The encrypted reasoning hook already handles gpt-5.5 (same openai-responses API with reasoning: true), so no other changes needed.
dcramer
marked this pull request as ready for review
May 8, 2026 21:05
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.
Problem
The Flue issue-triage workflow (failing run) 404s on the first multi-turn round-trip after a tool call:
Same root cause every framework keeps tripping on (vercel/ai#7543, openai/openai-agents-python#2265, openclaw/openclaw#16803, earendil-works/pi#3369):
@mariozechner/pi-ai— the LLM client Flue uses internally — hardcodesstore: falseon the OpenAI Responses API and then replaysrs_*reasoning IDs from the previous turn. Without server-side persistence the IDs don't resolve and OpenAI 404s.Why we don't downgrade to a non-reasoning model
The previous revision worked around this by switching the default to
openai/gpt-4.1. That bypasses the bug (gpt-4.1 isreasoning: falsein pi-ai's registry, so the entire reasoning code path is skipped), but it also throws away gpt-5's reasoning quality on a hook whose whole job is judgment calls (duplicate detection, severity, validity). We want to stay on gpt-5.Why we don't patch pi-ai or fork it
pnpm patchagainst@mariozechner/[email protected]flipped the hardcodedstore: falsetotrue. That works narrowly but vendors an upstream library mid-version, so any future bump silently invalidates the patch.@earendil-works/[email protected](May 7) but Flue 0.3.11 still depends on@mariozechner/pi-ai, so an override doesn't help.reasoning/thinkingLevelknob (withastro/flue#69) is merged intomainbut unreleased.Fix
OpenAI's documented escape hatch for
store: false+ reasoning isinclude: ["reasoning.encrypted_content"]. With it, OpenAI returns the full encrypted reasoning blob inline; pi-ai already serializes that blob intothinkingSignatureand ships it back on replay (convertResponsesMessagesinopenai-responses-shared.js). Nostore=true, no provider-side retention, no patch.@flue/sdk0.3.11 has no public knob to set this, but the underlying pi-agent-coreAgentdoes: it forwards anonPayloadhook intostreamFn, and pi-ai'sopenai-responsesprovider invokesoptions?.onPayload?.(params, model)after building the request. So we reach into the Session's harness once, install a tinyonPayload, and let pi-ai do the rest.The hook is a no-op for non-reasoning models and for any provider that isn't OpenAI Responses / Azure OpenAI Responses, so flipping
FLUE_TRIAGE_MODELto a Claude or non-reasoning model still works unchanged. We can drop the hook the moment Flue ships #69 or pi-ai stops hardcodingstore: false.Files
.flue/agents/issue-triage.ts— installenableEncryptedReasoning(session)and switch the default back toopenai/gpt-5.docs/flue-hooks.md— document the hook, the new default, and the upstream tracking issues.Verification
pnpm install—node_modules/.pnpm/@[email protected]_…/dist/providers/openai-responses.jsis back to unmodified upstreamstore: false; nopatches/directory.pnpm run tsc && pnpm run lint && pnpm run test— all green.pnpm exec flue build --target node— agent compiles;dist/server.mjscontains the bundled hook (enableEncryptedReasoning,harness.onPayload, the literal"reasoning.encrypted_content").pi-agent-core'sAgent+pi-ai'sgetModel. Confirmed:reasoning.encrypted_contentto a realgetModel("openai", "gpt-5")payload.getModel("openai", "gpt-4.1")payloads untouched (noincludefield).pi-agent-core.createLoopConfigforwardsharness.onPayloadinto thestreamFnoptions object — i.e. exactly the path pi-ai's openai-responses provider invokes afterbuildParams.End-to-end execution of the triage workflow itself still requires
OPENAI_API_KEY/GH_TOKEN, which aren't available in this environment. Once merged, re-running on issue #941 (or any new issue) will exercise the gpt-5 path with the encrypted reasoning replay.Slack Thread