Skip to content

fix(bus): detect DashScope input length range as context overflow - #49

Merged
senamakel merged 1 commit into
mainfrom
tinychannels-dashscope-overflow
Oct 7, 2026
Merged

senamakel merged 1 commit into
mainfrom
tinychannels-dashscope-overflow

Conversation

@senamakel

@senamakel senamakel commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Summary

is_context_window_overflow_message in tinychannels-bus (crates/tinychannels-bus/src/context.rs) is a copy of is_context_window_exceeded_message in tinyinference's crates/tinyinference-llm/src/failure.rs, and the copy had fallen behind. I diffed the two match lists in full against tinyinference main (c71e6b5). The only gap is the Alibaba / DashScope (Qwen) arm, "range of input length should be". Without it, a DashScope overflow such as Range of input length should be [1, 98304] was not treated as context overflow on the channels path.

The other context hints, the paired n_keep/n_ctx arm, the token hints and the rate-limit markers already match between the two copies.

The doc comment now says the function must track failure.rs and gives the reason it is duplicated: tinychannels-bus is the contract crate, it stays dependency-free, and so it cannot depend on the inference stack.

API Or Behavior Changes

No API change, and the signature is the same. DashScope "Range of input length should be [...]" errors are now classified as context-window overflow.

Tests

  • context_overflow_matches_dashscope_input_length_range uses the exact body from tinyinference's context_window_matches_dashscope_input_length_range.

  • context_overflow_ignores_other_dashscope_parameter_errors is a negative case: the same DashScope invalid_parameter_error envelope with a non-length range (Range of temperature should be [0, 2)) is not matched.

  • cargo fmt --check (clean)

  • cargo clippy --all-targets -- -D warnings (clean)

  • cargo clippy --all-targets --all-features -- -D warnings (clean)

  • cargo build --all-targets (via clippy/test)

  • cargo build --all-targets --all-features (via clippy/test)

  • cargo test (937 + 194 + 3 + 13 passed)

  • cargo test --all-features (943 + 194 + 3 + 13 passed)

  • cargo test -p tinychannels-bus (194 passed), cargo test -p tinychannels (800 passed)

Documentation

The doc comment on is_context_window_overflow_message records the parity requirement. No other docs are affected.

Summary by CodeRabbit

  • Bug Fixes
    • Improved detection of context-window overflow errors from DashScope, including input-length range messages. Temperature-range errors remain unaffected.

DashScope rejects over-long prompts with "Range of input length should be
[1, 98304]", which was not recognised as a context window overflow. Added the
phrasing to the hint list and documented that this matcher is a deliberate copy
of tinyinference's, kept in sync by hand because the contract crate stays
dependency-free.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 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-07T05:04:12.052971Z e05af92 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.

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0a3df5ec-03fd-49e1-83f9-561281ab0222
📥 Commits

Reviewing files that changed from the base of the PR and between ef347ba and e05af92.

📒 Files selected for processing (2)
  • crates/tinychannels-bus/src/context.rs
  • crates/tinychannels-bus/src/context_tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The context-window overflow detector now recognizes errors containing “range of input length should be.” Documentation and tests cover the new match and a temperature-range error that should not match.

Changes

DashScope Overflow Detection

Layer / File(s) Summary
Add DashScope input-length matching
crates/tinychannels-bus/src/context.rs, crates/tinychannels-bus/src/context_tests.rs
The detector recognizes the input-length range phrase. Documentation says the match list should track tinyinference’s corresponding function. Tests check input-length and temperature error messages.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to e05af

This change makes DashScope input-length range errors count as context-window overflows. It also keeps temperature-range errors from matching. The risk is low. Before merging, confirm that the tinyinference matcher contains the same phrase.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: detecting DashScope input-length range errors as context-window overflows.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the error line
“Input length” earns an overflow sign
Temperature stays outside the gate
The tests confirm which errors qualify
Then hops away, its work complete

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

@tinysweeper

tinysweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Tiny Sweeper reviewed this change across 6 lane(s) and found 0 active actionable finding(s). Detailed lane evidence and any incomplete work are listed below.

State: Ready for maintainer review
Priority: none
Reviewed head: e05af9256302
Updated: 1791350014 (Unix time)

Review snapshot

Change surface Files Review signal Count
Production 1 Active findings 0
Tests 1 Noted findings 0
Documentation 0 Resolved findings 0
Configuration 0 Pending checks/questions 0

Completeness: Complete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

What changed

The review could not produce a supported behavioral summary; inspect the cited changed surface and lane details below.

Features

None identified with supported citations.

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

Findings

No active actionable findings.

Before merge

None.

How this fits together

flowchart LR
  n0["should_skip_memory_context_entry<br/>changed"]:::changed
  n1["build_memory_context"]:::impacted
  n2["Memory"]:::impacted
  n3["MockMemory"]:::impacted
  n4["ChatMessage"]:::impacted
  n5["ConversationHistoryMap"]:::impacted
  n1 -->|calls| n0
  n1 -->|uses| n2
  n3 -->|implements| n2
  n5 -->|uses| n4
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading
Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The change adds DashScope input-length phrasing to the context-overflow detector and covers both positive and negative cases. It looks safe to merge. _Code retrieval was unavailable (model: ladder embeddings returned 400 Bad Request: {"error":{"message":"unknown ladder vectors; known ladders are flash (also chat-v1, flash-v1), instant (also no-think, instant-v1), reasoning (also deepseek), max-reasoning (also max-reasoning-v1), deepseek-flash (also reasoning-v1, agentic-v1), deep (also luna), scribe, uncensored, vectors-oai3 (also embeddings-oai3-v1), vision (also vision-v1, multimodal-v1), image (also images-v1, image-v1), vi), so this review saw the diff alone._ _Memory was unavailable (model: cortex: v1/recall: error sending request for url (http://cortexdb:3141/v1/recall\)\), so this review ran without it._

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The change adds targeted DashScope context-window detection with coverage for the intended provider error and a nearby negative case. It looks safe to merge. _Code retrieval was unavailable (model: ladder embeddings returned 400 Bad Request: {"error":{"message":"unknown ladder vectors; known ladders are flash (also chat-v1, flash-v1), instant (also no-think, instant-v1), reasoning (also deepseek), max-reasoning (also max-reasoning-v1), deepseek-flash (also reasoning-v1, agentic-v1), deep (also luna), scribe, uncensored, vectors-oai3 (also embeddings-oai3-v1), vision (also vision-v1, multimodal-v1), image (also images-v1, image-v1), vi), so this review saw the diff alone._ _Memory was unavailable (model: cortex: v1/recall: error sending request for url (http://cortexdb:3141/v1/recall\)\), so this review ran without it._

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: This change adds a DashScope input-length phrasing to the context-window overflow matcher, with both a positive and a negative test pinning the new hint against the same error envelope. The tests would fail if the hint regressed or matched too broadly; the change looks sound and safe to merge. _Code retrieval was unavailable (model: ladder embeddings returned 400 Bad Request: {"error":{"message":"unknown ladder vectors; known ladders are flash (also chat-v1, flash-v1), instant (also no-think, instant-v1), reasoning (also deepseek), max-reasoning (also max-reasoning-v1), deepseek-flash (also reasoning-v1, agentic-v1), deep (also luna), scribe, uncensored, vectors-oai3 (also embeddings-oai3-v1), vision (also vision-v1, multimodal-v1), image (also images-v1, image-v1), vi), so this review saw the diff alone._ _Memory was unavailable (model: cortex: v1/recall: error sending request for url (http://cortexdb:3141/v1/recall\)\), so this review ran without it._

commits

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: Nothing sensitive found in what this pull request commits.

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The diff adds the DashScope input-length-range hint with a positive and a negative test, exactly as the description claims, plus the parity doc comment it mentions. The description matches the change; it looks sound to merge. _Code retrieval was unavailable (model: ladder embeddings returned 400 Bad Request: {"error":{"message":"unknown ladder vectors; known ladders are flash (also chat-v1, flash-v1), instant (also no-think, instant-v1), reasoning (also deepseek), max-reasoning (also max-reasoning-v1), deepseek-flash (also reasoning-v1, agentic-v1), deep (also luna), scribe, uncensored, vectors-oai3 (also embeddings-oai3-v1), vision (also vision-v1, multimodal-v1), image (also images-v1, image-v1), vi), so this review saw the diff alone._ _Memory was unavailable (model: cortex: v1/recall: error sending request for url (http://cortexdb:3141/v1/recall\)\), so this review ran without it._

e2e

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: No end-to-end harness in this repository: no e2e test files and no e2e workflow.
Evidence and run details
  • Models: gpt-5.6-luna, glm-5.3-flash
  • Spend: $0.000878
  • Tokens: 26577 input · 1443 output · 4940 cached · 0 embedding
Head State Pass summary
e05af9256302 ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 1791350014)

tinysweeper 0.1.0

@tinysweeper tinysweeper 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.

tinysweeper found nothing blocking. Approving.

             $0.0009 · 26,577 in / 1,443 out · 4,940 cached (19%) · gpt-5.6-luna, glm-5.3-flash
critique:    $0.0002 · 4,432 in  / 86 out    · 0 cached (0%)      · gpt-5.6-luna
security:    $0.0006 · 11,088 in / 500 out   · 1,868 cached (17%) · gpt-5.6-luna
tests:       $0.0000 · 4,183 in  / 86 out    · 1,536 cached (37%) · glm-5.3-flash
description: $0.0000 · 4,181 in  / 53 out    · 1,408 cached (34%) · glm-5.3-flash

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Oct 7, 2026
@senamakel
senamakel merged commit 20cc992 into main Oct 7, 2026
10 checks passed
@senamakel
senamakel deleted the tinychannels-dashscope-overflow branch October 8, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant