fix(sessions): preserve cross-session input ownership and history (#6613)
* fix(webui): reconcile cross-session history by message ID * fix(sessions): preserve target authority and input ownership Resolve cross-session follow-ups through the target route, carry stable input IDs through admission and recovery, and associate live and replayed answers with the inputs actually consumed. Keep ordinary input scope isolation and omit historical anomaly repair. Resolves NAN-430. * fix(sessions): complete input identity integration across boundaries Carry input identity explicitly in projected input events, keep runner annotations out of public history, and reuse the canonical WebUI session parser during recovery. Type validated recovery metadata and align existing channel and subagent regressions with explicit response ownership. All nine failed compatibility cases and adjacent recovery coverage pass in a focused 58-test run. * fix(sessions): unify input recording and block remote commands * fix(webui): keep input ownership checks page-bounded Look up referenced inputs through the existing identity index before invoking transcript backfill. Complete pages no longer scan the full prompt history, including answers whose inputs live on earlier pages. Cover cold-cache pagination and cross-turn ownership in existing regressions. Focused pagination, replay and follow-up recovery checks: 88 passed. * fix(webui): preserve response ownership during history replay * fix: resolve strict typing in response replay * fix: preserve continuation ownership during recovery * test: diagnose stuck gateway asyncio shutdown * test: retain gateway thread stack diagnostics * test(webui): stabilize native autoscroll browser setup
This commit is contained in:
1 parent
0ce335bf12
commit
394a78e82d
51 files changed
+1412
-334
No files matched your search
@@ -311,8 +311,8 @@ async def test_session_input_is_projected_by_the_webui_coordinator(
|
||||
"source_session_key": "websocket:source",
|
||||
"target_session_key": "websocket:target",
|
||||
}
|
||||
append_input = AsyncMock(side_effect=None if write_succeeds else OSError("write failed"))
|
||||
monkeypatch.setattr(wth, "append_session_message_input", append_input)
|
||||
append_input = AsyncMock(return_value=write_succeeds)
|
||||
monkeypatch.setattr(wth.WebUITranscriptRecorder, "append_user_message", append_input)
|
||||
coordinator = wth.WebuiTurnCoordinator(
|
||||
bus=bus,
|
||||
sessions=sessions,
|
||||
@@ -345,6 +345,36 @@ async def test_session_input_is_projected_by_the_webui_coordinator(
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_session_input_rejects_replaced_target_generation(tmp_path) -> None:
|
||||
bus = MessageBus()
|
||||
bus.publish_outbound = AsyncMock()
|
||||
sessions = SessionManager(tmp_path)
|
||||
target = sessions.get_or_create("websocket:target")
|
||||
target.metadata["webui"] = True
|
||||
sessions.save(target)
|
||||
source = session_handle_for_name("websocket:source", "luma")
|
||||
coordinator = wth.WebuiTurnCoordinator(
|
||||
bus=bus, sessions=sessions, schedule_background=lambda coro: coro.close(),
|
||||
)
|
||||
coordinator.subscribe()
|
||||
await bus.publish(UserInputAccepted(
|
||||
context=RuntimeEventContext(
|
||||
channel="system", chat_id="websocket:target", session_key="websocket:target",
|
||||
session_generation="replaced-generation",
|
||||
metadata={SESSION_MESSAGE_METADATA_KEY: {
|
||||
"message_id": "message-1", "created_at_ms": 123, "expect_reply": False,
|
||||
"source_handle": source.name, "source_session_key": "websocket:source",
|
||||
"target_session_key": "websocket:target",
|
||||
}},
|
||||
),
|
||||
content="Review this",
|
||||
))
|
||||
bus.publish_outbound.assert_not_awaited()
|
||||
records = await sessions.state.project_history("websocket:target", lambda h: list(h.all_facts()))
|
||||
assert records == []
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_fallback_model_ignores_non_websocket_requests() -> None:
|
||||
bus = MessageBus()
|
||||
|
||||
Reference in new issue
Block a user