open-swe/tests/test_report_platform_issue_tool.py
Adam Moussa b65a99f3e9
feat: re-land scoped AGENTS auto-load (#1684) + platform issue reporting tool (#1685) (#129)
* feat: auto-load scoped AGENTS on reads (#1684)

Adapted from upstream langchain-ai/open-swe #1684 to the fork's
direct-import middleware registry and middleware stack ordering.
Adds SubdirAgentsReadMiddleware, which appends applicable ancestor
AGENTS.md instructions to read_file results once per run, so scoped
rules are visible before edits. Wired into get_agent immediately after
ToolErrorMiddleware, matching upstream's relative position.

Note: this changes file-read behavior for every main-agent run. The
reviewer graph uses its own leaner middleware stack and is unaffected.

(cherry picked from commit 7f7af71547be2199cea699284676f8ceefba7691)

* 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)

---------

Co-authored-by: Ramon Nogueira <ramon.nogueira@langchain.dev>
2026-07-08 18:52:01 -04:00

20 lines
553 B
Python

from __future__ import annotations
import uuid
async def test_report_platform_issue_returns_uuid7_report_id() -> None:
from agent.tools.report_platform_issue import report_platform_issue
result = await report_platform_issue()
assert set(result) == {"report_id"}
report_id = uuid.UUID(result["report_id"])
assert report_id.version == 7
assert report_id.variant == uuid.RFC_4122
def test_report_platform_issue_exported() -> None:
from agent.tools import report_platform_issue
assert callable(report_platform_issue)