Fix SFTP session hang after authentication#29
Conversation
Fixed a bug where the SFTP session would hang after authentication because the `sftp_factory` was incorrectly returning an instance instead of a callable. Changes: - Updated `sftp_factory` in `dcfs/app/sftp/__init__.py` to return a lambda that accepts a channel. - Updated `DCFSSFTPHandler.__init__` in `dcfs/app/sftp/handler.py` to explicitly accept and pass the channel to `super().__init__`. - Added `tests/test_sftp_factory.py` to verify the factory and handler initialization logic. Co-authored-by: VulcanoSoftware <113239901+VulcanoSoftware@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Fixed a bug in the SFTP server implementation where the session would hang after successful authentication. The issue was caused by an incorrect implementation of the
sftp_factoryinasyncssh, which was returning an already-instantiatedDCFSSFTPHandlerinstead of a callable (as expected by the library).The fix involved:
create_sftp_serverindcfs/app/sftp/__init__.pyto makesftp_factoryreturn a lambda that takes theSSHServerChanneland creates the handler.DCFSSFTPHandler.__init__indcfs/app/sftp/handler.pyto explicitly accept the channel and pass it to theasyncssh.SFTPServerbase class.tests/test_sftp_factory.pythat mocks theasyncsshinteraction to ensure the factory and handler are correctly initialized.Verified the fix with a reproduction script and confirmed that existing tests still pass.
PR created automatically by Jules for task 10688922256061701937 started by @VulcanoSoftware