Skip to content

Fall back to the structured Ask when a failed stream sent only whitespace - #187

Merged
Programcode merged 2 commits into
mainfrom
fix/ask-whitespace-cutoff
Oct 22, 2026
Merged

Programcode merged 2 commits into
mainfrom
fix/ask-whitespace-cutoff

Conversation

@Programcode

Copy link
Copy Markdown
Owner

Fix-forward for #182, found by its post-merge Codex review.

Since #182, ai-stream fails an Ask stream that was cut off at its length cap before any real text arrived. A failed stream should make the Ask page fall back to the structured endpoint, which retries with a larger cap. The page decided whether to fall back by checking whether any delta had arrived, though, so a model that sent "\n\n" and then ran out of tokens left an empty answer and an "interrupted" toast instead.

The page now falls back unless the partial answer has text other than whitespace. A partial answer with real text is still kept as before.

Verification

GitHub Actions doesn't run repo-wide right now (account billing), so these ran locally:

  • src/test/pages/AskStreamFallback.test.tsx (new) checks two cases: a stream that sent only whitespace falls back to askChat, and a stream that sent real text keeps it. The first case fails against main's AskPage.tsx and passes with this change.
  • src/test/pages/AskAccountSwitch.test.tsx still passes.
  • eslint passes on both files.

🤖 Generated with Claude Code

…pace

A reply cut off at its cap before any real text fails in ai-stream, but a
leading newline already counted as streamed text, so the page kept an empty
answer instead of asking the structured endpoint, which retries with a
larger cap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 22, 2026 15:19

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 71c083e and 6bdba72.

📒 Files selected for processing: 2
  • src/pages/AskPage.tsx
  • src/test/pages/AskStreamFallback.test.tsx
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing.

Comment @coderabbitai help to get the list of available commands.

@Programcode
Programcode merged commit a238ba6 into main Oct 22, 2026
@Programcode
Programcode deleted the fix/ask-whitespace-cutoff branch October 22, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants