Skip to content

Native terminal: failed-start cleanup, window ownership, reload during a start (deferred follow-ups) #582

Open

Description

@ThomasK33

Deferred follow-ups for the native terminal provider (lua/claudecode/terminal/native.lua), found by the reviews of #527 and #544. The maintainer chose on 2026-11-12 to stop the formal-models run after its open PRs and track these here.

Owner: ThomasK33. Trigger: the next claudecode.nvim run that touches native.lua.

  • Failed-start cleanup in the last window. A BufEnter autocmd that closes the other windows (:only) makes the new split the last window; a failed start then raises E444 and leaves the dead terminal buffer with its mark, so later opens adopt it and start no Claude until :ClaudeCodeClose. If the autocmd closed your window instead, the cleanup raises Invalid window id. A start or show that keeps your focus (ensure_visible) raises the same when your window is gone. (A local fix with tests exists in the terminal owner's worktree.)
  • Window ownership. Claude's exit (auto_close) or a hide can close a window of yours that shows the terminal buffer (:sbuffer, :tab sbuffer). A WinNew/WinEnter/WinLeave autocmd that runs :close during the start can put Claude in your window. Needs an ownership proof that keeps every autocmd firing (an earlier :noautocmd design skipped users' WinLeave autosave).
  • A plugin reload during a native start is not handled (start flag and pending close do not survive a reload; the model has one module generation).
  • OptionSet during a hide: on Neovim 0.8 a user OptionSet(bufhidden) autocmd that raises makes the hide raise; the autocmd runs with Claude's window current, so a user :only there closes your window.
  • fix(terminal): keep a native start single when an autocmd interrupts it #544 minors: no test pins the 10 s young-job boundary of the exec wait; a terminal adopted after a reload has no start time and never waits; on a host without /proc a young-job close costs ~0.5-0.8 s under load (ps).

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high\n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

needs-triageAwaiting maintainer triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions