Repository navigation
Conversation
分类响应为空、不含 JSON 或顶层不是数组时,_parse_classify_response 此前返回空列表,与"成功但无匹配"无法区分:该批次被标记为已分析, 之后不再重试,且原因只在 DEBUG 模式下输出。 改为返回 None,沿用 classify_batch 已约定的失败语义,由调用方输出 "分类失败,将在下次运行重试"且不标记已分析;同时在非 DEBUG 模式下 输出一行原因。合法的空数组 [] 仍视为无匹配。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
问题
AI 智能筛选的分类响应为空、不含 JSON,或顶层不是数组时,
_parse_classify_response返回[],与"成功但无匹配"无法区分。该批次会被标记为已分析,之后不再重试,而原因只在DEBUG模式下输出。常见触发场景:模型的思考 token 计入
max_tokens,预算用完后返回空文本。详见 #1254。修改
None。这沿用classify_batch已有的失败约定:调用方输出"分类失败,将在下次运行重试",并且不标记已分析。ai.max_tokens。原有的 DEBUG 详细输出保持不变。[]仍返回空列表,表示无匹配。filter_pipeline.py。注意:如果某个模型持续返回无法解析的内容,该批次每次运行都会重试。这与现有请求异常时的处理一致。
验证
新增
tests/test_ai_filter_classify_response.py:None;[]返回空列表,合法数组正常解析;AIFilterPipeline._classify_batches的回归:空响应批次不进入已分析列表,后一批次正常记录。在修改前的代码上,新测试中的回归用例和 5 个子用例会失败;修改后全部通过。
uv run --project . --with pytest pytest -q tests --ignore=tests/test_mcp_stdio.py31 passed, 40 subtests passeduvx ruff check tests/test_ai_filter_classify_response.pygit diff --check origin/master...HEAD真实运行:在 v6.11.0 镜像中加载本修改,用
anthropic/claude-haiku-5-5、max_tokens: 3000复现。两条失败路径都出现了,原来会显示0 条匹配的批次现在都按失败处理:已分析状态只记录成功的批次(热榜 179 条加 RSS 批次 3 的 61 条),失败的 240 条留待下次运行。
Closes #1254