fix(agent): resolve message media against active workspace

Made-with: Cursor
This commit is contained in:
Xubin Ren
2026-04-27 14:31:39 +08:00
committed by Xubin Ren
parent 9b3e2524ac
commit 9b6f3d7abc
3 changed files with 25 additions and 2 deletions
+20
View File
@@ -110,6 +110,26 @@ async def test_message_tool_resolves_relative_media_paths() -> None:
assert sent[0].media == [expected]
@pytest.mark.asyncio
async def test_message_tool_resolves_relative_media_paths_from_active_workspace(tmp_path) -> None:
sent: list[OutboundMessage] = []
async def _send(msg: OutboundMessage) -> None:
sent.append(msg)
workspace = tmp_path / "workspace"
tool = MessageTool(send_callback=_send, workspace=workspace)
await tool.execute(
content="see attached",
channel="telegram",
chat_id="1",
media=["output/image.png"],
)
assert sent[0].media == [str(workspace / "output/image.png")]
@pytest.mark.asyncio
async def test_message_tool_passes_through_absolute_media_paths() -> None:
sent: list[OutboundMessage] = []