Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions verifiers/v1/mcp/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,15 @@ async def _install_in_sandbox(server: ServerBase, runtime: Runtime) -> str:


async def log_tail(runtime: Runtime, log: str, limit: int = 2000) -> str:
"""The tail of a program's `log` file in `runtime`, empty if it can't be read — for
"""The last `limit` bytes of a program's `log` in `runtime`, empty if it can't be read — for
enriching an error with what the program (e.g. a tool server) wrote before it died."""
if limit <= 0:
return ""
with contextlib.suppress(Exception):
return (await runtime.read(log)).decode(errors="replace").strip()[-limit:]
# Tail in place so a large remote log never crosses into host memory in full.
result = await runtime.run(["tail", "-c", str(limit), log], {})
if result.exit_code == 0:
return result.stdout
return ""


Expand Down
Loading