Skip to content

fix(no-ticket): do not report an input/output error from the terminal - #588

Open
cloudsmith-iduffy wants to merge 4 commits into
masterfrom
iduffy/fix-terminal-hangup-eio
Open

cloudsmith-iduffy wants to merge 4 commits into
masterfrom
iduffy/fix-terminal-hangup-eio

Conversation

@cloudsmith-iduffy

Copy link
Copy Markdown
Collaborator

Description

Sentry CLOUDSMITH-CLI-2B is an OSError: [Errno 5] Input/output error from cloudsmith push, raised in create_package. That function only writes progress to the terminal and calls the API, and the error has no file name. So the error comes from a write to a terminal that is gone.

When the terminal closes or the SSH session drops while a command runs, the next write to stdout or stderr fails with EIO. The error reaches AliasGroup.main, and the CLI sends it to Sentry as a crash. The CLI cannot fix the terminal, so the report gives us nothing to act on.

This PR makes is_reportable return false for an OSError with errno.EIO. The CLI still shows the error and exits with status 1.

To see the change, run a command with stdout on a pty whose other end is closed:

import os, pty, subprocess
master, slave = pty.openpty()
os.close(master)
subprocess.run(["cloudsmith", "--help"], stdout=slave)

On master, the CLI prints Error: OSError: [Errno 5] Input/output error and sends a report. With this PR, it prints the same line and sends nothing.

Fixes CLOUDSMITH-CLI-2B

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other (please describe)

Additional Notes

A disk read that fails with EIO is also not reported now. That is a hardware problem, not a CLI bug, and the user still sees the error.

🤖 Generated with Claude Code

When the terminal closes or the SSH session drops while a command runs,
the next write to stdout or stderr fails with OSError EIO. The error
reached AliasGroup.main, and the CLI sent it to Sentry as a crash.

Treat EIO as a device error in is_reportable. The CLI still shows the
error and exits with status 1.

Fixes CLOUDSMITH-CLI-2B

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 10:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The changelog incorrectly guarantees exit status 1 for EIO on a hung-up terminal, while a failed buffered stdout flush during shutdown can still produce status 120.

1 open issue
What changed in this PR

This PR suppresses telemetry reports for OSError exceptions with errno.EIO, including terminal disconnections, without changing existing error handling.

Changes:

  • Exclude EIO errors from telemetry reporting.
  • Add a regression test confirming no report is sent.
  • Document the behavior in the changelog.
File Description
cloudsmith_cli/​core/​tests/​test_telemetry.py Tests that EIO exceptions produce no telemetry events.
cloudsmith_cli/​core/​telemetry.py Marks EIO exceptions as non-reportable.
CHANGELOG.md Describes suppression of EIO error reports.

Review effort: Balanced

Comment thread CHANGELOG.md Resolved
The change only stops the error report. The exit status after a failed
write to a closed terminal depends on the platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the EIO telemetry-suppression change.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

…/fix-terminal-hangup-eio

# Conflicts:
#	CHANGELOG.md

Co-authored-by: cloudsmith-iduffy <178375997+cloudsmith-iduffy@users.noreply.github.com>

This branch has not been deployed

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants