Add Merge & continue and Other… to ready cards
This commit is contained in:
@@ -63,6 +63,7 @@ type Manager struct {
|
||||
finishing map[string]bool
|
||||
handoffModel map[string]string
|
||||
mergeTurns map[string]mergeTurn
|
||||
landing map[string]landing
|
||||
|
||||
deliverMu sync.Mutex
|
||||
deliverLocks map[string]*sessionLock
|
||||
@@ -158,6 +159,7 @@ func New(st *store.Store, worktreeRoot, leadRoot, handsRoot, codexHome, antigrav
|
||||
finishing: map[string]bool{},
|
||||
handoffModel: map[string]string{},
|
||||
mergeTurns: map[string]mergeTurn{},
|
||||
landing: map[string]landing{},
|
||||
signals: make(chan []api.Event, 1024),
|
||||
snaps: map[string]*snapState{},
|
||||
merges: map[string]*projectMerge{},
|
||||
@@ -537,13 +539,32 @@ func (m *Manager) Usage(ctx context.Context) (Usage, error) {
|
||||
}
|
||||
|
||||
func (m *Manager) turn(ctx context.Context, sess api.AgentSession, task api.Task, actor, text string, images []string) (api.AgentSession, error) {
|
||||
err := transition(ctx, m.store, sess.Id, api.AgentSessionStateIdle, api.AgentSessionStateRunning, actor)
|
||||
err := m.startRunning(ctx, sess, task.Id, actor)
|
||||
if err != nil {
|
||||
return api.AgentSession{}, err
|
||||
}
|
||||
return m.launch(ctx, sess, task, actor, text, images)
|
||||
}
|
||||
|
||||
func (m *Manager) startRunning(ctx context.Context, sess api.AgentSession, taskID, actor string) error {
|
||||
held := fmt.Errorf("%w: held while this task merges and continues", ErrConflict)
|
||||
if m.heldForLanding(taskID, sess.Id) {
|
||||
return held
|
||||
}
|
||||
err := transition(ctx, m.store, sess.Id, api.AgentSessionStateIdle, api.AgentSessionStateRunning, actor)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if m.heldForLanding(taskID, sess.Id) {
|
||||
err = transition(ctx, m.store, sess.Id, api.AgentSessionStateRunning, api.AgentSessionStateIdle, actor)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return held
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Manager) launch(ctx context.Context, sess api.AgentSession, task api.Task, actor, text string, images []string) (api.AgentSession, error) {
|
||||
l, err := m.ensureLive(ctx, sess, task)
|
||||
if err == nil {
|
||||
@@ -1070,6 +1091,8 @@ func (m *Manager) turnEnded(ctx context.Context, l *live, res endResult) error {
|
||||
return m.reviewTurnEnded(ctx, l, res)
|
||||
}
|
||||
|
||||
defer m.endLanding(l.taskID, l.id)
|
||||
|
||||
m.mu.Lock()
|
||||
interrupted := l.interrupted
|
||||
rateLimited := l.rateLimited
|
||||
@@ -1091,11 +1114,11 @@ func (m *Manager) turnEnded(ctx context.Context, l *live, res endResult) error {
|
||||
m.endMergeTurn(l.id, false)
|
||||
}
|
||||
}()
|
||||
if !finished {
|
||||
err := git.AbortMerge(l.dir)
|
||||
if err != nil {
|
||||
slog.Error("abort unfinished merge", "session", l.id, "err", err)
|
||||
}
|
||||
}
|
||||
if (owner || m.landingBy(l.taskID, l.id) != "") && !finished {
|
||||
err := git.AbortMerge(l.dir)
|
||||
if err != nil {
|
||||
slog.Error("abort unfinished merge", "session", l.id, "err", err)
|
||||
}
|
||||
}
|
||||
unlock := func() {}
|
||||
|
||||
Reference in New Issue
Block a user