mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-10-03 15:53:56 +00:00
fix(resident): 子的「轮次」一直显示 0 —— info() 根本没填 Rounds
现象(用户线上联调实录 + 我复验):父侧 `resident_agents` 列出 `输入ch=[timer] 轮次=0 处理表=2` —— **处理表已有两条记录,轮次却是 0**,自相矛盾,容易被读成"子没干活"。 根因:`residentChild.info()` 构造 `ResidentInfo` 时**从来没有填过 Rounds 字段** (结构体里有这个字段,于是永远输出零值),不是计数漏加。 改法:`Rounds = 已执行轮次数`(调度器执行计数,单调不减)。新增 `Agent.roundsExecuted()` 并写明为什么**不能**用 inputch 处理表条数当轮次:那张表记的是"当前上下文窗口内"的轮次, 压缩会清空(设计 §8.3)—— 用它会让父看到轮次倒退。 判据:inputch 路由测试里补一条断言 —— 子处理完输入后 `info().Rounds > 0`。
This commit is contained in:
@ -504,6 +504,13 @@ func (rc *residentChild) info() ResidentInfo {
|
||||
ID: rc.id, State: state, InputChs: append([]string(nil), rc.inputChs...),
|
||||
AllowedOutputs: append([]string(nil), rc.allowed...),
|
||||
ContextFull: full, CreatedAt: rc.createdAt, TableSize: len(table),
|
||||
// Rounds = 子**已执行的轮次数**(调度器的执行计数,单调不减)。
|
||||
//
|
||||
// 此前这里根本没填这个字段 ⇒ 父看到的永远是 `轮次=0`,与"处理表已有 N 条"
|
||||
// 自相矛盾(现场:子明明处理了两轮,父读到 rounds=0,误判成"子没干活")。
|
||||
// 注意它**不等于** len(table):处理表记的是"当前上下文窗口内"的轮次,
|
||||
// 压缩会清空(§8.3),所以窗口内的条数会被重置,而轮次总数不会。
|
||||
Rounds: rc.agent.roundsExecuted(),
|
||||
}
|
||||
if len(table) > 0 {
|
||||
info.Table = table
|
||||
|
||||
Reference in New Issue
Block a user