From 6b005cfb67fd7d8201a12f19ac13bbf9d40c7f23 Mon Sep 17 00:00:00 2001 From: ericness Date: Wed, 3 Jun 2026 17:08:07 -0500 Subject: [PATCH] fix: include resolved repo in Linear prompt to prevent repo ambiguity (#1307) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Linear webhook (`process_linear_issue` in `agent/webapp.py`) was the only trigger whose user prompt did not surface the resolved repo to the LLM: - Slack: `## Default Repository Hint` (line 947) - GitHub issue: `## Repository: ...` (`build_github_issue_prompt`, line 1443) - GitHub PR: `## Repository: ...` (`build_github_pr_review_prompt`, line 1526) - Linear: (missing) `configurable["repo"]` was still being set and consumed by `commit_and_open_pr`, but the agent itself never saw it. For tasks routed via Linear team/project mapping, the LLM had to guess which repo to clone — frequently falling back to `langchain-ai/open-swe` (via `SELF_AWARENESS_SECTION` in `agent/prompt.py`) or `langchain-ai/langchainplus` (via `default_prompt.md`), silently targeting the wrong repository. This is a regression: commit 5e4c6bb8 on branch `yogesh/stop-auto-cloning` ("fix: include resolved repo in Linear prompt to prevent repo ambiguity", 2026-03-16) added this exact line, but it was dropped when that branch was squash-merged as PR #1159 ("feat: stop auto-cloning and let agent manage repo setup", 2039fe66, 2026-04-10). Subsequent refactors (e215f1ef, f662ad65) preserved the gap. Adding the line back mirrors the GitHub/Slack prompt builders and matches the rationale of e215f1ef ("Linear team/project mapping handles per-team routing"): routing is correct, the prompt just wasn't propagating it. Co-authored-by: Claude Opus 4.7 (1M context) Co-authored-by: Johannes du Plessis --- agent/webapp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/agent/webapp.py b/agent/webapp.py index 85de78d5..7e12299e 100644 --- a/agent/webapp.py +++ b/agent/webapp.py @@ -774,6 +774,7 @@ async def process_linear_issue( # noqa: PLR0912, PLR0915 ) prompt = ( f"Please work on the following issue:\n\n" + f"## Repository: {repo_config.get('owner')}/{repo_config.get('name')}\n\n" f"## Title: {title}\n\n" f"{triggered_by_line}" f"## Linear Ticket: {identifier} - Ticket ID: {issue_id}\n\n"