Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/framework/runtime/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from framework.observability import set_trace_context
from framework.schemas.decision import Decision, DecisionType, Option, Outcome
from framework.schemas.run import Run, RunStatus
from framework.storage.backend import FileStorage
from framework.storage.concurrent import ConcurrentStorage

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -62,7 +62,7 @@ def __init__(self, storage_path: str | Path):
logger.warning(f"Storage path does not exist, creating: {path}")
path.mkdir(parents=True, exist_ok=True)

self.storage = FileStorage(storage_path)
self.storage = ConcurrentStorage(storage_path)
self._current_run: Run | None = None
self._current_node: str = "unknown"

Expand Down Expand Up @@ -132,8 +132,8 @@ def end_run(
self._current_run.output_data = output_data or {}
self._current_run.complete(status, narrative)

# Save to storage
self.storage.save_run(self._current_run)
# Save to storage (sync — Runtime methods are not async)
self.storage.save_run_sync(self._current_run)
Comment on lines +135 to +136

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

end_run() now routes completed runs into a no-op API.

ConcurrentStorage.save_run_sync() currently just warns and returns, so this change discards every finished run before _current_run is cleared. Please persist through the real session-store path, or keep a synchronous writer here until the runtime stops depending on ConcurrentStorage.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/framework/runtime/core.py` around lines 135 - 136, end_run() is
currently calling self.storage.save_run_sync(self._current_run) which routes
completed runs into ConcurrentStorage.save_run_sync (a no-op), causing finished
runs to be discarded before _current_run is cleared; change end_run() to persist
to the real session-store path (or use a synchronous writer) instead of relying
on ConcurrentStorage: locate end_run in core.runtime.core, and replace the call
to storage.save_run_sync/_current_run with a direct synchronous write to the
session-store implementation (or invoke the concrete SessionStore.save_run_sync
method) so that completed runs are persisted immediately before clearing
self._current_run; ensure you reference and call the concrete session-store API
used elsewhere in the runtime rather than ConcurrentStorage.save_run_sync.

self._current_run = None

def set_node(self, node_id: str) -> None:
Expand Down
4 changes: 2 additions & 2 deletions core/framework/storage/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Storage backends for runtime data."""

from framework.storage.backend import FileStorage
from framework.storage.concurrent import ConcurrentStorage
from framework.storage.conversation_store import FileConversationStore

__all__ = ["FileStorage", "FileConversationStore"]
__all__ = ["ConcurrentStorage", "FileConversationStore"]
266 changes: 0 additions & 266 deletions core/framework/storage/backend.py

This file was deleted.

Loading
Loading