Skip to content

fix: catch OSError in streaming dispatch_command() - #3925

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/streaming-oserror-handler
Open

fix: catch OSError in streaming dispatch_command()#3925
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/streaming-oserror-handler

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Problem

The streaming branch only caught KeyboardInterrupt but not OSError. If the binary is removed between shutil.which() and subprocess.run() (TOCTOU race), an OSError propagates unhandled.

Fix

Added except OSError handler in both base and copilot streaming dispatch.

…utable binaries

The streaming branch only caught KeyboardInterrupt but not OSError.
If the binary is removed between shutil.which() and subprocess.run()
(a TOCTOU race), an OSError propagates unhandled.

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.

Pull request overview

Handles streaming command-launch failures caused by executable TOCTOU races.

Changes:

  • Converts streaming OSError exceptions into structured failure results.
  • Applies consistent handling to base and Copilot dispatch paths.
  • Regression tests are still needed.
Show a summary per file
File Description
src/specify_cli/integrations/base.py Handles streaming execution errors.
src/specify_cli/integrations/copilot/__init__.py Adds equivalent Copilot handling.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment on lines +404 to +409
except OSError as exc:
return {
"exit_code": 1,
"stdout": "",
"stderr": f"Failed to execute command: {exc}",
}
Comment on lines +317 to +322
except OSError as exc:
return {
"exit_code": 1,
"stdout": "",
"stderr": f"Failed to execute command: {exc}",
}
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.

3 participants