diff --git a/apps/mobile/src/features/settings/SettingsSourceControlDetailRouteScreens.tsx b/apps/mobile/src/features/settings/SettingsSourceControlDetailRouteScreens.tsx index f368dcca2dfc..957cf17a2617 100644 --- a/apps/mobile/src/features/settings/SettingsSourceControlDetailRouteScreens.tsx +++ b/apps/mobile/src/features/settings/SettingsSourceControlDetailRouteScreens.tsx @@ -199,7 +199,7 @@ export function SettingsIssueTrackerRouteScreen({ diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json index 8777f08e663c..471e9b3569bf 100644 --- a/apps/mobile/src/i18n/translations/de.json +++ b/apps/mobile/src/i18n/translations/de.json @@ -3734,7 +3734,7 @@ "b725843fd45b74aa": "Anmeldedaten", "b239ba3ce2899a3e": "Oder verwende deine eigenen Anmeldedaten", "f0e6397ab4de588e": "Token", - "295392927d5c8a84": "Wähle für jedes Projekt ein oder mehrere {scope}s in {tracker}. Ihre Issues erscheinen neben denen des Repositorys, und Agenten legen neue Issues im ersten an.", + "ed83b25c71c98a20": "Wähle für jedes Projekt ein oder mehrere {scope}s in {tracker}. Ihre Issues erscheinen neben denen des Repositorys, und Agenten legen neue Issues im ersten an, sofern kein anderes verlangt wird.", "ce2136b36f87b655": "Verbinde diese Umgebung, um ihre Einstellungen zu ändern.", "a90a441fd0e08de7": "Diese Umgebung", "32fb83554cfd85b4": "Transkriptionsmodelle", diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json index dfe3a473fe24..c2a5a77243cd 100644 --- a/apps/mobile/src/i18n/translations/en.json +++ b/apps/mobile/src/i18n/translations/en.json @@ -3736,7 +3736,7 @@ "b725843fd45b74aa": "Credentials", "b239ba3ce2899a3e": "Or use your own credentials", "f0e6397ab4de588e": "Token", - "295392927d5c8a84": "Pick one or more {tracker} {scope}s for each project. Their issues list beside the repository's own, and agents file new issues in the first one.", + "ed83b25c71c98a20": "Pick one or more {tracker} {scope}s for each project. Their issues list beside the repository's own, and agents file new issues in the first one unless asked for another.", "ce2136b36f87b655": "Connect this environment to change its settings.", "a90a441fd0e08de7": "This environment", "32fb83554cfd85b4": "Transcription models", diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json index 05f58a63227d..6591e433501b 100644 --- a/apps/mobile/src/i18n/translations/es.json +++ b/apps/mobile/src/i18n/translations/es.json @@ -3729,7 +3729,7 @@ "b725843fd45b74aa": "Credenciales", "b239ba3ce2899a3e": "O usa tus propias credenciales", "f0e6397ab4de588e": "Token", - "295392927d5c8a84": "Elige uno o más {scope}s de {tracker} para cada proyecto. Sus issues aparecen junto a las del repositorio, y los agentes crean issues nuevas en el primero.", + "ed83b25c71c98a20": "Elige uno o más {scope}s de {tracker} para cada proyecto. Sus issues aparecen junto a las del repositorio, y los agentes crean issues nuevas en el primero, salvo que se les pida otro.", "ce2136b36f87b655": "Conecta este entorno para cambiar sus ajustes.", "a90a441fd0e08de7": "Este entorno", "32fb83554cfd85b4": "Modelos de transcripción", diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json index f661c315215c..e575fc623620 100644 --- a/apps/mobile/src/i18n/translations/fr.json +++ b/apps/mobile/src/i18n/translations/fr.json @@ -3729,7 +3729,7 @@ "b725843fd45b74aa": "Identifiants", "b239ba3ce2899a3e": "Ou utilisez vos propres identifiants", "f0e6397ab4de588e": "Jeton", - "295392927d5c8a84": "Choisissez un ou plusieurs {scope}s {tracker} pour chaque projet. Leurs tickets s'affichent à côté de ceux du dépôt, et les agents créent les nouveaux tickets dans le premier.", + "ed83b25c71c98a20": "Choisissez un ou plusieurs {scope}s {tracker} pour chaque projet. Leurs tickets s'affichent à côté de ceux du dépôt, et les agents créent les nouveaux tickets dans le premier, sauf si vous leur indiquez une autre destination.", "ce2136b36f87b655": "Connectez cet environnement pour modifier ses paramètres.", "a90a441fd0e08de7": "Cet environnement", "32fb83554cfd85b4": "Modèles de transcription", diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json index 56616809052d..ab85e1376d9a 100644 --- a/apps/mobile/src/i18n/translations/ja.json +++ b/apps/mobile/src/i18n/translations/ja.json @@ -3725,7 +3725,7 @@ "b725843fd45b74aa": "資格情報", "b239ba3ce2899a3e": "または自分の資格情報を使用", "f0e6397ab4de588e": "トークン", - "295392927d5c8a84": "各プロジェクトに {tracker} の {scope} を1つ以上選択します。その Issue はリポジトリ自身の Issue と並べて表示され、エージェントは最初の {scope} に新しい Issue を作成します。", + "ed83b25c71c98a20": "各プロジェクトに {tracker} の {scope} を1つ以上選択します。その Issue はリポジトリ自身の Issue と並べて表示され、エージェントは別の {scope} を指定されない限り、最初の {scope} に新しい Issue を作成します。", "ce2136b36f87b655": "設定を変更するには、この環境に接続してください。", "a90a441fd0e08de7": "この環境", "32fb83554cfd85b4": "文字起こしモデル", diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json index 443285f8664c..96be9755921d 100644 --- a/apps/mobile/src/i18n/translations/ko.json +++ b/apps/mobile/src/i18n/translations/ko.json @@ -3729,7 +3729,7 @@ "b725843fd45b74aa": "자격 증명", "b239ba3ce2899a3e": "또는 내 자격 증명 사용", "f0e6397ab4de588e": "토큰", - "295392927d5c8a84": "각 프로젝트에 {tracker} {scope}을(를) 하나 이상 선택하세요. 해당 이슈는 저장소 자체 이슈와 함께 표시되며, 에이전트는 첫 번째 {scope}에 새 이슈를 만듭니다.", + "ed83b25c71c98a20": "각 프로젝트에 {tracker} {scope}을(를) 하나 이상 선택하세요. 해당 이슈는 저장소 자체 이슈와 함께 표시되며, 에이전트는 다른 {scope}을(를) 지정받지 않으면 첫 번째 {scope}에 새 이슈를 만듭니다.", "ce2136b36f87b655": "설정을 변경하려면 이 환경에 연결하세요.", "a90a441fd0e08de7": "이 환경", "32fb83554cfd85b4": "받아쓰기 모델", diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json index 33793cc553d3..c404cf1cf140 100644 --- a/apps/mobile/src/i18n/translations/pt-BR.json +++ b/apps/mobile/src/i18n/translations/pt-BR.json @@ -3729,7 +3729,7 @@ "b725843fd45b74aa": "Credenciais", "b239ba3ce2899a3e": "Ou use suas próprias credenciais", "f0e6397ab4de588e": "Token", - "295392927d5c8a84": "Escolha um ou mais {scope}s do {tracker} para cada projeto. As issues deles aparecem ao lado das do repositório, e os agentes criam novas issues no primeiro.", + "ed83b25c71c98a20": "Escolha um ou mais {scope}s do {tracker} para cada projeto. As issues deles aparecem ao lado das do repositório, e os agentes criam novas issues no primeiro, a menos que outro seja pedido.", "ce2136b36f87b655": "Conecte este ambiente para alterar as configurações dele.", "a90a441fd0e08de7": "Este ambiente", "32fb83554cfd85b4": "Modelos de transcrição", diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json index d0e2d9577a9a..464ffebbf7ee 100644 --- a/apps/mobile/src/i18n/translations/ru.json +++ b/apps/mobile/src/i18n/translations/ru.json @@ -3783,7 +3783,7 @@ "b725843fd45b74aa": "Учётные данные", "b239ba3ce2899a3e": "Или используйте свои учётные данные", "f0e6397ab4de588e": "Токен", - "295392927d5c8a84": "Выберите один или несколько {scope} в {tracker} для каждого проекта. Их issue показываются рядом с issue репозитория, а агенты создают новые issue в первом.", + "ed83b25c71c98a20": "Выберите один или несколько {scope} в {tracker} для каждого проекта. Их issue показываются рядом с issue репозитория, а агенты создают новые issue в первом, если вы не укажете, где их создать.", "ce2136b36f87b655": "Подключите это окружение, чтобы изменить его настройки.", "a90a441fd0e08de7": "Это окружение", "32fb83554cfd85b4": "Модели расшифровки", diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json index 7fd2f945cc03..675267292800 100644 --- a/apps/mobile/src/i18n/translations/sv.json +++ b/apps/mobile/src/i18n/translations/sv.json @@ -3735,7 +3735,7 @@ "b725843fd45b74aa": "Autentiseringsuppgifter", "b239ba3ce2899a3e": "Eller använd dina egna autentiseringsuppgifter", "f0e6397ab4de588e": "Token", - "295392927d5c8a84": "Välj en eller flera {scope} i {tracker} för varje projekt. Deras ärenden listas bredvid repots egna, och agenter skapar nya ärenden i den första.", + "ed83b25c71c98a20": "Välj en eller flera {scope} i {tracker} för varje projekt. Deras ärenden listas bredvid repots egna, och agenter skapar nya ärenden i det första om de inte ombeds välja ett annat.", "ce2136b36f87b655": "Anslut den här miljön för att ändra dess inställningar.", "a90a441fd0e08de7": "Den här miljön", "32fb83554cfd85b4": "Transkriberingsmodeller", diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json index 54c72efe3b4f..abd1ba6c672c 100644 --- a/apps/mobile/src/i18n/translations/zh.json +++ b/apps/mobile/src/i18n/translations/zh.json @@ -3731,7 +3731,7 @@ "b725843fd45b74aa": "凭据", "b239ba3ce2899a3e": "或使用你自己的凭据", "f0e6397ab4de588e": "token", - "295392927d5c8a84": "为每个项目选择一个或多个 {tracker} {scope}。它们的 issue 会列在仓库自身的 issue 旁,智能体会在第一个中创建新 issue。", + "ed83b25c71c98a20": "为每个项目选择一个或多个 {tracker} {scope}。它们的 issue 会列在仓库自身的 issue 旁;除非另有指定,智能体会在第一个中创建新 issue。", "ce2136b36f87b655": "连接此环境以更改其设置。", "a90a441fd0e08de7": "此环境", "32fb83554cfd85b4": "转写模型", diff --git a/apps/server/src/issue/IssueService.test.ts b/apps/server/src/issue/IssueService.test.ts index a291d5bee11f..e8308b8480d0 100644 --- a/apps/server/src/issue/IssueService.test.ts +++ b/apps/server/src/issue/IssueService.test.ts @@ -699,7 +699,12 @@ describe("IssueService with a standalone tracker", () => { writable: false, }); expect((yield* bound.projectScope("web" as ProjectId)).scope).toBe("ENG"); - expect((yield* bound.projectScope("web" as ProjectId, "ops-12")).scope).toBe("OPS"); + expect((yield* bound.projectScope("web" as ProjectId, { key: "ops-12" })).scope).toBe("OPS"); + expect(yield* bound.projectScope("web" as ProjectId, { scope: "ACME/Web" })).toMatchObject({ + tracker: GITHUB, + host: "github.com", + scope: "acme/web", + }); expect( yield* bound.detail({ projectId: "web" as ProjectId, diff --git a/apps/server/src/issue/IssueService.ts b/apps/server/src/issue/IssueService.ts index a4483e222492..27499b240d65 100644 --- a/apps/server/src/issue/IssueService.ts +++ b/apps/server/src/issue/IssueService.ts @@ -158,10 +158,13 @@ export class IssueService extends Context.Service< readonly update: (input: IssueUpdateInput) => Effect.Effect; readonly setState: (input: IssueSetStateInput) => Effect.Effect; readonly react: (input: IssueReactionInput) => Effect.Effect; - /** The tracker and container a project's own issues live in, or the one `key` names. */ + /** + * The tracker and container a project's own issues live in: the bound `scope` when named, else + * the one `key`'s prefix names, else the project's default. + */ readonly projectScope: ( projectId: ProjectId, - key?: string, + select?: { readonly key?: string | undefined; readonly scope?: string | undefined }, ) => Effect.Effect; /** * Resolve through a matching project, preferring `preferredProjectId`; other scopes are read-only. @@ -678,14 +681,24 @@ const make = Effect.gen(function* () { const projectScope: IssueService["Service"]["projectScope"] = Effect.fn( "IssueService.projectScope", - )(function* (projectId, key) { + )(function* (projectId, select) { const { supported } = yield* listProjects({ projectId }); - const prefix = key?.toLowerCase(); + if (supported.length === 0) { + return yield* new IssueUnavailableError({ reason: "tracker-unsupported" }); + } + const named = select?.scope?.trim().toLowerCase(); + const prefix = select?.key?.toLowerCase(); const own = - supported.find((candidate) => prefix?.startsWith(`${candidate.scope.toLowerCase()}-`)) ?? - supported[0]; + named === undefined + ? (supported.find((candidate) => prefix?.startsWith(`${candidate.scope.toLowerCase()}-`)) ?? + supported[0]) + : supported.find((candidate) => candidate.scope.toLowerCase() === named); if (own === undefined) { - return yield* new IssueUnavailableError({ reason: "tracker-unsupported" }); + return yield* new IssueOperationError({ + operation: "scope", + reason: "not-found", + detail: `This project does not track ${select?.scope?.trim()}. Use one of: ${[...new Set(supported.map((candidate) => candidate.scope))].join(", ")}.`, + }); } return { projectId, tracker: own.tracker, host: own.host, scope: own.scope }; }); diff --git a/apps/server/src/mcp/toolkits/issues/handlers.test.ts b/apps/server/src/mcp/toolkits/issues/handlers.test.ts index 07f4b4e01920..143ba4a0c98a 100644 --- a/apps/server/src/mcp/toolkits/issues/handlers.test.ts +++ b/apps/server/src/mcp/toolkits/issues/handlers.test.ts @@ -278,6 +278,71 @@ describe("issue toolkit handlers", () => { }), ); + it.effect("files an issue in the bound Linear team an agent names", () => + Effect.gen(function* () { + const tracker = IssueTrackerKind.make("linear"); + const host = "linear.app"; + const filedIn = yield* Ref.make>([]); + const linear: StandaloneIssueTrackerApi = { + kind: tracker, + capabilities: detail.capabilities, + standalone: { + tracker, + displayName: "Linear", + host, + scopeNoun: "team", + credential: { label: "Personal API key", helpUrl: null }, + }, + parseIssueUrl: () => null, + probeCredential: () => Effect.succeed({ account: "user", scopes: [] }), + getViewer: () => Effect.succeed("user"), + listIssues: () => Effect.succeed({ items: [], nextCursor: null }), + getComments: () => Effect.succeed({ comments: [], nextCursor: null }), + getIssue: () => Effect.die("unused"), + create: ({ scope }) => + Ref.update(filedIn, (teams) => [...teams, scope]).pipe( + Effect.as({ + key: `${scope}-1`, + url: `https://linear.app/acme/issue/${scope}-1`, + displayKey: `${scope}-1`, + }), + ), + }; + const issueLayer = IssueService.layer.pipe( + Layer.provide( + Layer.mergeAll( + projectLayer, + Layer.mock(RepositoryIdentityResolver.RepositoryIdentityResolver)({}), + Layer.mock(IssueTrackerBindings.IssueTrackerBindingsRepository)({ + list: Effect.succeed( + new Map([[PROJECT_ID, { tracker, scope: "ENG", additionalScopes: ["OPS"] }]]), + ), + }), + Layer.succeed( + IssueTrackerRegistry.IssueTrackerRegistry, + IssueTrackerRegistry.fromTrackers([linear]), + ), + ), + ), + ); + const harness = yield* makeHarness([], issueLayer); + + expect( + yield* harness.call("create_issue", { title: "Backup ran twice", scope: "ops" }), + ).toMatchObject({ tracker, scope: "OPS", key: "OPS-1" }); + expect(yield* harness.call("create_issue", { title: "Label typo" })).toMatchObject({ + scope: "ENG", + key: "ENG-1", + }); + const unbound = yield* harness + .call("create_issue", { title: "Flaky test", scope: "QA" }) + .pipe(Effect.flip); + expect(unbound).toMatchObject({ _tag: "IssueOperationError", reason: "not-found" }); + expect(unbound.message).toContain("Use one of: ENG, OPS."); + expect(yield* Ref.get(filedIn)).toEqual(["OPS", "ENG"]); + }), + ); + it.effect("refuses a credential without the issues capability", () => Effect.gen(function* () { const harness = yield* makeHarness(); diff --git a/apps/server/src/mcp/toolkits/issues/handlers.ts b/apps/server/src/mcp/toolkits/issues/handlers.ts index 6b835ffb564f..b45b3d3dbd87 100644 --- a/apps/server/src/mcp/toolkits/issues/handlers.ts +++ b/apps/server/src/mcp/toolkits/issues/handlers.ts @@ -90,15 +90,17 @@ const make = Effect.gen(function* () { /** Where a key-only reference is read: the named project's tracker, or the caller's thread's. */ const requireProjectScope = Effect.fn("IssuesToolkit.requireProjectScope")(function* ( requested: ProjectId | undefined, - key?: string, + select?: { readonly key?: string | undefined; readonly scope?: string | undefined }, ) { // A named project skips the caller's thread, so the capability is checked here too. yield* McpInvocationContext.requireMcpCapability("issues"); const projectId = requested ?? (yield* callerThread())?.projectId; if (projectId === undefined) return yield* new IssueProjectRequiredError(); - return yield* issues - .projectScope(projectId, key) - .pipe(Effect.mapError(() => new IssueProjectNotFoundError({ projectId }))); + return yield* issues.projectScope(projectId, select).pipe( + Effect.catchTags({ + IssueUnavailableError: () => Effect.fail(new IssueProjectNotFoundError({ projectId })), + }), + ); }); /** @@ -116,7 +118,7 @@ const make = Effect.gen(function* () { return { ...resolved, url: input.url } satisfies ResolvedTarget; } if (input.key === undefined) return yield* new IssueTargetIncompleteError(); - const scope = yield* requireProjectScope(input.projectId, input.key); + const scope = yield* requireProjectScope(input.projectId, { key: input.key }); return { ...scope, key: input.key, @@ -231,7 +233,7 @@ const make = Effect.gen(function* () { ), create_issue: McpToolAccess.writesWithCapability((input) => Effect.gen(function* () { - const scope = yield* requireProjectScope(input.projectId); + const scope = yield* requireProjectScope(input.projectId, { scope: input.scope }); const created = yield* issues.create({ ...scope, title: input.title, diff --git a/apps/server/src/mcp/toolkits/issues/tools.ts b/apps/server/src/mcp/toolkits/issues/tools.ts index 20de86b1f9de..6af757999134 100644 --- a/apps/server/src/mcp/toolkits/issues/tools.ts +++ b/apps/server/src/mcp/toolkits/issues/tools.ts @@ -284,6 +284,11 @@ const CreateIssueTool = Tool.make("create_issue", { projectId: Schema.optional( ProjectId.annotate({ description: "Defaults to this thread's project." }), ), + scope: Schema.optional( + TrimmedNonEmptyString.annotate({ + description: "A bound team or repository, such as OPS. Defaults to the project's first.", + }), + ), title: TrimmedNonEmptyString.check(Schema.isMaxLength(1024)), body: Schema.optional(Schema.String.check(Schema.isMaxLength(65_536))), labels: Schema.optional(Schema.Array(TrimmedNonEmptyString).check(Schema.isMaxLength(50))), diff --git a/apps/server/src/provider/agentContextBudget.json b/apps/server/src/provider/agentContextBudget.json index e089e5a84218..139eba175bc8 100644 --- a/apps/server/src/provider/agentContextBudget.json +++ b/apps/server/src/provider/agentContextBudget.json @@ -1,5 +1,5 @@ { "claudeSystemAppendBytes": 6245, "codexAdditionalContextBytes": 7639, - "mcpToolListJsonBytes": 59026 + "mcpToolListJsonBytes": 59052 } diff --git a/apps/web/src/components/settings/IssueTrackerSettings.tsx b/apps/web/src/components/settings/IssueTrackerSettings.tsx index 1bf3e2466f83..72423aaf4ef6 100644 --- a/apps/web/src/components/settings/IssueTrackerSettings.tsx +++ b/apps/web/src/components/settings/IssueTrackerSettings.tsx @@ -297,7 +297,7 @@ function ProjectBindings({ diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 0e48b30d674d..f5f5d1aefb6c 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -8695,7 +8695,7 @@ "58e0e226493150e7": "Issue-Tracker konnten nicht geladen werden", "77cfcbde543df32d": "Details zu {tracker} ein-/ausblenden", "0083f65885c60156": "{tracker} trennen", - "295392927d5c8a84": "Wähle für jedes Projekt ein oder mehrere {scope}s in {tracker}. Ihre Issues erscheinen neben denen des Repositorys, und Agenten legen neue Issues im ersten an.", + "ed83b25c71c98a20": "Wähle für jedes Projekt ein oder mehrere {scope}s in {tracker}. Ihre Issues erscheinen neben denen des Repositorys, und Agenten legen neue Issues im ersten an, sofern kein anderes verlangt wird.", "19c2d5e81ff8f89a": "{tracker} {scope} für {project}", "68e061510b765772": "Nicht zugeordnet", "a2d95d39d3398bda": "Anmeldedaten abgelehnt", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index e5d8d3dc2ed2..3d55efbc1e82 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -8703,7 +8703,7 @@ "58e0e226493150e7": "Could not load issue trackers", "77cfcbde543df32d": "Toggle {tracker} details", "0083f65885c60156": "Disconnect {tracker}", - "295392927d5c8a84": "Pick one or more {tracker} {scope}s for each project. Their issues list beside the repository's own, and agents file new issues in the first one.", + "ed83b25c71c98a20": "Pick one or more {tracker} {scope}s for each project. Their issues list beside the repository's own, and agents file new issues in the first one unless asked for another.", "19c2d5e81ff8f89a": "{tracker} {scope} for {project}", "68e061510b765772": "Not bound", "a2d95d39d3398bda": "Credential rejected", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index 4a2868a7e97d..aea70aac74ab 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -8693,7 +8693,7 @@ "58e0e226493150e7": "No se pudieron cargar los gestores de issues", "77cfcbde543df32d": "Mostrar u ocultar detalles de {tracker}", "0083f65885c60156": "Desconectar {tracker}", - "295392927d5c8a84": "Elige uno o más {scope}s de {tracker} para cada proyecto. Sus issues aparecen junto a las del repositorio, y los agentes crean issues nuevas en el primero.", + "ed83b25c71c98a20": "Elige uno o más {scope}s de {tracker} para cada proyecto. Sus issues aparecen junto a las del repositorio, y los agentes crean issues nuevas en el primero, salvo que se les pida otro.", "19c2d5e81ff8f89a": "{scope} de {tracker} para {project}", "68e061510b765772": "Sin vincular", "a2d95d39d3398bda": "Credencial rechazada", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index a0962e52bed3..b587a1d4ade0 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -8694,7 +8694,7 @@ "58e0e226493150e7": "Impossible de charger les gestionnaires de tickets", "77cfcbde543df32d": "Afficher ou masquer les détails de {tracker}", "0083f65885c60156": "Déconnecter {tracker}", - "295392927d5c8a84": "Choisissez un ou plusieurs {scope}s {tracker} pour chaque projet. Leurs tickets s'affichent à côté de ceux du dépôt, et les agents créent les nouveaux tickets dans le premier.", + "ed83b25c71c98a20": "Choisissez un ou plusieurs {scope}s {tracker} pour chaque projet. Leurs tickets s'affichent à côté de ceux du dépôt, et les agents créent les nouveaux tickets dans le premier, sauf si vous leur indiquez une autre destination.", "19c2d5e81ff8f89a": "{scope} {tracker} pour {project}", "68e061510b765772": "Non lié", "a2d95d39d3398bda": "Identifiant refusé", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index 0c149c28fbe9..9e975a9f4897 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -8651,7 +8651,7 @@ "58e0e226493150e7": "Issue トラッカーを読み込めませんでした", "77cfcbde543df32d": "{tracker} の詳細を切り替え", "0083f65885c60156": "{tracker} を切断", - "295392927d5c8a84": "各プロジェクトに {tracker} の {scope} を1つ以上選択します。その Issue はリポジトリ自身の Issue と並べて表示され、エージェントは最初の {scope} に新しい Issue を作成します。", + "ed83b25c71c98a20": "各プロジェクトに {tracker} の {scope} を1つ以上選択します。その Issue はリポジトリ自身の Issue と並べて表示され、エージェントは別の {scope} を指定されない限り、最初の {scope} に新しい Issue を作成します。", "19c2d5e81ff8f89a": "{project} の {tracker} {scope}", "68e061510b765772": "未バインド", "a2d95d39d3398bda": "資格情報が拒否されました", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index c01191b387b4..b444049d9ae8 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -8654,7 +8654,7 @@ "58e0e226493150e7": "이슈 트래커를 불러올 수 없습니다", "77cfcbde543df32d": "{tracker} 세부 정보 전환", "0083f65885c60156": "{tracker} 연결 끊기", - "295392927d5c8a84": "각 프로젝트에 {tracker} {scope}을(를) 하나 이상 선택하세요. 해당 이슈는 저장소 자체 이슈와 함께 표시되며, 에이전트는 첫 번째 {scope}에 새 이슈를 만듭니다.", + "ed83b25c71c98a20": "각 프로젝트에 {tracker} {scope}을(를) 하나 이상 선택하세요. 해당 이슈는 저장소 자체 이슈와 함께 표시되며, 에이전트는 다른 {scope}을(를) 지정받지 않으면 첫 번째 {scope}에 새 이슈를 만듭니다.", "19c2d5e81ff8f89a": "{project}의 {tracker} {scope}", "68e061510b765772": "바인딩되지 않음", "a2d95d39d3398bda": "자격 증명 거부됨", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index 5feb95d75c3d..b538252c11eb 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -8693,7 +8693,7 @@ "58e0e226493150e7": "Não foi possível carregar os rastreadores de issues", "77cfcbde543df32d": "Mostrar ou ocultar detalhes de {tracker}", "0083f65885c60156": "Desconectar {tracker}", - "295392927d5c8a84": "Escolha um ou mais {scope}s do {tracker} para cada projeto. As issues deles aparecem ao lado das do repositório, e os agentes criam novas issues no primeiro.", + "ed83b25c71c98a20": "Escolha um ou mais {scope}s do {tracker} para cada projeto. As issues deles aparecem ao lado das do repositório, e os agentes criam novas issues no primeiro, a menos que outro seja pedido.", "19c2d5e81ff8f89a": "{scope} do {tracker} para {project}", "68e061510b765772": "Não vinculado", "a2d95d39d3398bda": "Credencial recusada", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index 65a8eede879f..06f0bc97be51 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -8695,7 +8695,7 @@ "58e0e226493150e7": "Не удалось загрузить issue-трекеры", "77cfcbde543df32d": "Показать или скрыть подробности {tracker}", "0083f65885c60156": "Отключить {tracker}", - "295392927d5c8a84": "Выберите один или несколько {scope} в {tracker} для каждого проекта. Их issue показываются рядом с issue репозитория, а агенты создают новые issue в первом.", + "ed83b25c71c98a20": "Выберите один или несколько {scope} в {tracker} для каждого проекта. Их issue показываются рядом с issue репозитория, а агенты создают новые issue в первом, если вы не укажете, где их создать.", "19c2d5e81ff8f89a": "{tracker} {scope} для {project}", "68e061510b765772": "Не привязано", "a2d95d39d3398bda": "Учётные данные отклонены", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index 081857c5dae8..fffe42724ac7 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -8701,7 +8701,7 @@ "58e0e226493150e7": "Kunde inte läsa in ärendehanterare", "77cfcbde543df32d": "Visa/dölj detaljer för {tracker}", "0083f65885c60156": "Koppla från {tracker}", - "295392927d5c8a84": "Välj en eller flera {scope} i {tracker} för varje projekt. Deras ärenden listas bredvid repots egna, och agenter skapar nya ärenden i den första.", + "ed83b25c71c98a20": "Välj en eller flera {scope} i {tracker} för varje projekt. Deras ärenden listas bredvid repots egna, och agenter skapar nya ärenden i det första om de inte ombeds välja ett annat.", "19c2d5e81ff8f89a": "{scope} i {tracker} för {project}", "68e061510b765772": "Inte kopplad", "a2d95d39d3398bda": "Autentiseringsuppgiften avvisades", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index 17d0dd6a9330..7406e7d474f9 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -8711,7 +8711,7 @@ "58e0e226493150e7": "无法加载 issue 跟踪器", "77cfcbde543df32d": "切换 {tracker} 详情", "0083f65885c60156": "断开 {tracker} 连接", - "295392927d5c8a84": "为每个项目选择一个或多个 {tracker} {scope}。它们的 issue 会列在仓库自身的 issue 旁,智能体会在第一个中创建新 issue。", + "ed83b25c71c98a20": "为每个项目选择一个或多个 {tracker} {scope}。它们的 issue 会列在仓库自身的 issue 旁;除非另有指定,智能体会在第一个中创建新 issue。", "19c2d5e81ff8f89a": "{project} 的 {tracker} {scope}", "68e061510b765772": "未绑定", "a2d95d39d3398bda": "凭据被拒绝", diff --git a/docs/user/source-control.md b/docs/user/source-control.md index c04060ba831a..cb8d252b9ab3 100644 --- a/docs/user/source-control.md +++ b/docs/user/source-control.md @@ -412,7 +412,7 @@ To list Linear issues beside a project's, connect Linear with an API key under Settings → Source control & issues, then pick one or more teams for that project there. Pick another team at any time to add it; uncheck every team to unbind the project. Each team's issues appear in the Linear group of the issue list, sorted with the rest by last update, and -each can be loaded further on its own. Agents file new issues in the first team picked. +each can be loaded further on its own. Agents file new issues in the first team picked unless you name another bound team. Select an issue to open it beside the list: description, comments, state changes, linked pull requests, labels, assignees, and reactions. Linked pull requests open in the same panel. You can diff --git a/evals/mcp-tool-use/cases/issues.ndjson b/evals/mcp-tool-use/cases/issues.ndjson index b3c33cef640e..16967ba5e17d 100644 --- a/evals/mcp-tool-use/cases/issues.ndjson +++ b/evals/mcp-tool-use/cases/issues.ndjson @@ -1,2 +1,4 @@ {"id":"work-on-issue-links-thread","area":"issues","kind":"bad","pattern":"Agent takes on a tracked issue without linking it to the thread","experience":"Agents linked pull requests but often left the issues they were working on unlinked.","privacy":"commit-safe","setup":{"role":"top","mocks":{"link_issue":{"projectId":"app","tracker":"github","host":"github.com","scope":"acme/app","key":"42","url":"https://github.com/acme/app/issues/42","alreadyLinked":false}},"world":{"repo":"acme/app","files":{"src/label.ts":"export const label = 'Setings';"},"issues":[{"url":"https://github.com/acme/app/issues/42","number":42,"title":"Typo in Settings label","body":"The Settings label says Setings.","state":"open"}],"pages":{"https://github.com/acme/app/issues/42":"Typo in Settings label\nThe Settings label says Setings."}},"context":"The current thread ID is issue-work-thread. Its project ID is app, configured for the GitHub repository acme/app."},"prompt":"Take on https://github.com/acme/app/issues/42. Investigate the Settings label typo, which says Setings, and propose the smallest fix.","expect":{"calls":[{"tool":"link_issue","argsAnyOf":[{"url":"https://github.com/acme/app/issues/42","threadId":null},{"url":"https://github.com/acme/app/issues/42","threadId":"issue-work-thread"},{"key":"42","url":null,"projectId":null,"threadId":null},{"key":"42","url":null,"projectId":null,"threadId":"issue-work-thread"},{"key":"42","url":null,"projectId":"app","threadId":null},{"key":"42","url":null,"projectId":"app","threadId":"issue-work-thread"},{"url":"https://github.com/acme/app/issues/42/","threadId":null},{"url":"https://github.com/acme/app/issues/42/","threadId":"issue-work-thread"}],"success":true}],"finalTextMust":["Setings","Settings"]},"source":{"pr":"https://github.com/pingdotgg/t3code/pull/38356"}} {"id":"read-only-issue-stays-unlinked","area":"issues","kind":"control","pattern":"Read-only issue lookup leaves thread links alone","experience":"An issue used for reference does not belong in the thread's work links.","privacy":"commit-safe","setup":{"role":"top","mocks":{"read_issue":{"url":"https://github.com/acme/app/issues/42","title":"Typo in Settings label","body":"The Settings label says Setings."}},"world":{"repo":"acme/app","issues":[{"url":"https://github.com/acme/app/issues/42","number":42,"title":"Typo in Settings label","body":"The Settings label says Setings.","state":"open"}],"pages":{"https://github.com/acme/app/issues/42":"Typo in Settings label\nThe Settings label says Setings."}}},"prompt":"Summarize https://github.com/acme/app/issues/42 so I can decide whether to take it on.","expect":{"notCalls":["link_issue","unlink_issue","create_issue","comment_on_issue","set_issue_state"],"finalTextMust":["Setings","Settings"]},"source":{"pr":"https://github.com/pingdotgg/t3code/pull/38356"}} +{"id":"create-issue-in-named-team","area":"issues","kind":"bad","pattern":"Agent asked to file in a bound team that is not the project's default","experience":"A project bound to several Linear teams filed every agent-created issue in its default team, even when the user named another bound team.","privacy":"commit-safe","setup":{"role":"top","mocks":{"create_issue":{"projectId":"app","tracker":"linear","host":"linear.app","scope":"OPS","key":"OPS-12","url":"https://linear.app/acme/issue/OPS-12","displayKey":"OPS-12"}},"world":{"repo":"acme/app","files":{"scripts/backup.sh":"#!/bin/sh\n# nightly backup\n"}},"context":"The current thread ID is issue-thread. Its project ID is app, for the GitHub repository acme/app. The project is also bound to the Linear teams ENG (its default) and OPS."},"prompt":"File an issue in our OPS Linear team: the nightly backup job ran twice on Nov 20. No need to investigate, just file it.","expect":{"calls":[{"tool":"create_issue","args":{"scope":"re:^\\s*[Oo][Pp][Ss]\\s*$"},"success":true}],"maxCalls":{"create_issue":1}},"source":{"pr":"https://github.com/pingdotgg/t3code/pull/40023"}} +{"id":"create-issue-default-team","area":"issues","kind":"control","pattern":"Agent files an issue without a team named","experience":"With no team named, an issue belongs in the project's default team.","privacy":"commit-safe","setup":{"role":"top","mocks":{"create_issue":{"projectId":"app","tracker":"linear","host":"linear.app","scope":"ENG","key":"ENG-31","url":"https://linear.app/acme/issue/ENG-31","displayKey":"ENG-31"}},"world":{"repo":"acme/app","files":{"src/label.ts":"export const label = 'Setings';"}},"context":"The current thread ID is issue-thread. Its project ID is app, for the GitHub repository acme/app. The project is also bound to the Linear teams ENG (its default) and OPS."},"prompt":"File an issue: the Settings label in the app says Setings. No need to fix it, just file it.","expect":{"calls":[{"tool":"create_issue","argsAnyOf":[{"scope":null},{"scope":"re:^\\s*[Ee][Nn][Gg]\\s*$"}],"success":true}],"maxCalls":{"create_issue":1}},"source":{"pr":"https://github.com/pingdotgg/t3code/pull/40023"}} diff --git a/scripts/scenarios/linear-settings-name-another-team.e2e.ts b/scripts/scenarios/linear-settings-name-another-team.e2e.ts new file mode 100644 index 000000000000..32f18c883ab8 --- /dev/null +++ b/scripts/scenarios/linear-settings-name-another-team.e2e.ts @@ -0,0 +1,59 @@ +// @effect-diagnostics-next-line nodeBuiltinImport:off - a fake Linear API for the server to call +import * as NodeHttp from "node:http"; + +import { expect } from "e2e"; + +import { SCENARIO_LINEAR_PORT } from "./start-app.ts"; +import { test, WEB } from "./t3.ts"; + +// Connecting reads only the viewer, the workspace and its teams. +const VIEWER = { + data: { + viewer: { + id: "user-1", + name: "Scenario User", + displayName: "scenario", + email: "user@example.com", + avatarUrl: null, + }, + organization: { urlKey: "acme" }, + teams: { + nodes: [ + { id: "team-eng", key: "ENG", name: "Engineering" }, + { id: "team-ops", key: "OPS", name: "Operations" }, + ], + }, + }, +}; + +test( + "Linear settings say agents can file new issues in another bound team", + WEB, + async ({ t3, app, browser, screen }) => { + const linear = NodeHttp.createServer((_request, response) => { + response.writeHead(200, { "content-type": "application/json" }); + response.end(JSON.stringify(VIEWER)); + }); + await new Promise((resolve) => linear.listen(SCENARIO_LINEAR_PORT, "127.0.0.1", resolve)); + try { + await t3.project("demo"); + await t3.open("/settings/source-control"); + + await screen.getByRole("button", "Toggle Linear details").tap(); + await browser.locator('input[id^="issue-tracker-linear-"]').fill("lin_api_scenario"); + await browser.keyboard.press("Enter"); + await expect( + screen.getByText("Pick one or more Linear teams for each project", { exact: false }), + ).toBeVisible(); + await app.screenshot("linear-projects"); + + await expect( + screen.getByText("agents file new issues in the first one unless asked for another", { + exact: false, + }), + ).toBeVisible(); + } finally { + await new Promise((resolve) => linear.close(resolve)); + } + }, +); diff --git a/scripts/scenarios/start-app.ts b/scripts/scenarios/start-app.ts index 5dc7de246099..d635f1ba0fd6 100644 --- a/scripts/scenarios/start-app.ts +++ b/scripts/scenarios/start-app.ts @@ -39,9 +39,13 @@ const REAL_PROVIDERS = [ ]; /** Captures must not depend on, or show, the machine that made them. */ +/** Where a scenario serves a fake Linear API; nothing listens there unless one does. */ +export const SCENARIO_LINEAR_PORT = 13_997; + export const SCENARIO_MACHINE_ENV = { T3CODE_ENVIRONMENT_LABEL: "Scenario", T3CODE_ENVIRONMENT_MACHINE_KIND: "laptop", + T3CODE_LINEAR_API_URL: `http://127.0.0.1:${SCENARIO_LINEAR_PORT}/graphql`, }; const encodeSettings = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));