Skip to content

Fix SSH terminal resize dimensions - #17

Merged
aniketmaurya merged 1 commit into
mainfrom
codex/investigate-dirty-ssh-session
Jun 7, 2026
Merged

Fix SSH terminal resize dimensions#17
aniketmaurya merged 1 commit into
mainfrom
codex/investigate-dirty-ssh-session

Conversation

@aniketmaurya

@aniketmaurya aniketmaurya commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Correct the SSH terminal resize payload so rows and cols are sent in the right order.
  • Add a small helper to normalize terminal dimensions before sending resize events.
  • Add a regression test to cover the dimension conversion.

Testing

  • uv run pytest tests/test_computer_cli.py
  • uv run ruff check src/celesto/computer.py tests/test_computer_cli.py

Summary by CodeRabbit

  • Refactor

    • Improved terminal size handling for SSH connections with enhanced code organization.
  • Tests

    • Added unit test coverage for terminal dimension detection.

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d041fc2e-a8a2-4ed0-b99c-e9bcf2ed3b7b

📥 Commits

Reviewing files that changed from the base of the PR and between 222f57f and e4d8cfc.

📒 Files selected for processing (2)
  • src/celesto/computer.py
  • tests/test_computer_cli.py

📝 Walkthrough

Walkthrough

Module-level os import added, _terminal_dimensions() helper introduced to centralize terminal size retrieval, and ssh_to_computer updated to use the helper for both initial websocket resize and SIGWINCH handler. New test validates the helper returns (rows, columns) ordering correctly.

Changes

Terminal Dimensions Helper

Layer / File(s) Summary
Terminal dimensions helper and integration
src/celesto/computer.py
Module-level import os added; _terminal_dimensions() helper defined to abstract terminal size as (rows, columns); ssh_to_computer initial resize and SIGWINCH handler both updated to call the helper; local import os removed.
Terminal dimensions helper test
tests/test_computer_cli.py
Test suite extended with test_terminal_dimensions_return_rows_then_columns, which mocks os.get_terminal_size and asserts _terminal_dimensions() returns dimensions in the correct (rows, columns) order.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

Right then, listen to me. We've got a helper now, neat and clean,
Terminal sizes sorted—rows first, columns seen.
Refactored the mess, tidied up the code,
One function to rule them, straight down the road. 📺✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and concisely describes the primary fix: correcting SSH terminal resize dimensions ordering.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/investigate-dirty-ssh-session

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@aniketmaurya
aniketmaurya merged commit 64f46b9 into main Jun 7, 2026
7 checks passed
@aniketmaurya
aniketmaurya deleted the codex/investigate-dirty-ssh-session branch June 7, 2026 20:44
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.

1 participant