fix: include resolved repo in Linear prompt to prevent repo ambiguity (#1307)

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) <noreply@anthropic.com>
Co-authored-by: Johannes du Plessis <johannes@langchain.dev>
This commit is contained in:
ericness 2026-06-03 17:08:07 -05:00 • committed by GitHub
parent 27677c4949
commit 6b005cfb67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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"