Skip to content

Fix the intermittent 'Model is disposed!': re-reading open files skips tabs closed meanwhile - #158

Merged
irrld merged 1 commit into
mainfrom
agent/reload-closed-tabs
Oct 4, 2026
Merged

irrld merged 1 commit into
mainfrom
agent/reload-closed-tabs

Conversation

@cogwright

Copy link
Copy Markdown
Collaborator

This fixes the intermittent "Model is disposed!" that failed the tabs flow on CI, on #152 and on #157 (https://github.com/umttur/GlistStudio/actions/runs/37202856344/job/111437927452). #154's stack logging caught where it comes from:

BugIndicatingError: Model is disposed!
    at TextModel._assertNotDisposed
    at TextModel.getAlternativeVersionId
    at isDirty
    at reloadOpenFiles

Why: reloadOpenFiles (src/renderer.ts) reads the open files again from disk after git changed them, on coming back to the window, and after a file was deleted. It takes the list of tabs once, then awaits each file's read in turn. A tab closed during the read of the one before it has had its model released, and the loop then called isDirty on it. The check after the read had the same problem, because it tested isDirty before isDisposed. It only shows when reads are slow enough for a tab to close in between, as on CI's runners and on slower machines, which is why it was intermittent.

Fix: both checks test for a released model first, then for unsaved changes.

Verified:

  • New flow tests/e2e/flows/reload-closing.mjs, so CI covers it from now on: three files open, reads slowed by 400 ms, the window's focus triggering the reload, and two tabs closed during it.
    • On main it fails every time with "Model is disposed!".
    • With the fix it passes, and so do the tabs and transient-tabs flows.
  • npm test, tsc and eslint pass.

🤖 Generated with Claude Code

@irrld
irrld merged commit 9fb25cd into main Oct 4, 2026
4 checks passed
@irrld
irrld deleted the agent/reload-closed-tabs branch October 4, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants