Skip to content

AI-2128: Fix exception handling in sync_comment.py and install.sh#2

Open
RachelXiaolan wants to merge 1 commit into
mainfrom
linear/ai-2128-fix-sync-comment-exception-handling
Open

AI-2128: Fix exception handling in sync_comment.py and install.sh#2
RachelXiaolan wants to merge 1 commit into
mainfrom
linear/ai-2128-fix-sync-comment-exception-handling

Conversation

@RachelXiaolan

Copy link
Copy Markdown
Owner

Linear Issue

https://linear.app/feedmob/issue/AI-2128

Summary

Two bugs found via source code audit (bug-hunting strategy B):

1. Missing exception handling in github_comment() (scripts/sync_comment.py)

  • subprocess.run() can raise FileNotFoundError when gh CLI is not installed (or not in PATH)
  • subprocess.run() can raise TimeoutExpired after 15s, but only linear_comment() had the try/except guard
  • The return values from both comment functions were ignored — script exited 0 even when both platforms failed

2. Missing argument guard in install.sh

  • --agent with no following value silently consumes the next flag as the agent name, producing confusing errors

Changes

File Change
scripts/sync_comment.py Added FileNotFoundError and TimeoutExpired handling to github_comment(); main() now returns exit code 1 when both platforms fail
install.sh Added guard for --agent without argument

Test Plan

  • python3 scripts/sync_comment.py with missing args shows usage
  • github_comment() handles missing gh CLI gracefully

Closes [AI-2128]

Fixes in sync_comment.py:
- Add FileNotFoundError handling when gh CLI is missing
- Add TimeoutExpired handling for gh CLI calls
- Return non-zero exit code when both comment platforms fail

Fixes in install.sh:
- Guard against missing --agent argument to prevent confusing errors
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.

2 participants