feat: surface pty I/O failures instead of freezing silently - #105
Merged
Conversation
A broken pty channel had no user-visible or logged signal: the agent process kept running, the tab kept its normal badge, and the terminal simply stopped updating or stopped accepting input. Diagnosing #99 took three separate investigations largely because nothing was reported. Implement the SwiftTerm callbacks (writeFailed / readFailed) on TerminalSurface: record the failure on the surface, log it under the existing "surface" category with the errno, and post a notification the window controller turns into an error badge on the affected tab.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion to the root-cause fix in gi11es/SwiftTerm#2 (read chain ending on a failed read, the cause of #99).
The reason #99 cost three investigations is that a broken pty channel produced no signal anywhere: the agent process kept running, the tab kept its normal badge,
pslooked healthy, and the terminal just stopped updating. Everything observable was fine except the one thing nobody was watching.This wires up the two SwiftTerm callbacks so the failure announces itself:
TerminalSurface.writeFailed— input was dropped on the way to the agent (keystrokes lost).TerminalSurface.readFailed— reading was abandoned; the terminal will never show another byte from this process even though it is still running. This is the frozen-tab mode.Each records
ioFailureon the surface, logs todiagnostic.logunder the existingsurfacecategory with the errno and a hint that a restart is needed, and postsdeckardSurfaceIOFailure. The window controller turns that into an error badge on the affected tab (kind-appropriate:error/codexError/terminalError), so a dead tab looks dead.Requires the SwiftTerm bump; verified by building and running the full suite against the fix branch (green). Merge gi11es/SwiftTerm#2 into
main-updatedfirst, then this.🤖 Generated with Claude Code