Review failed

This commit is contained in:
Ian Gulliver
2026-10-15 20:24:15 -07:00
parent 8cfe9de384
commit 2401c6fc93
4 changed files with 24 additions and 5 deletions
+8 -1
View File
@@ -762,7 +762,14 @@ func (m *Manager) turnEnded(ctx context.Context, l *live, res endResult) error {
if err != nil {
return err
}
m.snapshotSoon(l, api.SnapshotTriggerTurnEnd, 0)
mergingBy := ""
if finished && !handoff {
mergingBy, err = m.store.MergingBy(ctx, l.taskID)
if err != nil {
return err
}
}
m.snapshotSoon(l, api.SnapshotTriggerTurnEnd, 0, mergingBy == "")
if res.window > 0 {
err = m.updateContext(ctx, l, l.contextUsed, res.window)
+6 -3
View File
@@ -18,6 +18,7 @@ import (
type snapRequest struct {
trigger api.SnapshotTrigger
seq int64
review bool
}
type snapState struct {
@@ -36,7 +37,7 @@ func (m *Manager) snapStateLocked(taskID string) *snapState {
return st
}
func (m *Manager) snapshotSoon(l *live, trigger api.SnapshotTrigger, seq int64) {
func (m *Manager) snapshotSoon(l *live, trigger api.SnapshotTrigger, seq int64, review bool) {
m.snapMu.Lock()
defer m.snapMu.Unlock()
@@ -44,7 +45,7 @@ func (m *Manager) snapshotSoon(l *live, trigger api.SnapshotTrigger, seq int64)
if st.closed {
return
}
req := &snapRequest{trigger: trigger, seq: seq}
req := &snapRequest{trigger: trigger, seq: seq, review: review}
if st.running {
st.pending = req
return
@@ -64,7 +65,9 @@ func (m *Manager) runSnapshots(l *live, st *snapState, req *snapRequest) {
if err != nil {
slog.Error("take snapshot", "task", l.taskID, "trigger", req.trigger, "err", err)
}
go m.afterSnapshot(snap)
if req.review {
go m.afterSnapshot(snap)
}
}
st.mu.Unlock()
+9
View File
@@ -686,6 +686,15 @@ func (s *Store) SetMergingBy(ctx context.Context, id, login string) error {
})
}
func (s *Store) MergingBy(ctx context.Context, id string) (string, error) {
login := ""
err := s.db.QueryRowContext(ctx, `SELECT merging_by FROM tasks WHERE id = ?`, id).Scan(&login)
if errors.Is(err, sql.ErrNoRows) {
return "", ErrNotFound
}
return login, err
}
func (s *Store) TakeMergingBy(ctx context.Context, id string) (string, error) {
login := ""
err := s.write(ctx, func(tx *sql.Tx, emit emitFunc) error {