feat(runtime):增加可修改死循环次数以及自我纠正提示#298
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
| messages := builtContext.Messages | ||
| if streak == limit-1 { | ||
| messages = append(messages, providertypes.Message{ | ||
| Role: providertypes.RoleUser, |
There was a problem hiding this comment.
System Reminder is injected as RoleUser, which makes runtime control text indistinguishable from real user intent. This can skew downstream model behavior and prompt interpretation. Prefer a system-level injection (RoleSystem or equivalent system prompt channel) to preserve role boundaries.
| @@ -21,6 +21,7 @@ type Config struct { | |||
| Workdir string `yaml:"-"` | |||
| Shell string `yaml:"shell"` | |||
| ToolTimeoutSec int `yaml:"tool_timeout_sec,omitempty"` | |||
There was a problem hiding this comment.
This introduces a new persisted/validated config surface (runtime.max_no_progress_streak), but the config docs are not updated in this PR. Please update the configuration docs (fields, defaults, and example YAML) so implementation and docs stay in sync.
| @@ -204,6 +205,7 @@ func parseCurrentConfig(data []byte, contextDefaults ContextConfig, memoDefaults | |||
| CurrentModel: strings.TrimSpace(file.CurrentModel), | |||
There was a problem hiding this comment.
RuntimeConfig is now part of parse/save/validate flow, but there are no focused tests for this field’s round-trip and invalid-value behavior (e.g. parse + marshal + validate for max_no_progress_streak). Please add targeted coverage to prevent regressions.
|
/simplify |
|
已完成触发指令中的全部事项,并已推送到当前分支。 处理结果
变更文件
提交与推送
未执行项:无。 |
…ling Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: phantom5099 <245659304+phantom5099@users.noreply.github.com>
|
/review |
- Narrow resolveNoProgressStreakLimit param from config.Config to config.RuntimeConfig - Store resolved noProgressStreakLimit in turnSnapshot to ensure reminder injection and termination checks use the same value, eliminating concurrent-reload inconsistency - TrimSpace systemPrompt once before appending self-healing reminder - Merge double lock sections into one in the progress evidence path - Expand TestRuntimeConfigValidate to cover 0, -1, -99 rejection cases - Update docs: concrete limit-1/limit examples (default 2nd/3rd turn) Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: phantom5099 <245659304+phantom5099@users.noreply.github.com>
fix(runtime,config): resolve review feedback for streak handling
描述 (Description)
将硬编码的熔断阈值改造为配置驱动,并在触发熔断前引入了 Prompt 干预机制。
主要改动 (Changes)
internal/config层:RuntimeConfig结构体,添加MaxNoProgressStreak字段。ConfigManager的加载、默认值回填与快照序列化逻辑,确保向后兼容。internal/runtime层:runtime.go中的硬编码常量noProgressStreakLimit。run.go的doRun循环,从当前的回合快照(Snapshot)中动态读取熔断阈值。prepareTurnSnapshot组装上下文时,若检测到当前streak == limit - 1,向模型消息队列末尾注入干预提示 (System Reminder: You have made multiple consecutive attempts...)。config_test.go,确保RuntimeConfig被正确初始化与校验。runtime_progress_test.go,补充promptInjected标志位断言,验证在最终熔断(ErrNoProgressStreakLimit)发生前,系统确实成功下发了纠偏 Prompt。整体测试覆盖率保持 100%。