Skip to content

[bug] SQLite session store not closed #1671

@docker-agent

Description

@docker-agent

🟠 high - bug

File: cmd/root/run.go (line 308)

Code

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

Problem

The runtime.New function can potentially create a SQLiteSessionStore internally. Since there is no explicit Close() call on the rt object or the underlying session store, database connections will accumulate and leak, leading to resource exhaustion and potential system instability.

Suggested Fix

Add a Close() method to the runtime.Runtime interface and defer its call after creating the runtime, or explicitly create and close the SessionStore. The Close() method should be responsible for closing the internal SessionStore.


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