fix: talk_value=0 时真正跳过回复判断,仅保留表达学习#1667
Conversation
移除 _get_effective_reply_frequency 和 adjust_talk_frequency 中的 0.01 硬钳位,使 talk_value=0 的语义从"最低频率"修正为"仅学习不回复"。 提取 _is_expression_learning_due 共享守卫消除调度与执行阶段的重复检查。 @强制回复不受 talk_value=0 影响,仍可正常触发。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
Walkthrough移除回复频率的非零下限以支持完全静默(有效频率 ≤ 0);在调度中短路常规回复但保留表达式学习触发;提取聊天规则的时间窗判断为辅助方法;推理引擎在静默且有缓存消息时跳过内部循环并切换空闲。 变更内容完全静默模式支持与时间窗抽取重构
🎯 3 (中等复杂度) | ⏱️ ~20 分钟 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/maisaka/reasoning_engine.py`:
- Around line 456-464: The fast-path early `continue` when cached_messages and
runtime timing conditions are met skips the later cleanup that sets
`_agent_state` back from "running" (which causes `register_message()` to treat
subsequent messages as still-in-progress and incorrectly trigger debounce/quiet
windows); fix by performing the same state reset/phase update before returning
from this branch (or move this timing-gate branch into the shared try/finally
cleanup so the post-run cleanup always runs). Update the branch that checks
`cached_messages` / `_runtime._get_effective_reply_frequency()` /
`_runtime._has_forced_timing_trigger()` to either call the same reset routine
used after the run or ensure `_agent_state` is cleared and any debounce/phase
flags are updated before `continue`, and keep `register_message`/debounce
behaviour consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: db85c620-c075-4648-a18b-b684e310dfd4
📒 Files selected for processing (2)
src/maisaka/reasoning_engine.pysrc/maisaka/runtime.py
- _is_time_in_range(): time 为空视为全时段生效,修复 WebUI「全天」规则被 parse_range 丢弃的 bug - 将频率<=0的跳过检查提前到 cached_messages 判断之前,覆盖 timeout 路径 - 提取 _transition_to_idle(),消除 run_loop 内两处相同的状态重置代码 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
问题
WebUI 中将群聊
talk_value配置为 0 后,消息仍会频繁进入 Timing Gate 产生 LLM 调用。根因有三个:_get_effective_reply_frequency()将频率钳位在max(0.01, ...),导致 talk_value=0 实际生效为 0.01_should_trigger_message_turn_by_idle_compensation()可将空窗时间折算为等效消息数,绕过阈值get_talk_value()中time=""(WebUI 显示「全天」)被parse_range()丢弃,导致会话专属规则静默失效。用户将群聊频率设为 0,但因规则被跳过而回退到基础talk_value=0.8,频率检查<=0从未触发修复
_get_effective_reply_frequency()和adjust_talk_frequency()中的 0.01 钳位_get_message_trigger_threshold()频率为 0 时返回_EFFECTIVELY_INFINITE_THRESHOLD避免除零_schedule_message_turn()频率为 0 时仅在学习条件满足时调度 turnrun_loop()频率为 0 且非强制触发时,学习完成后跳过 Timing Gate 和 Planner_is_time_in_range(): time 为空视为全时段生效,修复 WebUI「全天」规则被跳过的问题_is_expression_learning_due()消除调度与执行阶段的守卫重复_transition_to_idle()消除run_loop两处相同的状态重置代码talk_value=0影响测试
🤖 Generated with Claude Code
Summary by CodeRabbit
发布说明
新功能
改进