fix(vision): make image analysis streaming opt-in - #20
Open
qiuYliangM wants to merge 2 commits into
Open
Conversation
|
Thanks @qiuYliangM for taking the time to contribute. This repository is observing a maintainer-managed PR intake gate in dry-run mode, so this pull request is staying open. This note helps maintainers prepare the allowlist before any enforcement is considered. Please read |
Preserve the existing non-streaming request shape by default while allowing callers to opt into SSE, a total request budget, and single-attempt behavior. Reuse the shared retry policy and HTTP error handling, reject empty analyses, bound response buffers, and report incomplete streams as truncated. Document the compatibility controls and cover streaming, JSON fallback, timeout, UTF-8 chunking, and empty-response paths. Co-authored-by: qiuYliangM <185303122+qiuYliangM@users.noreply.github.com> Signed-off-by: hexin <he.xin@h3c.com>
h3c-hexin
force-pushed
the
fix/vision-tool-robustness
branch
from
August 26, 2026 08:33
ea5bdf5 to
4e3b978
Compare
Mid-stream chunk read failures and per-chunk timeouts were previously collapsed into the same truncated flag as a clean finish_reason=length cut, making a broken connection indistinguishable from a normal truncation. Return execution_failed carrying the underlying cause for mid-stream read/timeout errors (after the configured retry policy has run), keep truncated for genuine length cuts and incomplete EOF, and log malformed SSE frames with tracing::warn. Document the mid-stream error semantics in CONFIGURATION.md and add wiremock tests covering mid-stream read failure, mid-stream timeout, and malformed-frame truncation. Implemented with AI agent assistance (Kimi Code); reviewed and verified with cargo test -p codewhale-tui --lib vision::tools (22 passed). Co-authored-by: qiuYliangM <185303122+qiuYliangM@users.noreply.github.com> Signed-off-by: luzeyang (INT) <lu.zeyang@h3c.com>
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.
Summary
[vision_model].stream = trueis explicitly configured.Retry-After, error sanitization, and bounded error-body handling instead of introducing a second retry implementation.Scope
This revision deliberately omits app-specific system prompts, default prompts, temperature overrides, and output-token overrides. Those policies belong in the application; the foundation change only supplies reusable transport and failure semantics.
Testing
cargo fmt --all -- --checkcargo test -p codewhale-tui vision::tools::tests -- --nocapture(19 passed)cargo test --workspace --all-features --locked(10,145 passed; one unrelated target-branch test failed:runtime_api::tests::skill_lifecycle_uninstall_removes_installed_skill. The same test failed again in isolation before reaching the uninstall step.)The unmodified strict Clippy command is also blocked by 32 existing target-branch warnings in unrelated files. No warning points to this change.
Checklist
Known risks
data:event shape. Endpoints that ignore streaming and return ordinary JSON are handled explicitly.No-Issue: hardens the existing vision tool for slow and local OpenAI-compatible endpoints without expanding foundation policy.