From 53511c5c6120032e23fa635fe65f91c80f2e6f6c Mon Sep 17 00:00:00 2001 From: Johannes du Plessis Date: Thu, 25 Jun 2026 14:11:21 -0700 Subject: [PATCH] feat: add PR trace resolution (#1612) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add PR trace resolution Co-authored-by: open-swe[bot] * fix: inject reviewer trace context as JSON Co-authored-by: open-swe[bot] * fix: address review on PR trace resolution Use the documented LangSmith metadata filter syntax (and(eq(metadata_key,...), eq(metadata_value,...))) instead of has(metadata, '{...}'), which does not match runs — _list_thread_runs was silently returning nothing. Bound full-text searches to a 90-day window so they don't hit LangSmith's large-window rate limit. Also folds in the best-effort branch->head-sha resolver (dropping the weighted scoring/threshold + repo/file evidence + GitHub hydration), sandbox JSON injection, and the admin "Resolve trace" dry-run endpoint. The IDOR findings are moot: resolve_pr_to_threads/summarize_agent_session were removed; resolution now runs deterministically from the trusted run config with no model-controlled pr_url or thread_id. * fix: scope branch trace search to the repo Branch names like fix-tests aren't unique across repos (or older PRs) in a shared tracing project, so an unscoped branch hit could resolve to an unrelated thread and write its runs into the reviewer sandbox. Require the repo slug to co-occur with the branch in matched runs; the full head SHA stays unscoped since it is globally unique. Addresses open-swe review on PR #1612. --------- Co-authored-by: open-swe[bot] (cherry picked from commit 69148f54f54f29ccf340de53a2c7932eea739def) --- agent/dashboard/team_settings.py | 1 - tests/test_team_settings_org_guidelines.py | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/dashboard/team_settings.py b/agent/dashboard/team_settings.py index bca2ab85..e81ff4b8 100644 --- a/agent/dashboard/team_settings.py +++ b/agent/dashboard/team_settings.py @@ -31,7 +31,6 @@ TEAM_SETTINGS_KEY = "default" # prompt. Generous enough for a detailed policy, small enough to stay bounded. ORG_GUIDELINES_MAX_CHARS = 10_000 REVIEW_TRACING_PROJECT_MAX_CHARS = 256 - # Sea Haven review baseline seeded as the org-wide guidelines default. Surfaces # in the reviewer prompt for every repo until an admin overrides it with a # non-empty value via the dashboard (PUT /team-settings). Keep it stack-agnostic diff --git a/tests/test_team_settings_org_guidelines.py b/tests/test_team_settings_org_guidelines.py index 561326cf..845d933d 100644 --- a/tests/test_team_settings_org_guidelines.py +++ b/tests/test_team_settings_org_guidelines.py @@ -43,6 +43,7 @@ def test_default_settings_seed_sea_haven_org_guidelines() -> None: assert len(DEFAULT_ORG_REVIEW_GUIDELINES) <= ORG_GUIDELINES_MAX_CHARS + def test_review_tracing_project_blank_normalizes_to_none() -> None: assert TeamSettingsUpdate(review_tracing_project=" ").review_tracing_project is None assert TeamSettingsUpdate(review_tracing_project=None).review_tracing_project is None