Skip to content

[pull] main from danny-avila:main#99

Merged
pull[bot] merged 6 commits into
innFactory:mainfrom
danny-avila:main
May 29, 2026
Merged

[pull] main from danny-avila:main#99
pull[bot] merged 6 commits into
innFactory:mainfrom
danny-avila:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 29, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

* 🧠 fix: Recognize non-Anthropic reasoning blocks in pruner

Long conversations with reasoning-capable non-Anthropic/non-Bedrock
providers (DeepSeek-R1's `reasoning_content`, DashScope/Qwen-thinking via
OpenAI-compat surfaces) threw fatal 500s once `getMessagesWithinTokenLimit`
ran, permanently bricking the thread on every retry.

Root cause: the pruner searched the assistant content for a reasoning block
by `content.type === reasoningType`, and `reasoningType` only resolves to
`reasoning_content` for Bedrock — every other provider defaults to
`thinking`. DeepSeek/Qwen blocks are tagged `reasoning_content` and are not
normalized upstream (`modifyDeltaProperties` runs only for Anthropic and
Bedrock), so the strict find missed the present block and execution fell
through to the malformed-payload throws.

- Match any reasoning shape (`thinking` or `reasoning_content`) via a shared
  `findReasoningBlock` helper, so the block is located by whichever tag the
  provider actually emitted. This also covers custom OpenAI-compat endpoints,
  which a provider-name check cannot.
- Degrade the two post-loop throws to a graceful return of the
  partially-pruned context, so a missing/mislabeled block surfaces a
  recoverable provider error instead of a fatal that bricks the conversation.
- Null-guard the `addThinkingBlock` content access for empty content arrays.

Adds regression tests for both the find path and the graceful-degradation
path; each was confirmed to reproduce the corresponding pre-fix throw.

Resolves #191

* 🧠 fix: Address Codex review on reasoning-block pruning

- Restrict the cross-type reasoning match to one direction: the THINKING
  default also accepts `reasoning_content` (the DeepSeek/Qwen fix), but a
  Bedrock run (REASONING_CONTENT) no longer matches an Anthropic `thinking`
  block — the Bedrock converter rejects `thinking`, so reattaching one would
  fail the request.
- Clear `thinkingStartIndex` in the graceful-degradation path when no block is
  found, so a stale carried-over index isn't persisted as
  `runThinkingStartIndex` and doesn't suppress the trailing scan on later turns.

Adds regression tests for both (Bedrock must not match a thinking block; the
graceful path must not propagate a stale index).
@pull pull Bot locked and limited conversation to collaborators May 29, 2026
@pull pull Bot added the ⤵️ pull label May 29, 2026
@pull pull Bot merged commit 659139c into innFactory:main May 29, 2026
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant