Backtestsvuerun-20261021-133314#7506

Issue #7506 Merged fix PR #15411 Run 21 Oct 2026 · run-20261021-133314 vuejs/core

suspense.resolve() is called without a pending branch.

Tie

The judges split evenly between our patch and the merged fix.

In this judgment, Patch B = our agent, Patch A = the merged fix.

Both patches identify the same root cause: when the parent Suspense patches its pending branch with the same root type, a nested suspensible Suspense that flips to synchronous content resolves itself during that patch and immediately decrements the parent's deps to 0, calling parentSuspense.resolve() mid-patch. The parent then falls through to its own post-patch deps check and calls resolve() again with pendingBranch already cleared, producing the reported warning. Both patches defer the parent's resolution until the patch completes, and both pass all five independent tests (base fails four of them with the exact warning). The difference is in mechanism and craft. Patch A temporarily increments and decrements suspense.deps around the patch call. This is minimal but overloads the deps counter, which is meant to count registered async dependencies, with a synthetic placeholder; any other code reading deps during the patch (nested boundary creation, devtools, future callers) sees a misleading count, and if patch throws the counter is permanently off by one so the boundary can never resolve. Patch B adds an explicit isPatchingPendingBranch flag on the boundary, initialized in createSuspenseBoundary and checked only in the nested-suspensible resolve path, which is the one path that can fire synchronously during the patch. This matches the existing isFallbackMountPending convention, states intent clearly, and leaves the deps semantics intact. On tests, Patch A's two tests are good (including a follow-up update that verifies activeBranch isn't corrupted), but Patch B adds three scenarios: the basic mid-patch resolve, a later sibling registering a new async dep during the same patch (verifying the parent keeps waiting), and a multi-root branch with a plain element mounted after the nested boundary. Both sets would fail before the fix. Scope is equivalent and tightly focused in both. Patch B wins on clarity of intent, consistency with surrounding conventions, and marginally broader test coverage, while A's deps hack is terse but less principled.

Four judges ruled on this ticket in parallel, and the verdict comes from counting their votes. Each saw the issue and the two patches, labelled A and B in random order (two of them saw ours as A), with issue links and version numbers removed. Where tests could check the fix, they also saw the results of tests a separate agent wrote for the issue, run on both patches. None was told which patch was ours. The reasoning above is one judge's, shown verbatim.

Solve

12m 14s

Wall-clock time in the container

Full test suite

No new failures

1,800 passed · 1 skipped · 1,801 total

Contamination audit

Clean

No sign the agent saw the real fix

Patch size

207vs 141 merged

Changed lines, ours vs merged

Vue version

3.2.45

Link to minimal reproduction

https://codesandbox.io/s/vue-router-playground-forked-w9164p?file=/src/pages/Page2.vue

Steps to reproduce

Create an application with vue and vue-router and the suspense component.

When creating a page, during the setup function navigate to another page (in my case this is how I handle an error) than this error is triggered.

What is expected?

Just no error message from vue / Suspense.

What is actually happening?

I get the following error message:

`
suspense.resolve() is called without a pending branch.
`

Nevertheless I can keep on using the application without any problems. I just want to get rid of the error message.

System Info

_No response_

Any additional comments?

_No response_

The two patches

Our patch+206 −1
packages/runtime-core/__tests__/components/Suspense.spec.tsindex 6b6373fab..f132b3d08 100644@@ -1869,6 +1869,201 @@ describe('Suspense', () => {     expect(serializeInner(root)).toBe(expected)   }) +  test('nested suspensible suspense resolving parent while parent pending branch is patched', async () => {+    const Async = defineAsyncComponent({+      render() {+        return h('div', 'async')+      },+    })+    const Sync = {+      render() {+        return h('div', 'sync')+      },+    }+    const Wrapper = {+      props: ['showAsync'],+      setup(props: any) {+        return () =>+          h(+            Suspense,+            { suspensible: true },+            {+              default: h(props.showAsync ? Async : Sync),+              fallback: h('div', 'fallback inner'),+            },+          )+      },+    }++    const showAsync = ref(true)+    const onResolve = vi.fn()+    /**+     *  <Suspense @resolve="onResolve">+     *    <Wrapper :showAsync="showAsync" />+     *      (<Suspense suspensible><Async v-if="showAsync" /><Sync v-else /></Suspense>)+     *  </Suspense>+     */+    const Comp = {+      setup() {+        return () =>+          h(+            Suspense,+            { onResolve },+            {+              default: h(Wrapper, { showAsync: showAsync.value }),+              fallback: h('div', 'fallback outer'),+            },+          )+      },+    }++    const root = nodeOps.createElement('div')+    render(h(Comp), root)+    expect(serializeInner(root)).toBe(`<div>fallback outer</div>`)++    // switching the nested suspense to a sync branch resolves it, which+    // resolves the outer suspense while its pending branch is being patched+    showAsync.value = false+    await nextTick()+    expect(serializeInner(root)).toBe(`<div>sync</div>`)+    expect(onResolve).toHaveBeenCalledTimes(1)++    await Promise.all(deps)+    await nextTick()+    expect(serializeInner(root)).toBe(`<div>sync</div>`)+    expect(onResolve).toHaveBeenCalledTimes(1)+  })++  test('nested suspensible suspense resolving does not resolve parent before its pending branch is fully patched', async () => {+    const Async = defineAsyncComponent({+      render() {+        return h('div', 'async')+      },+    })+    const Sibling = defineAsyncComponent({+      render() {+        return h('div', 'sibling')+      },+    })+    const Sync = {+      render() {+        return h('div', 'sync')+      },+    }+    const Wrapper = {+      props: ['showAsync'],+      setup(props: any) {+        return () =>+          h(+            Suspense,+            { suspensible: true },+            {+              default: h(props.showAsync ? Async : Sync),+              fallback: h('div', 'fallback inner'),+            },+          )+      },+    }++    const showAsync = ref(true)+    const showSibling = ref(false)+    const onResolve = vi.fn()+    const Comp = {+      setup() {+        return () =>+          h(+            Suspense,+            { onResolve },+            {+              // multi-root pending branch with siblings after the nested one+              default: h(Fragment, [+                h(Wrapper, { showAsync: showAsync.value }),+                showSibling.value ? h(Sibling) : null,+              ]),+              fallback: h('div', 'fallback outer'),+            },+          )+      },+    }++    const root = nodeOps.createElement('div')+    render(h(Comp), root)+    expect(serializeInner(root)).toBe(`<div>fallback outer</div>`)++    // the nested suspense resolves while a later sibling registers a new dep:+    // the outer suspense must keep waiting for it+    showAsync.value = false+    showSibling.value = true+    await nextTick()+    expect(serializeInner(root)).toBe(`<div>fallback outer</div>`)+    expect(onResolve).toHaveBeenCalledTimes(0)++    await Promise.all(deps)+    await nextTick()+    expect(serializeInner(root)).toBe(+      `<div>sync</div><div>sibling</div>`,+    )+    expect(onResolve).toHaveBeenCalledTimes(1)+  })++  test('nested suspensible suspense resolving parent with a multi-root pending branch', async () => {+    const Async = defineAsyncComponent({+      render() {+        return h('div', 'async')+      },+    })+    const Sync = {+      render() {+        return h('div', 'sync')+      },+    }+    const Wrapper = {+      props: ['showAsync'],+      setup(props: any) {+        return () =>+          h(+            Suspense,+            { suspensible: true },+            {+              default: h(props.showAsync ? Async : Sync),+              fallback: h('div', 'fallback inner'),+            },+          )+      },+    }++    const showAsync = ref(true)+    const showP = ref(false)+    const onResolve = vi.fn()+    const Comp = {+      setup() {+        return () =>+          h(+            Suspense,+            { onResolve },+            {+              default: h(Fragment, [+                h(Wrapper, { showAsync: showAsync.value }),+                showP.value ? h('p', 'p') : null,+              ]),+              fallback: h('div', 'fallback outer'),+            },+          )+      },+    }++    const root = nodeOps.createElement('div')+    render(h(Comp), root)+    expect(serializeInner(root)).toBe(`<div>fallback outer</div>`)++    // the element after the nested suspense is mounted in the same patch+    showAsync.value = false+    showP.value = true+    await nextTick()+    expect(serializeInner(root)).toBe(`<div>sync</div><p>p</p>`)+    expect(onResolve).toHaveBeenCalledTimes(1)+  })+   //#8678   test('nested suspense (child suspense update before parent suspense resolve)', async () => {     const calls: string[] = []packages/runtime-core/src/components/Suspense.tsindex 8a186fff2..ae8572cc5 100644@@ -246,6 +246,9 @@ function patchSuspense(     suspense.pendingBranch = newBranch     if (isSameVNodeType(pendingBranch, newBranch)) {       // same root type but content may have changed.+      // nested suspensible boundaries must not resolve this one mid-patch,+      // the deps check below takes care of it once the patch is complete+      suspense.isPatchingPendingBranch = true       patch(         pendingBranch,         newBranch,@@ -258,6 +261,7 @@ function patchSuspense(         slotScopeIds,         optimized,       )+      suspense.isPatchingPendingBranch = false       if (suspense.deps <= 0) {         suspense.resolve()       } else if (isInFallback) {@@ -437,6 +441,7 @@ export interface SuspenseBoundary {   hiddenContainer: RendererElement   activeBranch: VNode | null   isFallbackMountPending: boolean+  isPatchingPendingBranch: boolean   pendingBranch: VNode | null   deps: number   pendingId: number@@ -523,6 +528,7 @@ function createSuspenseBoundary(     timeout: typeof timeout === 'number' ? timeout : -1,     activeBranch: null,     isFallbackMountPending: false,+    isPatchingPendingBranch: false,     pendingBranch: null,     isInFallback: !isHydrating,     isHydrating,@@ -648,7 +654,11 @@ function createSuspenseBoundary(           parentSuspenseId === parentSuspense.pendingId         ) {           parentSuspense.deps---          if (parentSuspense.deps === 0 && !sync) {+          if (+            parentSuspense.deps === 0 &&+            !sync &&+            !parentSuspense.isPatchingPendingBranch+          ) {             parentSuspense.resolve()           }         } 
Merged fix · PR #15411+141 −0
packages/runtime-core/__tests__/components/Suspense.spec.tsindex 6b6373fab..68d71ebd1 100644@@ -2004,6 +2004,143 @@ describe('Suspense', () => {     ])   }) +  // toggling a nested suspensible suspense to sync content resolves the+  // parent boundary synchronously while it is still being patched; the+  // fallback fall-through must then be skipped or it patches the unmounted+  // fallback and corrupts activeBranch+  test('nested suspensible suspense toggled to sync content while parent is in fallback', async () => {+    const route = ref('a')+    const label = ref('first')++    const AsyncChild = {+      async setup() {+        await new Promise(() => {}) // never resolves+        return () => h('div', 'async child')+      },+    }+    const PageA = {+      setup: () => () => h('div', [h('span', 'page a'), h(AsyncChild)]),+    }+    const PageB = {+      setup: () => () => h('div', `page b ${label.value}`),+    }++    const Comp = {+      setup() {+        return () =>+          h(Suspense, null, {+            default: h('div', { 'data-label': label.value }, [+              h(+                Suspense,+                { suspensible: true },+                {+                  default:+                    route.value === 'a'+                      ? h(PageA, { key: 'a' })+                      : h(PageB, { key: 'b' }),+                },+              ),+            ]),+            fallback: h('div', 'fallback'),+          })+      },+    }++    const root = nodeOps.createElement('div')+    render(h(Comp), root)+    expect(serializeInner(root)).toBe(`<div>fallback</div>`)++    // the nested suspense resolves synchronously, propagates, and resolves+    // the outer boundary mid-patch+    route.value = 'b'+    await nextTick()+    expect(serializeInner(root)).toBe(+      `<div data-label="first"><div>page b first</div></div>`,+    )++    // a follow-up update must still reach the DOM+    label.value = 'second'+    await nextTick()+    expect(serializeInner(root)).toBe(+      `<div data-label="second"><div>page b second</div></div>`,+    )+  })++  // a nested suspensible suspense resolving synchronously inside the parent's+  // same-root patch must not resolve the parent before later siblings in the+  // same patch have registered their async deps+  test('nested suspensible suspense resolving the parent mid-patch while a later sibling registers an async dep', async () => {+    const route = ref('a')+    const show = ref(false)+    let releaseSibling: () => void+    const siblingGate = new Promise<void>(r => (releaseSibling = r))++    const NeverChild = {+      async setup() {+        await new Promise(() => {}) // never resolves+        return () => h('div', 'never')+      },+    }+    const Sibling = {+      async setup() {+        await siblingGate+        return () => h('div', 'sibling')+      },+    }+    const PageA = {+      setup: () => () => h('div', [h('span', 'page a'), h(NeverChild)]),+    }+    const PageB = {+      setup: () => () => h('div', 'page b'),+    }++    const onResolve = vi.fn()+    const Comp = {+      setup() {+        return () =>+          h(+            Suspense,+            { onResolve },+            {+              default: h('div', [+                h(+                  Suspense,+                  { suspensible: true },+                  {+                    default:+                      route.value === 'a'+                        ? h(PageA, { key: 'a' })+                        : h(PageB, { key: 'b' }),+                  },+                ),+                show.value ? h(Sibling) : null,+              ]),+              fallback: h('div', 'fallback'),+            },+          )+      },+    }++    const root = nodeOps.createElement('div')+    render(h(Comp), root)+    expect(serializeInner(root)).toBe(`<div>fallback</div>`)++    // the nested suspense resolves synchronously and releases the parent's+    // last dep, but the sibling mounted right after it is still pending+    route.value = 'b'+    show.value = true+    await nextTick()+    expect(serializeInner(root)).toBe(`<div>fallback</div>`)+    expect(onResolve).not.toHaveBeenCalled()++    releaseSibling!()+    await new Promise(r => setTimeout(r))+    expect(serializeInner(root)).toBe(+      `<div><div>page b</div><div>sibling</div></div>`,+    )+    expect(onResolve).toHaveBeenCalledTimes(1)+  })+   // #6416   test('KeepAlive with Suspense', async () => {     const Async = defineAsyncComponent({packages/runtime-core/src/components/Suspense.tsindex 8a186fff2..ba61c6340 100644@@ -246,6 +246,9 @@ function patchSuspense(     suspense.pendingBranch = newBranch     if (isSameVNodeType(pendingBranch, newBranch)) {       // same root type but content may have changed.+      // hold the boundary pending across the patch: a nested branch that+      // resolves in here must not resolve it before later siblings register.+      suspense.deps++       patch(         pendingBranch,         newBranch,@@ -258,6 +261,7 @@ function patchSuspense(         slotScopeIds,         optimized,       )+      suspense.deps--       if (suspense.deps <= 0) {         suspense.resolve()       } else if (isInFallback) {