Skip to content

fix(session): make InMemorySessionStore.messageID increment atomic #3592

Description

@aheritier

Summary

pkg/session/store.go:137 is a plain int64 incremented at :284 with no atomic/mutex, while the store is hit concurrently (HTTP handlers + runtime PersistenceObserver). Lost increments → duplicate message IDs → UpdateMessage (searches by ID, store.go:290-314) can edit the wrong message.

Fix

Use atomic.Int64 (or a mutex) for the counter.

Acceptance

  • Concurrent AddMessage test asserts unique IDs; -race clean.

Metadata

Metadata

Assignees

Labels

area/runtimeRuntime engine, agent loop execution, tool dispatch, loop detectionarea/securityAuthentication, authorization, secrets, vulnerabilitiesarea/sessionsFor features/issues/fixes related to session lifecycle (resume, persistence, export)kind/fixPR fixes a bug (maps to fix:). Use on PRs only.

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions