-
Notifications
You must be signed in to change notification settings - Fork 7
fix: tty error #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
fix: tty error #108
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is a bit suspicious to me. I think it would be helpful to expand on the comments here and/or rework the logic a bit.
Scenario 1: using the tool with no pipes -> output to stderr?
Scenario 2: using the tool and piping stdout somewhere -> output charm stuff to stderr?
Scenario 3: using the tool and piping stderr somewhere -> read from stdin, output charm stuff to stderr, and no charm rendering?
I would expect the logic to look more like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I fully understand, I think as the comment is saying I want the output to always be to stderr regardless of stdin piping status?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I think your original logic checks out to me after looking at it harder for a bit.
One thing I want to check: How does this logic interact with the CLI tool's ability to pipe data in to stdin? You should be able to test pretty easily by doing something like
stl cmd 2>&1 | catand alsocat /dev/stdin | stl cmd 2>&1 | cat. I'm slightly concerned that if you simulate being an LLM using the second command, it would read in the bubbletea prompts from stdin, then make the API request and try to read in a JSON object from stdin at that point, which would and either hang without a prompt or error.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I need to merge this to support a customer before OOO, but very much intend to address this comment.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, all I'd ask is that you test
cat | stl cmd 2>&1 | cat(simulate being an LLM by forcing stdin/stdout/stderr to be non-TTY) for somestlcommand that both uses tea and makes an API request, just to confirm that it doesn't hang or error.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave this a quick test and had to also type
{}<ctrl-D>and it seems to workThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I'm worried about. Will that work with an LLM, or will that cause the LLM to not know how to proceed? It might be best to close stdin after gathering all the necessary user input and before making a request. Or somehow otherwise let the CLI know to not read request data from stdin in this scenario.