[codex] 修复 PKM 澄清请求后的循环重试#153
Merged
utopiafar merged 1 commit intoMay 18, 2026
Merged
Conversation
da2846b to
2d77d42
Compare
PR Preflight Summary / PR 预检汇总中文
English
PR Policy Preflight / PR 规则预检PR Policy Preflight / PR 规则预检中文
未发现确定性规则问题。 English
No deterministic policy findings. PR Flutter Quality / Flutter 质量预检PR Flutter Quality / Flutter 质量预检中文
English
Flutter Analyzer Baseline
No new analyzer issues introduced by this PR. Flutter Test Baseline
No new Flutter test failures introduced by this PR. |
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.
背景
Closes #146。
这个 issue 是合理的:当前 PKM workflow 的完成证据只接受“P.A.R.A. 写入 + card insight”或显式 skip;但真实 replay 里的信息不足场景已经创建了 clarification request,却仍被视为未完成,后续 retry 会反复走相同的空搜索、重复澄清或重复读取,最终触发 loopDetection / max turns。
改动
create_clarification_request返回明确的去重状态:request_id、created=true/false、dedupe_key,让 agent 能识别“已存在同 key 请求”并停止重复创建。AgentExceptionCode.loopDetection发生时,如果历史里已经存在有效 completion evidence,PKM task 会按完成处理,避免 LocalTaskExecutor 继续重试同一死路。ask_clarification收口;同参空Glob/Grep、重复Read不应继续打转。验证
env -u ws_proxy -u wss_proxy no_proxy=localhost,127.0.0.1,::1 flutter pub get --offlineenv -u ws_proxy -u wss_proxy no_proxy=localhost,127.0.0.1,::1 dart analyze lib/agent/pkm_agent/pkm_agent.dart lib/agent/prompts.dart lib/agent/skills/ask_clarification/ask_clarification_skill.dart lib/data/services/clarification_request_service.dart test/agent/agent_tool_error_result_test.dart test/agent/pkm_agent_skip_completion_test.dartenv -u ws_proxy -u wss_proxy no_proxy=localhost,127.0.0.1,::1 flutter test --no-pub test/agent/pkm_agent_skip_completion_test.dart test/agent/agent_tool_error_result_test.dart备注:
flutter analyze --no-pub可执行,但当前main基线已有 324 个 info 级 lint,因此本 PR 用触达文件的dart analyze作为静态检查 gate。