feat(flow): toolCalls 覆盖率追到全部编排回合(L3)—— 图带权威回合标识
- 新增 StartRoundWithTurnID(ctx, owner, text):从 ctx 取权威回合标识(与 chat_messages.turn_id
同值);Run 的唯一生产建图入口切到它;原 StartRound 语义逐字不变(1 行包装)
- 归属桶(并行按路分图)保持不变;落盘查询键 lane_turn_id 对单路也有值 ⇒ 消息面按等值查得到图
- 无权威标识时**保持缺席**(不拿桶里的路标识顶上:不许臆造)
- 不需要迁移 0024(0023 的列+索引已在位;老单路行标识根本没存过,回填=编造)
形状变化(已登记契约):graph.id 对单路也追加 #{回合标识}(web-7 → web-7#turn-…),
顺带修掉「重启后单路轮次 upsert 掉旧行」的隐患。3 个变异自检(退回老入口/无视 ctx/臆造回退)。
This commit is contained in:
1 parent
6475eb875d
commit
4a937bd269
6 files changed
+353
-21
No files matched your search
@@ -87,9 +87,15 @@ func (l *Loop) Run(ctx context.Context, sessionID string, messages []model.Messa
|
||||
// 归属取**桶**(`{会话}[#{路}]`,见 FlowOwnerKey):真并行时本 Run 属于某一条路,
|
||||
// 两路因此各起各的图、各收各的图 —— 后起的那一路绝不重置前一路(design/15
|
||||
// §2.5.10-1)。单路时桶逐字等于 sessionID,行为与引入本切片之前完全一致。
|
||||
//
|
||||
// 这一路的**权威回合标识**(design/15 §2.5.9)取自 ctx:编排器给每一路都盖了它
|
||||
// (普通单路回合与队首续跑路算,见 `WithTurnID` / `beginLegLocked`),因此图上
|
||||
// `turnId` 与落盘行 `lane_turn_id` 与 `chat_messages.turn_id` 同值同源 ——
|
||||
// 消息面「这条回复当时调了什么工具」据此按**等值**查回本轮的图(`toolCalls[]`)。
|
||||
// ctx 上没有它时(后台思考 / 未接编排器)如实缺席,绝不臆造。
|
||||
if _, isBranch := flowBranch(ctx); l.flow != nil && !isBranch {
|
||||
owner := flowOwner(ctx, sessionID)
|
||||
l.flow.StartRound(owner, lastUserText(msgs))
|
||||
l.flow.StartRoundWithTurnID(ctx, owner, lastUserText(msgs))
|
||||
defer func() { l.flow.EndRound(owner, res.Text) }()
|
||||
}
|
||||
return l.driveTurn(ctx, sessionID, msgs, startStep, res)
|
||||
|
||||
Reference in new issue
Block a user