fix: classify cache hits by current CV, not the legacy assessment column - #16
Merged
Merged
Conversation
prefilter_jobs decided a cached job's fate from job_cache.assessment, a column
that records no cv_hash. A job rejected under an earlier CV was dropped by
`continue` before it could reach the pipeline, so no later CV could ever
reconsider it -- 95 of 293 jobs in the local cache were blocked this way.
Cache hits now go through classify_cache_hit, which looks up job_matches for
the current cv_hash and match prompt version:
reuse - match exists, recommendation != skip
skip - match exists, recommendation == skip
reassess - no match for this CV (CV changed, prompt version bumped, or never
scored); re-enters assessment on cached JD content, no re-fetch
Without a cv_hash the previous legacy-column behavior is kept, so CV-less runs
keep working and the no-CV path does not start dropping results.
Verified read-only against the real cache on jobs a previous CV had rejected:
passing the current cv_hash yields skipped=0 / re-assess=5, while the legacy
path on the same rows yields skipped=5 / re-assess=0.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012DbPx4FbswofbGn41anE1q
This was referenced Aug 7, 2026
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.
接续 #15。#15 修的是
assess命令的补跑路径,本 PR 修同源问题在搜索管道里的那一半。问题
search_prefilter.py的缓存命中判定完全不看 CV:assessment是 JD × CV 的函数,却不记录cv_hash。后果是被某个旧 CV 判为"不相关"的职位,会在continue处被直接丢弃,任何新 CV 都无法让它重进管道。本地 293 条缓存里有 95 条处于这个状态。改动
新增
classify_cache_hit(cached_job, cv_hash, language),按当前cv_hash+match_prompt_version查job_matches:recommendation != "skip"reuse→ 复用,跳过 LLMrecommendation == "skip"skipreassess→ 用缓存 JD 内容重评,不重新 fetchcv_hashprefilter_jobs新增cv_hash参数(agent.py两个调用点都已接上;cv_hash本来就在作用域里,只是没往下传)。顺带恢复了被del language丢掉的language参数。保留无
cv_hash的降级路径是必要的:该分支下flush_assessments的has_cv为假,若把这些职位塞进patch_pending会导致它们不进结果集。验证
新增
tests/test_search_prefilter.py(9 个用例),覆盖四种判定、prompt 版本失效、legacy 降级路径,以及prefilter_jobs的集成行为。全量 233 passed。对正式缓存的只读验证(不调用 LLM),取旧 CV 拒绝过的真实职位:
两条路径在同一份代码里对比,直接显示行为差异。
成本影响
换 CV 后的第一次搜索,命中缓存的职位会重新评估,不再静默复用旧 CV 的结论。这正是本 PR 要的语义,但不免费。
缓解:
match_job_to_cv(matching.py:710)内部查job_matches,reuse分支不会重复调用 LLM;reassess分支先走批量闸门(8 条/次)再精算,JD profile 也可复用。已知残留:被闸门拒绝的职位不写
job_matches,因此每次搜索都会重新过一次闸门。批量闸门成本低,未在本 PR 处理。🤖 Generated with Claude Code
https://claude.ai/code/session_012DbPx4FbswofbGn41anE1q