Revert "refactor: remove legacy history and proxy migrations (#6518)"
This reverts commit cb3ba45317.
Keep JSONL history and legacy proxy migration available throughout 0.4.x. Mark their removal for 0.5.0 in code and release guidance, preserving later context graph, archive and recovery changes.
This commit is contained in:
1 parent
3918ece17f
commit
812b92d734
47 files changed
+1932
-204
No files matched your search
@@ -24,6 +24,14 @@ from nanobot.webui import history as history_module
|
||||
from nanobot.webui.recovery import RecoveryActionError, RecoveryCoordinator
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _isolate_webui_transcripts(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Recovery scans must discover only test-owned transcripts, not active user chats."""
|
||||
webui_dir = tmp_path / "isolated-webui"
|
||||
webui_dir.mkdir()
|
||||
monkeypatch.setattr(history_module, "get_webui_dir", lambda: webui_dir)
|
||||
|
||||
|
||||
def _persist(manager: SessionManager, session: Session) -> None:
|
||||
session.metadata["webui"] = True
|
||||
manager.save(session)
|
||||
@@ -118,19 +126,24 @@ async def test_materialized_interruption_can_continue_from_saved_context(
|
||||
@pytest.mark.asyncio
|
||||
async def test_transcript_only_interruption_is_discovered_without_materializing_completed_history(
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
webui_dir = tmp_path / "webui"
|
||||
webui_dir.mkdir()
|
||||
monkeypatch.setattr(history_module, "get_webui_dir", lambda: webui_dir)
|
||||
unfinished_key = "websocket:unfinished"
|
||||
completed_key = "websocket:completed"
|
||||
stored = SessionManager(tmp_path / "workspace")
|
||||
stored.append_history(unfinished_key, [history_module.fact_from_record(record) for record in (
|
||||
{"event": "user", "text": "keep going"},
|
||||
{"event": "message", "kind": "progress", "text": "Working"},
|
||||
)])
|
||||
stored.append_history(completed_key, [history_module.fact_from_record(record) for record in (
|
||||
{"event": "user", "text": "done"},
|
||||
{"event": "message", "text": "finished"},
|
||||
{"event": "turn_end"},
|
||||
)])
|
||||
(webui_dir / f"{SessionManager.safe_key(unfinished_key)}.jsonl").write_text(
|
||||
'{"event":"user","chat_id":"unfinished","text":"keep going"}\n'
|
||||
'{"event":"message","chat_id":"unfinished","kind":"progress","text":"Working"}\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
(webui_dir / f"{SessionManager.safe_key(completed_key)}.jsonl").write_text(
|
||||
'{"event":"user","chat_id":"completed","text":"done"}\n'
|
||||
'{"event":"message","chat_id":"completed","text":"finished"}\n'
|
||||
'{"event":"turn_end","chat_id":"completed"}\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
coordinator, bus, sessions = _coordinator(tmp_path / "workspace")
|
||||
|
||||
await coordinator.scan()
|
||||
|
||||
Reference in new issue
Block a user