(ctx context.Context, loaded *teamloader.LoadResult, req runtime.CreateSessionRequest)
| 107 | } |
| 108 | |
| 109 | func (b *localBackend) CreateSession(ctx context.Context, loaded *teamloader.LoadResult, req runtime.CreateSessionRequest) (runtime.Runtime, *session.Session, func(), error) { |
| 110 | store, err := b.sessionStore(ctx, req) |
| 111 | if err != nil { |
| 112 | stopToolSets(ctx, loaded.Team) |
| 113 | return nil, nil, nil, err |
| 114 | } |
| 115 | |
| 116 | rt, sess, err := b.flags.createLocalRuntimeAndSession(ctx, loaded, req, store) |
| 117 | if err != nil { |
| 118 | stopToolSets(ctx, loaded.Team) |
| 119 | return nil, nil, nil, err |
| 120 | } |
| 121 | |
| 122 | var once sync.Once |
| 123 | cleanup := func() { |
| 124 | once.Do(func() { |
| 125 | stopToolSets(ctx, loaded.Team) |
| 126 | if err := rt.Close(); err != nil { |
| 127 | slog.ErrorContext(ctx, "Failed to close runtime", "error", err) |
| 128 | } |
| 129 | }) |
| 130 | } |
| 131 | return rt, sess, cleanup, nil |
| 132 | } |
| 133 | |
| 134 | func (b *localBackend) Spawner(rt runtime.Runtime) tui.SessionSpawner { |
| 135 | return b.flags.createSessionSpawner(b.agentSource, rt.SessionStore()) |
nothing calls this directly
no test coverage detected