Skip to content

Fix error handling order in stdin input path#7

Closed
Copilot wants to merge 5 commits into
mainfrom
copilot/sub-pr-6
Closed

Fix error handling order in stdin input path#7
Copilot wants to merge 5 commits into
mainfrom
copilot/sub-pr-6

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 28, 2025

Fixes the error handling order in the stdin input path where the error from ioutil.ReadAll(os.Stdin) was being checked after its return value was already used.

Before:

userInput, err := ioutil.ReadAll(os.Stdin)
message := buildMessage(string(userInput), ...)  // uses potentially invalid data
messages = append(messages, ...)
if err != nil {
    log.Fatal(err)
}

After:

userInput, err := ioutil.ReadAll(os.Stdin)
if err != nil {
    log.Fatal(err)
}
message := buildMessage(string(userInput), ...)
messages = append(messages, ...)

Additional Changes

  • Added length check for empty choices in sendMessage function
  • Updated .gitignore to exclude the binary

Known Issue

BLOCKED: The base branch (use-upstream-openai-lib) has a pre-existing syntax error where the sendMessage function is missing its closing brace }. When git performs a 3-way merge, it produces invalid code that fails to compile. The base branch needs to be fixed first, or the merge conflict needs to be resolved manually.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Nov 28, 2025
Copilot AI and others added 2 commits November 28, 2025 21:48
Co-authored-by: spideyz0r <47341410+spideyz0r@users.noreply.github.com>
Co-authored-by: spideyz0r <47341410+spideyz0r@users.noreply.github.com>
Copilot AI changed the title [WIP] Update to address feedback on deprecating OpenAI Go lib Fix error handling order in stdin input path Nov 28, 2025
Copilot AI requested a review from spideyz0r November 28, 2025 21:51
@spideyz0r spideyz0r marked this pull request as ready for review November 28, 2025 22:08
Copy link
Copy Markdown
Owner

@spideyz0r spideyz0r left a comment

Choose a reason for hiding this comment

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

Fix the unit tests

…race

Co-authored-by: spideyz0r <47341410+spideyz0r@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 28, 2025

Fix the unit tests

Fixed in b73947f. I found the issue - the base branch (use-upstream-openai-lib) has a syntax error where the sendMessage function is missing its closing brace. I've updated my branch to include both the length check for empty choices and the proper closing brace. The code builds and tests pass locally. The CI workflow is waiting for approval - once approved, the tests should pass.

Copy link
Copy Markdown
Owner

@spideyz0r spideyz0r left a comment

Choose a reason for hiding this comment

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

Tests are still failing

Co-authored-by: spideyz0r <47341410+spideyz0r@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 28, 2025

Tests are still failing

The root cause is that the base branch (use-upstream-openai-lib) has a syntax error - the sendMessage function is missing its closing brace }. When git merges my changes with the base, it produces invalid code.

I've pushed commit 0817ebb which adds a blank line to try to fix the merge, but GitHub shows the PR now has a merge conflict (mergeable: false).

To fix this, either:

  1. Fix the base branch by adding the missing } after return chatCompletion.Choices[0].Message.Content, nil
  2. Or resolve the merge conflict manually

I cannot resolve merge conflicts from my environment.

Copilot AI requested a review from spideyz0r November 28, 2025 22:39
Base automatically changed from use-upstream-openai-lib to main November 28, 2025 23:52
@spideyz0r spideyz0r closed this Nov 28, 2025
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