* 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
32 lines
1.5 KiB
Python
32 lines
1.5 KiB
Python
import pytest
|
|
|
|
from nanobot.agent.tools.session_messages import SendSessionMessageTool, SessionMessageError
|
|
from nanobot.bus.queue import MessageBus
|
|
from nanobot.session.manager import SessionManager
|
|
from nanobot.session.session_handles import SessionHandleResolver
|
|
|
|
|
|
async def test_session_send_rejects_commands_and_delivers_normal_input(tmp_path):
|
|
manager = SessionManager(tmp_path)
|
|
bus = MessageBus()
|
|
tool = SendSessionMessageTool(sessions=manager, bus=bus)
|
|
try:
|
|
await manager.state.get("websocket:source")
|
|
await manager.state.get("websocket:target")
|
|
handles = SessionHandleResolver(manager)
|
|
target = await handles.ahandle_for_session("websocket:target")
|
|
assert target is not None
|
|
for content in ("/stop", " /stop", "\n\t/restart", "/restart"):
|
|
with pytest.raises(SessionMessageError, match="slash commands"):
|
|
await tool.enqueue(source_session_key="websocket:source", target_handle=target.name,
|
|
content=content, expect_reply=False)
|
|
assert bus.inbound_size == 0
|
|
await tool.enqueue(source_session_key="websocket:source", target_handle=target.name,
|
|
content="Please review /restart", expect_reply=False)
|
|
message = await bus.consume_inbound()
|
|
assert message.content == "Please review /restart"
|
|
assert message.session_key == "websocket:target"
|
|
assert bus.inbound_size == 0
|
|
finally:
|
|
await manager.state.aclose()
|