You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Preserve and surface chunkError instead of hiding behind original error
- Remove 1000 char hard floor in smartChunk for small-context models (now 200)
- Add regression test for small-context model chunking (all-MiniLM-L6-v2)
- Add regression test for chunkError preservation
- Wire cjk-recursion-regression.test.mjs into main test suite (CI)
"body": "## Update\n\nThe latest changes have been pushed to this PR:\n\n- Added regression tests for CJK recursion fix (all 5 tests pass)\n- Removed unused SAFE_CHAR_LIMITS\n- Added batch timeout comments\n- Fixed all reviewer concerns\n\nThe code has been tested locally. Please sync the branch to get the latest commits."
"body": "## Summary\n\nThis PR addresses the two blocking issues raised in PR #215:\n\n### Issue 1: Timeout not truly canceling requests\nThe original PR used Promise.race() + setTimeout() which only rejects the promise but doesn't cancel the underlying HTTP request.\n\n**Fix:**\n- Use AbortController for TRUE request cancellation\n- Timer is properly cleaned up in .finally()\n- AbortSignal is passed through to embedWithRetry and eventually to the HTTP client\n\n### Issue 2: Recursion not guaranteeing convergence\nThe original PR added depth limits but didn't guarantee monotonic convergence for all models (especially small context models like all-MiniLM-L6-v2 with 512 tokens).\n\n**Fix:**\n- Introduced STRICT_REDUCTION_FACTOR = 0.5\n- Each recursion level must reduce input by 50%\n- Works regardless of model context size\n- Added fail-fast when input becomes too small\n\n---\n\n## Changes Made\n\n- Remove unused SAFE_CHAR_LIMITS, getSafeCharLimit\n- Add comment explaining batch timeout asymmetry\n- Add regression tests for CJK recursion fix\n- Add AbortController timeout for true request cancellation\n- Add depth limit (MAX_EMBED_DEPTH=3) to prevent infinite recursion\n- Add single-chunk detection (force-reduce when >=90% of original)\n- Add STRICT_REDUCTION_FACTOR=0.5 for guaranteed convergence\n\n---\n\n## Testing\n\n- Test 1: 4000 CJK chars - PASSED (5 API calls)\n- Test 2: 8000 CJK chars - PASSED (7 API calls)\n- Regression tests: All 5 tests passed\n\n---\n\n## Note: This PR replaces PR #215\n\nThis is a **replacement**, not a follow-up for PR #215. The first commit in this PR contains all changes from PR #215. When PR #238 is merged, PR #215 should be closed without merging.\n\n---\n\n## Attribution\n\n- **Original PR**: #215 by @rwmjhb\n- **Modified by**: AI assistant (not human code) - PR created from user's fork\n- **Thanks to**: Original author and maintainers for the initial fix"
0 commit comments