Skip to content

Commit cbbe2ea

Browse files
authored
fix tmux action (#318)
1 parent 12adfc8 commit cbbe2ea

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

lagent/actions/tmux_action.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
``MarkTaskComplete`` emits a sentinel the orchestrator interprets as a
99
completion signal. The orchestrator (``Terminus2Agent``) implements the
1010
two-step confirmation handshake — the action itself is stateless.
11-
"""
1211
13-
"""Local tmux session wrapper.
1412
1513
Port of harbor's ``TmuxSession`` that drops the ``BaseEnvironment.exec``
1614
indirection and runs ``tmux`` as a local subprocess. Intended for use
@@ -25,7 +23,6 @@
2523
import subprocess
2624
import time
2725

28-
from __future__ import annotations
2926

3027
from lagent.actions.base_action import AsyncActionMixin, BaseAction, tool_api
3128
from lagent.schema import ActionReturn, ActionStatusCode

lagent/schema.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,16 @@ class ActionReturn:
5151
tool_call_id: Optional[str] = None
5252

5353
def format_result(self) -> str:
54-
"""Concatenate items in result."""
54+
"""Concatenate items in result, falling back to errmsg when result is empty."""
5555
result = []
5656
for item in self.result or []:
5757
if item['type'] == 'text':
5858
result.append(item['content'])
5959
else:
6060
result.append(f"[{item['type']}]({item['content']})")
6161
result = '\n'.join(result)
62+
if not result and self.errmsg:
63+
return self.errmsg
6264
return result
6365

6466

0 commit comments

Comments
 (0)