Commit 7831326
fix(proactive): Phase 2 无合法来源标签时 drop,杜绝脚手架泄漏 (Project-N-E-K-O#1512)
* fix(proactive): Phase 2 输出无合法来源标签时 drop,杜绝脚手架泄漏被念出
线上复现:free-model 初稿直接把人设 Format 块当正文吐出来("No Markdown: Yes."
"* No stage directions/parentheses"),tag 解析为空却仍被投递。根因是 tag_match
未命中时 source_tag 留空但下游照样 emit。
- 初稿:结果处理前加一道闸——非 abort、有正文、但 source_tag 为空(未解析到
[CHAT]/[WEB]/[MUSIC]/[MEME])即判格式泄漏,drop 整轮。合法搭话必以 tag 起头,
缺 tag 一律不投递。TTS 在该点之后才真正 feed,abort 安全。
- regen:同款防护——regen 产出无 tag 不再默认当 CHAT 投递,并入 empty/PASS 的
drop 分支。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore(prompts): 内心活动 header 前加空行 + 输出格式标题改"最终输出格式"
- INNER_THOUGHTS_HEADER 每个 locale 前缀 \n → \n\n,与上方长期记忆隔开一空行。
- proactive 输出格式段标题 "输出格式(严格遵守)" → "最终输出格式(严格遵守)"
(7 locale 同步:Final output format / 最終出力形式 / 최종 출력 형식 /
Окончательный формат / Formato de salida final / Formato de saída final),
强调这是最终格式要求,降低模型把人设约束当正文照抄的概率。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(proactive): 搭话改用 conversation tier + 无 tag 时格式自救 regen
根因:搭话用 correction tier,不开思考时较难稳定遵循"第一行写来源标签"的
格式,弱化时会把人设 Format 约束块当正文吐出来。
- tier:proactive 全链路(Phase1 筛选 / Phase2 生成 / regen)从 correction
改用 conversation tier(主对话主力模型,格式遵循更稳);变量 correction_*
→ conversation_*。仍保持 disable_thinking=True(vision+思考必超时)。
break reminder 不属搭话,保持 correction tier 不动。
- ① 自救:初稿无合法 source_tag 时不直接 drop,先用格式纠正指令 regen 一次
(重建 Human turn:fix 指令 + 原 human_text,末尾仍是 BEGIN 触发句),重跑
解析 tag;拿到合法非 PASS tag 就接回主流程(下游 is_duplicate / BM25 照常
生效),仍无 tag 才 drop。preempt 时放弃。
- ② 强化:新增 render_format_fix_instruction(7 locale),强调第一行写来源
标签、否则只 [PASS]、禁止复述规则/输出清单。配合上一提交的"最终输出格式"标题。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(proactive): tag 解析前 lstrip,容忍 [CHAT] 前的换行/空格(Codex P2)
流式解析与流后兜底都用 ^\[...\] 匹配来源标签,但未去前导空白。模型偶尔先吐
一个换行/空格 token 再吐 [CHAT] 时,^\[ 匹配失败、source_tag 误留空,合法回复
被当成无 tag。两处 tag_match 前补 cleaned.lstrip()。
(format-regen 自救本可救回此类,但根因在解析,lstrip 后省掉一次重生成。)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(proactive): 无 tag gate 仅在启用标签系统时生效 + format-fix 补 WEB
- P1:_of_none 模式(无 web/music/meme 通道)下输出格式段明确要求纯文本无 tag,
下游靠 source_tag='CHAT' 兜底投递。原 no-tag gate 会把这类合法纯文本误判为
格式泄漏、强制自救后 drop(screen-only / 纯聊天轮 false pass)。给 gate 加
_expects_source_tag 守卫(external/music/meme 任一通道存在才要求 tag),
纯文本模式跳过 gate 走原 CHAT 兜底。
- P2:format-fix 自救指令的标签白名单补上 [WEB](原只列 CHAT/MUSIC/MEME),
并改为"按上面输出格式段列出的标签选",避免修复 web 话题时丢掉 WEB 标签
导致下游不挂链接卡片。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore(proactive): 删除 _llm_call_with_retry 中未使用的 actual_model
该局部变量赋值后从未被引用(_make_llm 内部自行解析 model),删除不影响
重试逻辑 / 消息构建 / 模型调用(github-code-quality)。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(proactive): BM25 regen 的无 tag drop 也加 _expects_source_tag 守卫
与初稿 gate 对齐:BM25 regen 产出无 tag 时,仅在本轮启用标签系统
(_expects_source_tag) 才判泄漏 drop;_of_none 纯文本模式下无 tag 合法,
留空交给下游 source_tag='CHAT' 兜底(regen 成功已设 full_text=_cleaned,
落到 6715 的 CHAT 兜底)。PASS / 空 / 内嵌[PASS] 仍照常 drop(Codex P2)。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Hongzhi Wen <cartabio.coder1@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 126f7e9 commit 7831326
4 files changed
Lines changed: 193 additions & 39 deletions
File tree
- config/prompts
- main_routers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
569 | 644 | | |
570 | 645 | | |
571 | 646 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
842 | 842 | | |
843 | 843 | | |
844 | 844 | | |
845 | | - | |
846 | | - | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | | - | |
851 | | - | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
852 | 852 | | |
853 | 853 | | |
854 | 854 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2919 | 2919 | | |
2920 | 2920 | | |
2921 | 2921 | | |
2922 | | - | |
2923 | | - | |
2924 | | - | |
2925 | | - | |
2926 | | - | |
2927 | | - | |
2928 | | - | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
2929 | 2929 | | |
2930 | 2930 | | |
2931 | 2931 | | |
| |||
0 commit comments