Link resolver stops for good when a popout window closes during its pause, so renames hang until restart

THIS BUG REPORT WAS GENERATED BY CLAUDE CODE

Steps to reproduce

The race needs a popout to close within the link resolver’s pause (at most 100 ms). The snippet below forces that timing: it closes the popout the moment the resolver schedules its pause on it. Run it in the developer console of a vault with at least ~20 notes.

(async () => {
  const leaf = app.workspace.openPopoutLeaf();
  await sleep(1500);
  const win = leaf.view.containerEl.win;
  win.focus();
  await sleep(500);
  console.log("popout is activeWindow:", activeWindow === win);

  // Close the popout as soon as the link resolver pauses on it.
  const ric = win.requestIdleCallback.bind(win);
  let closed = false;
  win.requestIdleCallback = (cb, opts) => {
    const id = ric(cb, opts);
    if (!closed) { closed = true; leaf.detach(); }
    return id;
  };

  const mc = app.metadataCache;
  for (const f of app.vault.getMarkdownFiles()) mc.queueFileForLinkResolution(f);
  await sleep(5000);
  console.log("items left:", mc.linkResolverQueue.items.length, "cache clean:", mc.isCacheClean());
})();

Then rename any note.

Did you read and follow the Troubleshooting Guide ? [Yes/No]

No.

Expected result

The link resolver finishes its queue, the cache becomes clean, and the rename goes through.

Actual result

The queue never drains (`items left` stays near the number of notes, `cache clean: false`) and keeps growing as files change. Every `fileManager.renameFile` from then on waits forever in `runAsyncLinkUpdate` (`onCleanCache` never calls back), so renaming and moving notes hangs, from the UI too, until Obsidian is restarted. Links in files changed after that point aren’t resolved either.

The same steps without closing the popout (no hook) drain the queue in under 3 seconds.

### Cause, as far as I can tell

`MetadataCache.linkResolver` pauses every few items through the pause helper with `maxDelay: 100`, which schedules `requestIdleCallback` and `setTimeout` on `activeWindow`. When `activeWindow` is a popout that closes before either fires, neither ever fires, the `await` never returns, and the loop is dead while `linkResolverQueue.runnable` still says it’s running.

In normal use this is a popout (Settings is one since 1.14) closed while links are being resolved, for example after a sync or a bulk edit. It’s rare, but with popouts opened and closed all day it does happen.

Scheduling the pause on the main `window` instead of `activeWindow`, or resolving the pause when its window unloads, would avoid it.

Starting a new loop recovers without a restart: move the remaining items out of `linkResolverQueue.items`, call `metadataCache.linkResolver()`, then `linkResolverQueue.addList(items)`.

Environment

SYSTEM INFO:
	Obsidian version: 1.14.5
	Installer version: 1.14.4
	Operating system: #1 SMP PREEMPT_DYNAMIC Sun, 18 Oct 2026 14:54:49 +0000 7.2.11-1-cachyos
	Login status: not logged in
	Language: en
	Insider build toggle: off
	Live preview: on
	Base theme: dark
	Community theme: Minimal 8.0.4
	Snippets enabled: 3
	Restricted mode: off
	Plugins installed: 45
	Plugins enabled: 32
		1: Dataview v0.5.68
		2: Style Settings v1.0.9
		3: Templater v2.26.0
		4: Copy Block Link v1.0.4
		5: Callout Manager v1.1.2
		6: Minimal Theme Settings v9.0.0
		7: tldraw v1.32.0
		8: TaskNotes v5.0.0-beta.6
		9: Multi Properties v1.4.3
		10: QuickAdd v2.32.1
		11: Custom plugin
		12: JS Engine v0.3.6
		13: Metadata Menu v0.8.12
		14: Quick Switcher++ v6.2.0
		15: Calendar v1.5.10
		16: Refresh Any View v3.6.7
		17: Canvas Bases v0.1.5
		18: Yanki v1.14.1
		19: Ribbon Divider v1.1.1
		20: Pinned Notes v2.0.5
		21: Advanced Canvas v7.1.0
		22: Typing Transformer v0.4.9
		23: Git v2.42.0
		24: Regex Mark v1.11.1
		25: Auto Heading v1.5.11
		26: Mermaid Tools v1.4.3
		27: Canvas Mindmap v1.0.2
		28: BRAT v2.2.0
		29: ActivityWatch v1.3.0
		30: Folder Bridge v2.15.4
		31: Iconic v1.1.11
		32: Base Source Editor v0.6.2

Additional information

I’ll move this to Help until you do.