fix(#23)+feat(#24): stop 后不再下发周期 usage 帧;gummy 预连接 spare 会话
ci / server (push) Failing after 9s
ci / design-tokens (push) Failing after 10s

#23 修复(服务端根治,五端客户端提交信号自动变安全):
- finish 先冻结会话并停 usageLoop,再 flush provider——此前 usageLoop 在
  waitResults(最长 3s)期间继续 tick,周期 usage 帧会抢在尾部 final 之前
  下发,客户端以 partial 文本提前上屏、丢失 final 修正(12B 实测 8s 会话
  4/4 复现;修复后 6/6 归零)
- 桌面端收尾兜底超时 350ms → 800ms(实测 8s 会话 final flush 需 350~540ms,
  350ms 会截丢尾 final)

#24 预连接(12B 调优):
- GummyProvider 常备一条已完成 run-task 握手的 spare 会话,start 直取,
  后台异步补位 + 40s 定期换新(DashScope 空闲 60s 断连,实测 60s 存活/
  120s Idle timeout,留余量 45s)
- 实测网关 start 处理 120~670ms → 3~4ms;消除 dial 抖动(实测 60ms~3.7s)
  对 first_partial 尾部的放大

gummycheck 增加 -model / -pace / -idle 参数,支持模型对比与闲置存活实验

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-07-10 19:44:25 +08:00
parent 7b693b0f63
commit d22e02fa2e
4 changed files with 135 additions and 13 deletions
+5 -3
View File
@@ -127,11 +127,13 @@ pub fn stop(app: &AppHandle, canceled: bool) {
let release_at = Instant::now();
tauri::async_runtime::spawn(async move {
if !canceled {
// 事件驱动:收到 stop 后的尾部 final(或 usage 结算帧)即触发注入
// 350ms 仅作超时兜底,避免 flush 慢于固定 sleep 截丢尾 final18C)。
// 事件驱动:收到 stop 后的尾部 final(或 usage 结算帧)即触发注入18C)。
// 服务端已保证 stop 后不再下发周期 usage 帧(结算帧必在全部尾部 final
// 之后,#23),二者均可安全作为提交信号。800ms 仅作超时兜底:
// 12B 实测 8s 会话的 final flush 需 350~540ms350ms 兜底会截丢尾 final。
tokio::select! {
_ = finalized.notified() => {}
_ = tokio::time::sleep(Duration::from_millis(350)) => {}
_ = tokio::time::sleep(Duration::from_millis(800)) => {}
}
let buf = app.state::<CommitBuffer>();