Skip to content

[bug] SQLite session store not closed in API server #1672

@docker-agent

Description

@docker-agent

🟠 high - bug

File: cmd/root/api.go (line 104)

Code

rt, err := runtime.New(t,
    runtime.WithCurrentAgent(agentName),
)
if err != nil {
    return nil, ToolOutput{}, fmt.Errorf("failed to create runtime: %w", err)
}

Problem

Similar to the issue in run.go, the API server creates a new runtime.Runtime without properly closing it. This can lead to database connection leaks when the runtime internally creates a SQLiteSessionStore.

Suggested Fix

Implement proper resource cleanup by adding a Close() method to runtime.Runtime and deferring its call, ensuring that any internal SessionStore is properly closed after use.


Found by nightly codebase scan

Metadata

Metadata

Assignees

Labels

automatedIssues created by cagentkind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions