Skip to content

fix(tui): detach reusable composer before clear() at remaining overlay open paths (jobs, tasks, oauth paste, /debug) #4657

Description

@Yeachan-Heo

Composer terminal disposal remains reachable at four unguarded overlay open paths

Follow-up of #4604 / PR #4605. PR #4605 fixes the terminal-disposal defect at the five highest-traffic overlay paths (command palette / model selector / queued-message selector open and restore paths, plus pet-aware restores). Boundary review of that PR confirmed four pre-existing sibling paths with the identical bug still open on dev (27afb732b3):

Path Reachable via Site
Jobs overlay open default alt+j keybinding, /monitors (also reachable from the command palette itself) packages/coding-agent/src/modes/controllers/selector-controller.ts showJobsOverlay (~:3669)
Tasks pane open default alt+t keybinding selector-controller.ts showTasksPane (~:3699)
OAuth API-key paste login API-key login for ~20 providers (packages/ai/src/utils/oauth/*) selector-controller.ts onPrompt code input (~:3168)
/debug log + raw-SSE viewers /debug packages/coding-agent/src/debug/index.ts (~:348, :367)

Mechanism (identical to #4604): these opens call ctx.editorContainer.clear() while the live reusable CustomEditor is still attached. Container.clear() disposes children terminally, Editor.dispose() unregisters the tab-width change listener, and every later restore re-mounts a dead editor — runtime tab-width changes stop re-deriving composer layout after the first overlay round-trip. The close-path clears at ~:3163, ~:3657, ~:3685 self-heal once their opens detach.

Fix shape (same two lines per site): this.ctx.editorContainer.detachChild(this.ctx.editor); immediately before the open-path clear(), exactly as showSelector (:1344) and extension-ui-controller.ts (:1178) already do.

Not a regression from #4605 — all four sites predate it on the base commit; filed so the remaining surface is not lost. Regression coverage pattern to copy: the 4-cycle invalidation-count probe with red control in packages/coding-agent/test/gajae-pet-widget.test.ts and the repeated palette-cycle test in packages/coding-agent/test/command-palette-interactive-host.test.ts.


[repo owner's gaebal-gajae (clawdbot) 🦞]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions