feat(#1466): add sessions table + turn_stats.session_id capture for per-session stats
This commit is contained in:
parent
0c1c06ad76
commit
17ddba0341
5 changed files with 102 additions and 3 deletions
|
|
@ -557,6 +557,14 @@ async fn handle_turn<S: Surface>(
|
|||
S::send_to_parent(socket, format_turn_failure(e)).await;
|
||||
}
|
||||
if let Some(stats) = stats {
|
||||
// Fresh session this turn → mint a `sessions` row and set its id on
|
||||
// the bus so this turn (and subsequent ones until the next fresh
|
||||
// start) stamp `turn_stats.session_id`. Takes the one-shot flag
|
||||
// `run_claude` set when it suppressed `--continue`.
|
||||
if bus.take_fresh_session() {
|
||||
let sid = stats.start_session(started_at, &model_at_start);
|
||||
bus.set_session_id(sid);
|
||||
}
|
||||
let ended_at = serve_common::now_unix();
|
||||
let duration_ms = i64::try_from(started_instant.elapsed().as_millis()).unwrap_or(i64::MAX);
|
||||
let (open_threads, open_reminders) = S::post_turn_counts(socket).await;
|
||||
|
|
|
|||
Loading…
Reference in a new issue