Problem
All SQLite operations in internal/store/sqlite.go use context.Background():
func (s *SQLiteStore) AppendEvent(event types.EventEnvelope) error {
_, err := s.db.ExecContext(context.Background(), ...)
This pattern repeats across all 22+ StateStore methods and 4 EventStore methods. HTTP request contexts (with cancellation, deadlines, trace IDs) are not propagated from handlers through the engine to the store layer.
Impact
- No cancellation: if an HTTP client disconnects, the SQLite query still runs to completion
- No deadlines: slow queries can block indefinitely (mitigated by SQLite's busy_timeout pragma, but not by request-level timeouts)
- No tracing: cannot correlate a slow DB operation back to the originating HTTP request
Expected
Pass context.Context from HTTP handlers through Engine methods to store operations. This requires:
- Adding
context.Context as the first parameter to all EventStore and StateStore interface methods
- Threading context through Engine's public methods (Decide, Report, ResolveApproval, etc.)
- Updating all callers in httpapi/router.go
Key code
internal/store/sqlite.go — all methods use context.Background()
internal/core/engine.go — Engine methods don't accept context
internal/httpapi/router.go — HTTP handlers have r.Context() but don't pass it
Problem
All SQLite operations in
internal/store/sqlite.gousecontext.Background():This pattern repeats across all 22+ StateStore methods and 4 EventStore methods. HTTP request contexts (with cancellation, deadlines, trace IDs) are not propagated from handlers through the engine to the store layer.
Impact
Expected
Pass
context.Contextfrom HTTP handlers through Engine methods to store operations. This requires:context.Contextas the first parameter to all EventStore and StateStore interface methodsKey code
internal/store/sqlite.go— all methods usecontext.Background()internal/core/engine.go— Engine methods don't accept contextinternal/httpapi/router.go— HTTP handlers haver.Context()but don't pass it