Offline Cache Regression Guard for High Cache-Hit Stability / 高缓存命中稳定性的离线回归守卫#2306
Closed
SivanCola wants to merge 1 commit into
Closed
Offline Cache Regression Guard for High Cache-Hit Stability / 高缓存命中稳定性的离线回归守卫#2306SivanCola wants to merge 1 commit into
SivanCola wants to merge 1 commit into
Conversation
This was referenced May 29, 2026
Collaborator
|
🙏 真诚感谢您的贡献! 感谢您为 DeepSeek-Reasonix v1 分支提交的 PR。这些改进体现了您对项目的认真态度和专业技术能力。 关于 v1 分支的说明: v1 (0.x, TypeScript) 版本目前已 完全停止维护。项目已全面迁移至 v2 (Go rewrite, 由于 v1 已不再接受代码变更,此 PR 将被关闭。 我们非常欢迎您将这些修复贡献到 v2 分支! 如果您有兴趣,可以:
再次感谢您的时间和精力!您的贡献对开源社区非常有价值。❤️
|
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
Add a dedicated offline cache regression guard for Reasonix's DeepSeek prompt-cache path.
This PR introduces
npm run cache:guard, backed by a synthetic DeepSeek driver that runs realCacheFirstLoopflows without making network calls. The guard captures each outbound chat request, renders a deterministic cache surface, estimates adjacent-request cache-hit ratios, and fails when a transition that should stay warm unexpectedly changes the immutable prefix or drops below the configured hit-ratio threshold.Why this is necessary
Prompt-cache regressions are expensive but easy to miss:
reasoning_content: ""field on historical thinking-mode assistant messages, can invalidate DeepSeek's prefix cache even when the rendered conversation looks semantically identical.The new tool gives CI a cheap, deterministic check for this class of cost regressions before code is merged.
What it covers
The built-in scenarios exercise the main cache-sensitive dialogue shapes:
The cache surface intentionally includes model, tool schemas, system messages, normalized conversation messages, and field presence for
reasoning_content, so the earlier high-cost failure mode is covered directly.Usage
Optional flags:
The default threshold is
85%, chosen so naturally larger multi-tool continuations remain valid while structural prefix regressions still fail loudly.CI integration
Adds a
Cache guardstep to the main CI workflow after lint/typecheck and before build/test coverage. This makes the guard run on both PRs and pushes tomain.Verification
npm run cache:guardpasses; lowest built-in scenario hit ratio:87.1%.npm run test -- tests/cache-guard.test.tspasses: 3 tests.npm run typecheckpasses.npm run lintexits 0; it still reports the existingsrc/cli/ui/PlanPanel.tsximport-type warning unrelated to this PR.npm run verifypasses: build, lint, typecheck, and full test suite (315test files,4044tests passed,9skipped).