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
|
return api.Task{}, "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
id := ids.New(ids.Session)
|
sess := sessionFor(t, creator, "", srcSess.Model)
|
||||||
err = m.store.CreateSession(ctx, api.AgentSession{
|
sess.ForkedFrom = &srcSess.VendorSessionId
|
||||||
Id: id,
|
sess.ForkedAt = &at
|
||||||
TaskId: t.Id,
|
err = m.store.CreateSession(ctx, sess, t.ProjectId)
|
||||||
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)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return api.Task{}, "", fmt.Errorf("task %s created, but its agent session was not: %w", t.Id, err)
|
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 {
|
func forkPoint(events []api.Event, sessionID string, seq int64) string {
|
||||||
|
|||||||
Reference in New Issue
Block a user