@devries-cameron20 / t3code-1 / commits / fd7d2aec5e
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(azure-devops): issue list no longer fails looking up the signed-in account (#38069)

Patryk Slowinski committed Nov 17, 2026 at 20:05 UTC fd7d2aec5e437eea0d644fe47c3645efcc7cb4b9
3 files changed +12 -43
packages/source-control-azure-devops/src/server/AzureDevOpsIssueTracker.test.ts
+9
@@ -290,6 +290,15 @@ describe("AzureDevOpsIssueTracker", () => {
290 }).pipe(Effect.provide(NodeFileSystem.layer)),
291 );
292
293 + it.effect("names the viewer without a request that a sign-in could refuse", () =>
294 + Effect.gen(function* () {
295 + const api = yield* tracker((args) => {
296 + throw new Error(`unexpected az invocation ${args.join(" ")}`);
297 + });
298 + expect(yield* api.getViewer({ cwd: "/w", host: "dev.azure.com" })).toBe("@Me");
299 + }),
300 + );
301 +
302 it.effect("refuses a scope that is not organization/project without a request", () =>
303 Effect.gen(function* () {
304 let requests = 0;
packages/source-control-azure-devops/src/server/AzureDevOpsIssueTracker.ts
+3 -28
@@ -26,7 +26,6 @@ import {
26 closedStateNames,
27 workItemStates,
28 decodeCommentsJson,
29 - decodeProfileJson,
29 decodeUpdatesJson,
30 decodeWorkItemJson,
31 decodeWorkItemsJson,
@@ -580,33 +579,9 @@ export const make: Effect.Effect<
579 kind: KIND,
580 capabilities: CAPABILITIES,
581
583 - // The profile the token belongs to, which is what WIQL's `@Me` resolves to. Its email is the
584 - // `uniqueName` every identity on a work item carries, so the two compare.
585 - getViewer: (input) =>
586 - read({
587 - cwd: input.cwd,
588 - operation: "getViewer",
589 - args: [
590 - "devops",
591 - "invoke",
592 - "--detect",
593 - "true",
594 - "--area",
595 - "profile",
596 - "--resource",
597 - "profiles",
598 - "--api-version",
599 - REST_API_VERSION,
600 - "--route-parameters",
601 - "id=me",
602 - ],
603 - decode: decodeProfileJson,
604 - }).pipe(
605 - Effect.filterOrFail(
606 - (login) => login !== null,
607 - () => refused("getViewer", "Azure DevOps could not name the signed-in account."),
608 - ),
609 - ),
582 + // Listing filters with WIQL's `@Me`, so nothing compares against a name. Looking one up
583 + // needs a profile host that a PAT saved for one organization cannot reach.
584 + getViewer: () => Effect.succeed("@Me"),
585
586 listIssues: Effect.fn("AzureDevOpsIssueTracker.listIssues")(function* (input) {
587 const cursor = input.cursor === undefined ? undefined : parseCursor(input.cursor);
packages/source-control-azure-devops/src/server/azureDevOpsIssueJson.ts
-15
@@ -425,18 +425,3 @@ export function pullRequestNumberOf(relation: typeof Relation.Type): number | nu
425 const number = decodeURIComponent(match[1]!).split("/").at(-1) ?? "";
426 return /^[1-9]\d{0,9}$/.test(number) ? Number(number) : null;
427 }
428 -
429 -const Profile = Schema.Struct({
430 - emailAddress: Schema.optional(Schema.NullOr(Schema.String)),
431 - displayName: Schema.optional(Schema.NullOr(Schema.String)),
432 -});
433 -
434 -const decodeProfile = decodeJsonResult(Profile);
435 -
436 -/** `GET profile/profiles/me` names the signed-in account, which WIQL's `@Me` compares against. */
437 -export function decodeProfileJson(raw: string): Result.Result<string | null, DecodeFailure> {
438 - return Result.map(
439 - decodeProfile(raw),
440 - (profile) => trimmed(profile.emailAddress) ?? trimmed(profile.displayName),
441 - );
442 -}