fix(cli): handle chat output errors#10229
Merged
Merged
Conversation
Propagate terminal write errors from the chat prompt and explicitly ignore stream close errors during cleanup. Update chat tests to assert response writer errors so errcheck passes without hiding failed writes. Tests: - go test -count=1 ./core/cli/chat - go test -count=1 ./core/cli Assisted-by: Codex:GPT-5 Signed-off-by: Ching Kao <0980124jim@gmail.com>
mudler
approved these changes
Jun 9, 2026
mudler
reviewed
Jun 9, 2026
| fmt.Fprintln(out, "bye") | ||
| return nil | ||
| return writeChat(out, "bye\n") | ||
| case "/clear": |
Owner
There was a problem hiding this comment.
there are many literals here, could benefit to move these to constants
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes errcheck failures in the new CLI chat code.
It updates the terminal chat prompt to propagate write errors instead of ignoring
fmt.Fprint*return values, and explicitly ignores the chat stream close error during cleanup where there is no useful follow-up action.The chat tests were also updated to assert response writer errors in test helpers, so the tests remain explicit while satisfying errcheck.
Notes for Reviewers
stream.Close()is intentionally ignored in deferred cleanup because request/stream errors are already handled during receive.Testing
Assisted-by: Codex:GPT-5
Signed commits