feat(backthink): 存档落「紧急度」精确档位(裁决 14 的精确化前置)
- backthink_records 自建表加 urgency TEXT NOT NULL DEFAULT ''(**不开迁移号、不动 internal/db**;对既有库幂等补列:PRAGMA 判存在 + 容忍 duplicate column,其它错误照报) - 落库值 = 该轮**实际生效**的档位(escalatedImport 折叠后的 roundImport;她自报可上抬、事件自带高档不被她压低)——「生效值优先」而非「她的话优先」,避免与既有 escalateImport 口径打架 - Record.Urgency 的 JSON 键刻意是 urgency ⇒ WS 实时帧自然带上、前端防御性读取即刻显示(不必等重开页面) - 思考报错行 / 未唤醒降级行 / 历史旧行 = **空串(未知)**,绝不反推(变异:【空串当 routine】⇒ 4 条测试红;【补列非幂等】⇒ 41 条红,新库启动即失败) - 生产影响:下次启动对真实 data/cyrene.db 执行一次单列 ALTER,并记 source=services/backthink 的 Info「backthink records table upgraded」
This commit is contained in:
1 parent
afe9afb1b5
commit
213aff2e33
5 files changed
+760
-8
No files matched your search
@@ -300,6 +300,11 @@ func (b *Backthink) onEvent(ctx context.Context, e bus.Event) error {
|
||||
Conclusion: "system event: low value, not worth waking a thinking pass",
|
||||
ShouldPush: false,
|
||||
PushResult: PushResult{Route: RouteNone, Detail: "downgraded"},
|
||||
// Urgency 留空(未知):这一行**不是一轮思考**(结论即写明未唤醒思考),
|
||||
// 没有「该轮生效的档位」可落;宁可如实为未知,也不拿事件的档位冒充——
|
||||
// 与 P3+P4 的 fail-safe 同口径。(降级只发生在 shouldThink 判到
|
||||
// Import < High 的系统事件上,故它的档位恒为 routine,面板若要显示,
|
||||
// 由既有下限推导即可。)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
@@ -372,6 +377,8 @@ func (b *Backthink) think(parent context.Context, tr Trigger) {
|
||||
Conclusion: fmt.Sprintf("thinking failed: %v", err),
|
||||
ShouldPush: false,
|
||||
PushResult: PushResult{Route: RouteNone, Detail: err.Error()},
|
||||
// Urgency 留空(未知):这一轮没跑完,**没有任何档位生效**;
|
||||
// 拿触发的档位冒充「该轮档位」就是给一行失败记录安它没有的事实。
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -412,6 +419,11 @@ func (b *Backthink) think(parent context.Context, tr Trigger) {
|
||||
Conclusion: recordConclusion,
|
||||
ShouldPush: shouldPush,
|
||||
PushResult: pushRes,
|
||||
// X2a:把**该轮实际生效**的档位落进存档(面板此前只能给「下限」)。
|
||||
// 取数点就是上面决策真正吃进去的 roundImport —— 她自报的紧急度经
|
||||
// escalatedImport 上抬后已折叠在内,因此记下的是生效值;她自报得不比
|
||||
// 事件自带档位低时,生效值就是事件那一档(声明只能上抬,见 escalateImport)。
|
||||
Urgency: urgencyForImportance(roundImport).String(),
|
||||
})
|
||||
|
||||
if shouldPush {
|
||||
|
||||
Reference in new issue
Block a user