Skip to content

Commit cd0aa8c

Browse files
committed
fix(agents): ShellToolMiddleware session lost on HIL resume
1 parent 5917732 commit cd0aa8c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libs/langchain_v1/langchain/agents/middleware/shell_tool.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,8 +677,10 @@ def _run_shell_tool(
677677
if payload.get("restart"):
678678
LOGGER.info("Restarting shell session on request.")
679679
try:
680-
session.restart()
680+
session.stop(self._execution_policy.termination_timeout)
681+
session.start()
681682
self._run_startup_commands(session)
683+
self._session = session
682684
except BaseException as err:
683685
LOGGER.exception("Restarting shell session failed; session remains unavailable.")
684686
msg = "Failed to restart shell session."

0 commit comments

Comments
 (0)