Skip to content

Stop repetitive reasoning streams before provider timeout - #1

Closed
PierrunoYT wants to merge 1 commit into
mainfrom
fix/repetitive-reasoning-timeout
Closed

PierrunoYT wants to merge 1 commit into
mainfrom
fix/repetitive-reasoning-timeout

Conversation

@PierrunoYT

@PierrunoYT PierrunoYT commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Detect sustained exact repetition in streamed reasoning and cancel the request.
  • Require explicit user confirmation before retrying the same request.
  • Forward OpenRouter abort signals to the OpenAI SDK so cancellation reaches the upstream inference request.

Regression coverage

  • Reproduces the reported DeepSeek-style reasoning loop across arbitrary chunk boundaries.
  • Verifies ordinary long reasoning and short repeated phrases are not flagged.
  • Verifies task cancellation without automatic retry.
  • Verifies OpenRouter receives the abort signal.

Verification

  • pnpm --dir src exec vitest run core/task/__tests__/ReasoningLoopDetector.spec.ts core/task/__tests__/Task.spec.ts api/providers/__tests__/openrouter.spec.ts — 185 tests passed.
  • pnpm lint — 11 packages passed (pre-commit hook).
  • pnpm check-types — 11 packages passed (pre-push hook).

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

Review status

Thanks for contributing. This comment tracks the review sequence and the next action.

Current step: Required CI passed. Waiting for automated review of the latest commit.

If automated review does not start, a maintainer must restart it.

Review-state labels are managed by this workflow; do not edit them manually.

@github-actions github-actions Bot added coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for automated review of the latest commit labels Oct 4, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T15:28:30.491864Z 280b240 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@PierrunoYT

Copy link
Copy Markdown
Owner Author

Closing this fork-targeted PR; the change is now proposed upstream in Zoo-Code-Org#1904.

@PierrunoYT PierrunoYT closed this Oct 4, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 280b240090

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/core/task/Task.ts
Comment on lines +3317 to +3319
if (reasoningLoopDetector.add(chunk.text)) {
this.cancelCurrentRequest()
throw new RepetitiveReasoningError()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Process reasoning before awaiting the next chunk

When a provider emits a reasoning chunk that crosses the repetition threshold and then stalls, the loop awaits nextChunkWithAbort() at line 3308 before invoking this detector. Consequently, the threshold-crossing chunk is not examined and the request remains active until another chunk arrives or the provider times out, defeating the new safeguard in this scenario. Process the current chunk before requesting the next one.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-coderabbit Waiting for automated review of the latest commit coderabbit-review-active Required CI passed; CodeRabbit review is active

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants