Use the shared implementer session constructor for forks
This commit is contained in:
+5
-15
@@ -186,24 +186,14 @@ func (m *Manager) fork(ctx context.Context, src api.Task, project api.Project, n
|
||||
return api.Task{}, "", err
|
||||
}
|
||||
|
||||
id := ids.New(ids.Session)
|
||||
err = m.store.CreateSession(ctx, api.AgentSession{
|
||||
Id: id,
|
||||
TaskId: t.Id,
|
||||
Vendor: srcSess.Vendor,
|
||||
Model: srcSess.Model,
|
||||
VendorSessionId: initialVendorSessionID(srcSess.Vendor),
|
||||
State: api.AgentSessionStateIdle,
|
||||
Role: api.Implementer,
|
||||
CreatedBy: creator.Login,
|
||||
CreatedAt: time.Now().UTC(),
|
||||
ForkedFrom: &srcSess.VendorSessionId,
|
||||
ForkedAt: &at,
|
||||
}, t.ProjectId)
|
||||
sess := sessionFor(t, creator, "", srcSess.Model)
|
||||
sess.ForkedFrom = &srcSess.VendorSessionId
|
||||
sess.ForkedAt = &at
|
||||
err = m.store.CreateSession(ctx, sess, t.ProjectId)
|
||||
if err != nil {
|
||||
return api.Task{}, "", fmt.Errorf("task %s created, but its agent session was not: %w", t.Id, err)
|
||||
}
|
||||
return t, id, nil
|
||||
return t, sess.Id, nil
|
||||
}
|
||||
|
||||
func forkPoint(events []api.Event, sessionID string, seq int64) string {
|
||||
|
||||
Reference in New Issue
Block a user