File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
libs/langchain_v1/langchain/agents/middleware Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -677,10 +677,17 @@ def _run_shell_tool(
677677 if payload .get ("restart" ):
678678 LOGGER .info ("Restarting shell session on request." )
679679 try :
680- session .stop (self ._execution_policy .termination_timeout )
681- session .start ()
682- self ._run_startup_commands (session )
683- self ._session = session
680+ session .stop (self ._execution_policy .termination_timeout )
681+ new_session = ShellSession (
682+ session ._workspace ,
683+ self ._execution_policy ,
684+ self ._shell_command ,
685+ self ._environment or {},
686+ )
687+ new_session .start ()
688+ self ._run_startup_commands (new_session )
689+ self ._session = new_session
690+ resources .session = new_session
684691 except BaseException as err :
685692 LOGGER .exception ("Restarting shell session failed; session remains unavailable." )
686693 msg = "Failed to restart shell session."
You can’t perform that action at this time.
0 commit comments