fix: noop provider check handles ResilientProvider wrapper (#1020)#1040
fix: noop provider check handles ResilientProvider wrapper (#1020)#1040ziishanahmad wants to merge 1 commit into
Conversation
…1020) ResilientProvider renames 'noop' to 'resilient(noop)' in its constructor, so provider.name === 'noop' in mem::summarize never matched. Zero-LLM installs got misleading parse failures instead of a clean no-op skip. Now checks both 'noop' and 'resilient(noop)'.
|
@ziishanahmad is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThe no-provider early-return check in the ChangesSummarize No-Op Detection Fix
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/functions/summarize.ts (1)
263-263: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider a more robust noop-detection pattern.
The hardcoded
"resilient(noop)"string is tightly coupled toResilientProvider's naming convention (resilient(${inner.name})). If the wrapper format changes or additional wrapping layers are introduced, this check breaks silently and the bug recurs.A slightly more resilient alternative:
♻️ Optional refactor
- if (provider.name === "noop" || provider.name === "resilient(noop)") { + if (provider.name === "noop" || provider.name.endsWith("(noop)")) {This keeps the fix minimal while being robust against future wrapper naming changes. As per coding guidelines, clear naming should be preferred — consider a dedicated
isNoopProvider(provider)helper if this check appears elsewhere.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/functions/summarize.ts` at line 263, The noop check in summarize handling is still coupled to the exact ResilientProvider wrapper name, so it can fail if the wrapper format changes. Update the provider detection around the summarize logic to use a more robust helper or predicate, ideally an isNoopProvider(provider) function that inspects the underlying provider rather than matching "resilient(noop)". Keep the existing noop case for provider.name === "noop", but remove the hardcoded wrapper string from the check and reuse the helper wherever this condition appears.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/functions/summarize.ts`:
- Line 263: The noop check in summarize handling is still coupled to the exact
ResilientProvider wrapper name, so it can fail if the wrapper format changes.
Update the provider detection around the summarize logic to use a more robust
helper or predicate, ideally an isNoopProvider(provider) function that inspects
the underlying provider rather than matching "resilient(noop)". Keep the
existing noop case for provider.name === "noop", but remove the hardcoded
wrapper string from the check and reuse the helper wherever this condition
appears.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 43082355-56f0-43cb-910e-bd5019c7728e
📒 Files selected for processing (1)
src/functions/summarize.ts
Problem
In zero-LLM mode (no API key configured),
mem::summarizeis supposed to short-circuit viaprovider.name === "noop". But every provider is wrapped inResilientProviderbefore reaching the summarize function, andResilientProviderrenames it to"resilient(noop)"in its constructor. The literal string"noop"never matches, so the clean no-op skip is unreachable dead code.Zero-LLM installs get misleading
empty_provider_response/too_many_chunks_skippederrors instead of the intendedno_providerskip, and failure counters climb into the hundreds.Fix
Check both the unwrapped and wrapped names:
One-line fix in
src/functions/summarize.ts. No new dependencies, no API changes.Closes #1020
Summary by CodeRabbit