open-swe/agent/tools/report_platform_issue.py
Ramon Nogueira 9e86dec579
feat: add platform issue reporting tool (#1685)
Adapted from upstream langchain-ai/open-swe #1685 to the fork's
direct-import tool registry. Adds the report_platform_issue tool
(stdlib-only: returns a locally generated UUIDv7 report id, no external
network call) and wires it into get_agent's curated tool list.

Dropped upstream's test_task_retry_wraps_inside_tool_error_middleware
assertion, which references ToolRetryMiddleware that this fork does not
wire into the middleware stack.

(cherry picked from commit 88b62322b44103335773002d0745704cd96e9160)
2026-07-08 16:58:25 -04:00

16 lines
487 B
Python

import secrets
import time
import uuid
def _uuid7() -> str:
timestamp_ms = (time.time_ns() // 1_000_000) & ((1 << 48) - 1)
rand_a = secrets.randbits(12)
rand_b = secrets.randbits(62)
uuid_int = (timestamp_ms << 80) | (0x7 << 76) | (rand_a << 64) | (0b10 << 62) | rand_b
return str(uuid.UUID(int=uuid_int))
async def report_platform_issue() -> dict[str, str]:
"""Report an issue with the sandbox or execution environment."""
return {"report_id": _uuid7()}