Repository navigation
Conversation
ResumeGradingService#analyzeResume 的内层 catch 抛出的 BusinessException 会被外层 catch 捕获,异常无法传播到 AbstractStreamConsumer 的失败分支。消费者拿到 0 分占位 结果后走 markCompleted,把 analyze_status 写成 COMPLETED 并 ACK 消息,导致 Stream 重试(retryMessage)与恢复调度(ResumeAnalysisRecoveryScheduler)双双失效 —— shouldSkip 见到 COMPLETED 直接跳过,两条补偿路径都不会再触发。触发场景包括 LLM 429 限流、请求超时、网络抖动、模型名配置错误。 移除外层 catch 与 createErrorResponse,失败时直接抛出 StructuredOutputInvoker 已 构造的 BusinessException(RESUME_ANALYSIS_FAILED);内层那个仅重复包裹的 catch 一并 删除(与 cabf278 的意图一致:让异常向上传播)。 补测试锁住契约: - ResumeGradingServiceTest:失败必须抛出,不能被吞成 0 分结果(含非业务异常) - AnalyzeStreamTest:分析失败时向上抛出,且不落库占位报告 Fixes Snailclimb#63
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.
问题
ResumeGradingService#analyzeResume在 LLM 调用失败时返回一份 0 分的降级占位结果(createErrorResponse),而不是抛异常。原因是内层 catch 抛出的BusinessException会被外层catch (Exception e)捕获,异常无法传播到AbstractStreamConsumer。AnalyzeStreamConsumer#processBusiness拿到这份"结果"后正常返回,基类走markCompleted分支:resumes.analyze_status被写成COMPLETED并 ACK 消息retryMessage永远不会触发ResumeAnalysisRecoveryScheduler也扫不到该任务(shouldSkip见COMPLETED直接跳过)结果是:用户看到一份 0 分的"分析报告",系统却认为这次分析成功了,两条补偿路径全部失效。触发场景包括 LLM 429 限流、请求超时、网络抖动、模型名配置错误。
改动
analyzeResume的外层catch (Exception)与createErrorResponseStructuredOutputInvoker失败时本就会抛出BusinessException(RESUME_ANALYSIS_FAILED))createErrorResponse删除后已无调用方,一并移除链路回到设计本意:失败抛出 → 基类捕获 → 重试最多 3 次 → 耗尽后
markFailed落FAILED+ 原因,恢复调度器也能重新扫到。测试
新增 / 补充 3 个用例:
ResumeGradingServiceTestBusinessException,不返回 0 分结果ResumeGradingServiceTestAnalyzeStreamTest全量
./gradlew :app:test:485 用例,0 失败 0 错误,49 跳过。端到端验证
把 provider 的
baseUrl指向不可达地址后重新分析:retryCount依次递增0 → 1 → 2 → 3(共 4 次尝试,间隔约 2.5 秒)FAILED,analyze_error写入失败原因baseUrl后点重新分析,状态恢复COMPLETED并产出新分数关于方案选择
Issue #63 里提过两个方向:A(直接抛,走重试)和 B(保留降级结果 + 加
degraded标记)。最终选 A,因为 B 如果只保留占位结果而不落库,行为与 A 等价却多一层间接;若要在重试耗尽后真的落库降级报告,会与
getLatestAnalysis的语义冲突——它会把降级报告当成正常分析结果返回,前端AnalysisPanel会渲染成一份正常报告,正好又回到这个 issue 要修的现象,因此需要连带改查询层和前端,成本高于收益。方案 B 的实现没有丢弃,保留在本地分支上。后续如果确实需要"失败也给用户一份可读报告",可以在此基础上扩展。
Closes #63