Skip to content

[Bug]: Refreshing Issues misses Azure DevOps work items in a new completed state #38985

Closed

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

Not sure

Steps to reproduce

  1. In T3 Code, open Issues for a project linked to Azure DevOps.
  2. Select Closed under Filters → State and wait for the list to load.
  3. In Azure DevOps, add a custom Completed state for a work item type in the project's inherited process.
  4. Move an open work item of that type into the new state.
  5. Within ten minutes of loading the list, click Refresh issues in T3 Code.

Expected behavior

The work item appears in Closed after the refresh.

Actual behavior

The work item is still missing from Closed.

closed issues after workflow change

failure

Impact

Minor bug or occasional failure. People browsing Azure DevOps issues can miss newly completed work until the workflow cache expires after a process change.

Version or commit

main at 8cf97b5f06. The cause is at packages/source-control-azure-devops/src/server/AzureDevOpsIssueTracker.ts:617.

Environment

Linux x64 boat.dev default machine, a fresh checkout.

Logs or stack traces

Verify the release package
Automated repro

Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.

diff --git a/scripts/scenarios/issues-refresh-reads-new-azure-state.e2e.ts b/scripts/scenarios/issues-refresh-reads-new-azure-state.e2e.ts
new file mode 100644
index 0000000000..d8b7173938
--- /dev/null
+++ b/scripts/scenarios/issues-refresh-reads-new-azure-state.e2e.ts
@@ -0,0 +1,124 @@
+import { expect } from "e2e";
+import * as Effect from "effect/Effect";
+import * as FileSystem from "effect/FileSystem";
+import * as Path from "effect/Path";
+
+import { T3_HOME } from "../e2e.config.ts";
+import { run } from "./shell.ts";
+import { makeState, runPromise, test, WEB } from "./t3.ts";
+
+// Stand in for the Azure CLI upstream. The real tracker builds WIQL and decodes its rows.
+const azureCli = String.raw`#!/usr/bin/env node
+import { existsSync, readFileSync } from "node:fs";
+
+const args = process.argv.slice(2);
+const argument = (name) => args[args.indexOf(name) + 1];
+const changed = existsSync(new URL("./workflow-changed", import.meta.url));
+const bugFinished = changed ? "Released" : "Done";
+const item = (id, type, title, state) => ({
+  id,
+  url: "https://dev.azure.com/scenario/_apis/wit/workItems/" + id,
+  fields: {
+    "System.Title": title,
+    "System.State": state,
+    "System.TeamProject": "Release",
+    "System.WorkItemType": type,
+    "System.CreatedDate": "2026-10-01T00:00:00Z",
+    "System.ChangedDate": "2026-10-02T00:00:00Z",
+  },
+});
+const items = [
+  item(7, "Bug", "Verify the release package", changed ? "Released" : "Active"),
+  item(6, "Task", changed ? "Release notes checked" : "Release notes drafted", "Closed"),
+];
+let output;
+switch (argument("--resource")) {
+  case "workitemtypes":
+    output = { value: [
+      { name: "Bug", states: [
+        { name: "Active", category: "InProgress" },
+        { name: bugFinished, category: "Completed" },
+      ] },
+      { name: "Task", states: [{ name: "Closed", category: "Completed" }] },
+    ] };
+    break;
+  case "wiql": {
+    const { query } = JSON.parse(readFileSync(argument("--in-file"), "utf8"));
+    const clause = /\[System\.State\] (NOT )?IN \(([^)]+)\)/.exec(query);
+    const names = clause?.[2].match(/'[^']*'/g) ?? [];
+    output = { workItems: items.filter((item) => {
+      if (!clause) return true;
+      const listed = names.includes("'" + item.fields["System.State"].toLowerCase() + "'");
+      return clause[1] ? !listed : listed;
+    }).map(({ id }) => ({ id })) };
+    break;
+  }
+  case "workitemsbatch": {
+    const { ids } = JSON.parse(readFileSync(argument("--in-file"), "utf8"));
+    output = { value: items.filter(({ id }) => ids.includes(id)) };
+    break;
+  }
+  default:
+    if (args[0] === "repos" && args[1] === "show") {
+      output = {
+        name: "release",
+        project: { name: "Release" },
+        webUrl: "https://dev.azure.com/scenario/Release/_git/release",
+        remoteUrl: "https://dev.azure.com/scenario/Release/_git/release",
+        sshUrl: "[email protected]:v3/scenario/Release/release",
+      };
+      break;
+    }
+    process.exit(1);
+}
+console.log(JSON.stringify(output));
+`;
+
+test(
+  "Refreshing Closed issues picks up a new Azure DevOps finished state",
+  WEB,
+  async ({ t3, app, screen }) => {
+    const workspace = await t3.project("demo");
+    const { repository, changed } = await runPromise(
+      Effect.gen(function* () {
+        const path = yield* Path.Path;
+        const fs = yield* FileSystem.FileSystem;
+        const shim = path.join(T3_HOME, "bin", "az");
+        yield* fs.writeFileString(shim, azureCli);
+        yield* fs.chmod(shim, 0o755);
+        return {
+          repository: path.join(T3_HOME, "release"),
+          changed: path.join(T3_HOME, "bin", "workflow-changed"),
+        };
+      }),
+    );
+    await runPromise(run("git", ["clone", "--quiet", workspace, repository]));
+    await runPromise(
+      run(
+        "git",
+        ["remote", "set-url", "origin", "https://dev.azure.com/scenario/Release/_git/release"],
+        {
+          cwd: repository,
+        },
+      ),
+    );
+    const primary = makeState(T3_HOME);
+    await runPromise(primary.cli(["project", "add", repository, "--title", "Release"]));
+    try {
+      await t3.open("/issues?status=closed");
+      // The initial Closed list warms the workflow cache.
+      await screen.getByText("Release notes drafted", { exact: true }).waitFor({ timeout: 60_000 });
+      await runPromise(
+        Effect.flatMap(FileSystem.FileSystem, (fs) => fs.writeFileString(changed, "")),
+      );
+
+      await screen.getByRole("button", "Refresh issues", { exact: true }).tap();
+      // This title changes with the workflow, so the next assertion sees the completed refresh.
+      await screen.getByText("Release notes checked", { exact: true }).waitFor();
+      await app.screenshot("closed-issues-after-workflow-change");
+      await expect(screen.getByText("Verify the release package", { exact: true })).toBeVisible();
+    } finally {
+      await runPromise(primary.cli(["project", "remove", repository, "--force"]));
+    }
+  },
+);
pnpm scenarios:prove scripts/scenarios/issues-refresh-reads-new-azure-state.e2e.ts --base main

Workaround

No response

Activity

  1. added
    vouch:trusted
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions