A terminal panel beside an agent chat
A real shell on the chat's own connection, opened and closed like the inspector and never beside it. The modes govern the model; what a person types is theirs, since they hold the credential and could open the same shell with an ssh client. The model cannot see the panel -- a button copies the output you choose into the composer. The session outlives the socket: closing the panel leaves a build running, and coming back reattaches with the scrollback. Two tabs share one shell and the smaller window decides the size. It ends on an idle timeout, on deleting the chat, on disabling, moving or deleting the connection, and on a restart -- which says why rather than quietly opening a fresh shell that has lost the working directory. The nginx template's `Connection ""` is right for SSE and fails every WebSocket handshake, so `location /` now uses a `map $http_upgrade`; update.sh grows a drift check for it, because the only symptom on a stale vhost is a panel that cannot connect. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -80,6 +80,28 @@ def fresh_generation_registry() -> Iterator[None]:
|
||||
generation_service._TASKS.clear()
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def fresh_terminal_registry() -> Iterator[None]:
|
||||
"""Empty the open-shell registry between tests, for the same reason.
|
||||
|
||||
A leaked entry holds an asyncssh connection belonging to an event loop that
|
||||
has since closed, and the reaper task is module-level too -- one left
|
||||
running would wake up inside the next test's loop.
|
||||
"""
|
||||
from lembas.services.agent import terminal as terminal_service
|
||||
|
||||
def _clear() -> None:
|
||||
reaper = terminal_service._REAPER
|
||||
if reaper is not None:
|
||||
reaper.cancel()
|
||||
terminal_service._REAPER = None
|
||||
terminal_service._SESSIONS.clear()
|
||||
|
||||
_clear()
|
||||
yield
|
||||
_clear()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def db() -> Iterator[Session]:
|
||||
session = get_session_factory()()
|
||||
|
||||
Reference in New Issue
Block a user