Skip to content

fix: preserve optional vision through provider wrappers - #1798

Merged
rohitg00 merged 3 commits into
rohitg00:mainfrom
zack-dev-cm:fix/provider-vision-delegation
Nov 16, 2026
Merged

rohitg00 merged 3 commits into
rohitg00:mainfrom
zack-dev-cm:fix/provider-vision-delegation

Conversation

@zack-dev-cm

@zack-dev-cm zack-dev-cm commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Factory-created vision providers lose describeImage in the resilience and fallback wrappers. Image observations then complete text-only compression without a caption, even when the underlying Anthropic provider supports vision.

Preserve the optional image delegate through both wrappers. Image calls share the existing circuit breaker and content-filter handling. Fallbacks try capable providers in configured order, preserve the receiver and arguments, and propagate the last capable error. Text-only providers and empty chains keep the capability absent.

The regression tests drive the real factories, Anthropic provider and registered compression function with SDK, fetch, dispatch and in-memory KV doubles. They check returned and persisted captions, caption sanitization, fallback behavior and the shared breaker policy. The tests exercise control flow rather than a live model or engine.

Validation: 18 new tests and 43 adjacent tests pass. The full suite passes 4,949 tests with seven skipped, using a child-only DNS fixture for eight example peer names. Build, skills generation/check, docs sync/check and eval type check pass. Both changed wrapper modules pass a dedicated strict TypeScript check. The test root retains three existing transitive diagnostics, with no new diagnostics.

Summary by CodeRabbit

  • New Features
    • Image descriptions can now use supported providers in a fallback chain, trying them in order when a provider fails. Text-only providers and empty chains do not expose image-description support.
    • Image description requests are now available through resilient providers, with failures handled by the same circuit breaker as other requests.
    • Image-description requests continue to respect provider capabilities; text compression does not trigger image-description requests.

Signed-off-by: zack-dev-cm <112114097+zack-dev-cm@users.noreply.github.com>
@vercel

vercel Bot commented Nov 16, 2026

Copy link
Copy Markdown

@zack-dev-cm is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

No actionable comments were generated in the recent review.

Walkthrough

Resilient and fallback providers now expose image-description calls when supported. These calls preserve provider context and use existing fallback and circuit-breaker handling. Tests cover capability detection, fallback order, breaker behavior, and caption persistence.

Changes: Image Description Provider Support

Layer / File(s) Summary
Image-description provider routing
src/providers/fallback-chain.ts, src/providers/resilient.ts, test/provider-vision.test.ts
ResilientProvider routes supported image-description calls through its shared call path. FallbackChainProvider tries providers that support image descriptions. Tests cover provider delegation, fallback order, and capability detection.
Breaker and caption validation
test/provider-vision.test.ts
Tests check breaker behavior for image and text operations. They also check that credentials in image captions are redacted in returned and persisted observations.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant FallbackChainProvider
  participant ResilientProvider
  participant CircuitBreaker
  participant InnerProvider
  FallbackChainProvider->>ResilientProvider: describeImage(args)
  ResilientProvider->>CircuitBreaker: call() checks breaker
  CircuitBreaker-->>ResilientProvider: allow or reject call
  ResilientProvider->>InnerProvider: invoke describeImage(args)
Loading

Possibly related PRs

Merge Risk: Minimal · previous review dc193

This change lets the resilient and fallback provider wrappers expose image description when the wrapped providers support it. Text-only providers and empty chains are unaffected. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix: preserve optional vision through provider wrappers" matches the main change. The PR keeps the optional describeImage delegate on FallbackChainProvider and ResilientProvider, so it is e…
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.
Full details: Title check

Explanation

The title "fix: preserve optional vision through provider wrappers" matches the main change. The PR keeps the optional describeImage delegate on FallbackChainProvider and ResilientProvider, so it is exposed only when a wrapped provider implements it. The title names the fix, the optional vision capability, and the wrapper layer. It is concise, specific, and free of file lists or vague terms. The summary also covers fallback ordering and circuit-breaker handling, but the title does not need to list those details.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ae3114ca-4ea3-4aa2-9737-22a34fb18fcc
Commits

Reviewing files that changed from the base of the PR and between 2ce0a4c and dc193df.

Files selected for processing: 1

  • test/provider-vision.test.ts
Files skipped from review as they are similar to previous changes: 1

  • test/provider-vision.test.ts

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

devin-ai-integration[bot]

This comment was marked as resolved.

zack-dev-cm and others added 2 commits November 16, 2026 09:24
Signed-off-by: zack-dev-cm <112114097+zack-dev-cm@users.noreply.github.com>
The previous test mocked the Anthropic SDK, KV, search and the compress
pipeline across 526 lines to check a 27 line change. Test the two
wrappers directly: ResilientProvider forwards describeImage and counts
its failures in the shared breaker, FallbackChainProvider skips
text-only providers and falls through in order, and both leave
describeImage absent when nothing supports it.

Signed-off-by: Rohit Ghumare <ghumare64@gmail.com>
@rohitg00
rohitg00 merged commit a8b71f2 into rohitg00:main Nov 16, 2026
14 of 16 checks passed

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

Devin Review

Comment on lines +21 to +29
describe("provider wrappers keep image description", () => {
it("ResilientProvider forwards describeImage with its arguments", async () => {
const describe = vi.fn(async () => "a red dot");
const provider = new ResilientProvider(withVision("vision", describe));

await expect(provider.describeImage?.("data", "image/png", "prompt")).resolves.toBe(
"a red dot",
);
expect(describe).toHaveBeenCalledWith("data", "image/png", "prompt");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Factory-to-caption coverage gap

The ResilientProvider tests construct wrappers directly; no test exercises factory-created vision providers through compression. Existing multimodal tests inject mocks directly. The PR description claims factory-to-persistence coverage that these tests do not provide.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

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