open-swe/agent/utils/dashboard_links.py
Ramon Nogueira d2268871eb
feat: surface dashboard UI link on PR reviews [INF-0000] (#1440)
* feat(reviewer): surface dashboard UI link on PR reviews [INF-0000]

Post a transient "review in progress" comment (with an "Open in Web"
dashboard link) when a reviewer run starts, then delete it once the
review lands. The published review body now carries the same
"Open in Web" link, so the link persists on the review itself.

The transient comment's id is tracked in reviewer thread metadata
(status_comment_id) so it can be deleted on completion.

* refactor(reviewer): inline dashboard URL helper, drop redundant future import [INF-0000]
2026-06-07 05:17:09 +00:00

14 lines
501 B
Python

"""Shared builders for dashboard ("Open in Web") URLs."""
import os
from urllib.parse import quote
_DEFAULT_DASHBOARD_BASE_URL = "https://openswe.vercel.app"
def dashboard_thread_url(thread_id: str) -> str | None:
"""Build the dashboard thread URL for a given thread id."""
base_url = os.environ.get("DASHBOARD_BASE_URL", _DEFAULT_DASHBOARD_BASE_URL).strip().rstrip("/")
if not base_url or not thread_id:
return None
return f"{base_url}/agents/{quote(thread_id, safe='')}"