fix: unwrap ResilientProvider name in noop summarize check#1028
fix: unwrap ResilientProvider name in noop summarize check#1028kagura-agent wants to merge 2 commits into
Conversation
…1020) ResilientProvider renames providers to `resilient(${inner.name})`, so the noop short-circuit check `provider.name === "noop"` never matches the wrapped name `resilient(noop)`. This causes summarize to fall through into real LLM logic against an empty-string provider, producing misleading empty_provider_response / too_many_chunks_skipped errors instead of a clean no_provider skip. Unwrap the resilient(...) prefix before comparing to detect the base provider name correctly. Signed-off-by: kagura-agent <kagurachen@agent.qq.com> Signed-off-by: kagura-agent <kagura.agent.ai@gmail.com>
|
@kagura-agent is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe summarize function now unwraps ChangesNoop provider detection fix
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related issues
Suggested labels: bug, tested Suggested reviewers: rohitg00 🚥 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 winRemove WHAT-comment; naming already conveys intent.
The comment restates what the code does.
baseProviderNamealready makes the intent clear.As per coding guidelines: "In TypeScript source code, avoid code comments explaining WHAT — use clear naming instead."
♻️ Proposed fix
- // Unwrap resilient(...) wrapper to get the base provider name (`#1020`) - const baseProviderName = provider.name.replace(/^resilient\((.+)\)$/, "$1"); + const baseProviderName = provider.name.replace(/^resilient\((.+)\)$/, "$1");🤖 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, Remove the redundant WHAT-comment in summarize.ts and rely on the existing naming instead; the logic around baseProviderName already makes the unwrapResilient/base provider intent clear, so delete the comment near the base provider name handling and keep the code self-explanatory.Source: Coding guidelines
🤖 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: Remove the redundant WHAT-comment in summarize.ts and rely on the
existing naming instead; the logic around baseProviderName already makes the
unwrapResilient/base provider intent clear, so delete the comment near the base
provider name handling and keep the code self-explanatory.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f4fa190a-1332-46aa-8fb0-24049e34f696
📒 Files selected for processing (2)
src/functions/summarize.tstest/summarize.test.ts
Signed-off-by: kagura-agent <kagurachen@agent.qq.com> Signed-off-by: kagura-agent <kagura.agent.ai@gmail.com>
|
Hi 👋 Friendly check-in — this PR has been open for a week. The fix is minimal (one-line change to unwrap |
|
Addressed the CodeRabbit nitpick — removed the WHAT-comment in |
Summary
Fixes #1020.
ResilientProviderwraps every provider and renamesnametoresilient(${inner.name}). The noop short-circuit inmem::summarizechecksprovider.name === "noop", which never matches the wrapped nameresilient(noop). This causes every summarize call in zero-LLM mode to fall through into real summarization logic against a provider that always returns empty strings, producing misleadingempty_provider_response/too_many_chunks_skippederrors instead of a cleanno_providerskip.Changes
src/functions/summarize.ts: Unwrapresilient(...)prefix before comparing to"noop"using a regex that extracts the base provider name. The regex is a no-op for plain provider names (returns the original string when there's no match), so existing non-wrapped providers are unaffected.test/summarize.test.ts: Added test that mocks aResilientProvider-wrapped noop provider (name: "resilient(noop)"), calls summarize, and verifies it returns{ success: false, error: "no_provider" }immediately without invokingprovider.summarize().Testing
fs-watcher.test.tsunrelated to this change)npm run buildcleanSummary by CodeRabbit
Bug Fixes
Tests