Conversation
Every chapter REPL treated an empty line as a quit command and exited with status 0 without a word, while the banner only promises "Type q to quit". Under VS Code's debugger the Python extension's environment-activation line is often injected into stdin after the program started, so the first thing the REPL read was a blank line and the chapter vanished right after its banner. An empty line is now ignored and the prompt comes back; q and exit still quit, and EOF/Ctrl-C still end the loop. s17 already behaved this way. A static test keeps every chapter's quit check free of the empty string. Fixes shareAI-lab#567
This branch has not been deployed
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.
Fixes #567.
Every chapter REPL treated an empty line as a quit command (
in ("q", "exit", "")/{"q", "exit", ""}) and exited with status 0 without printing anything, while the banner only promisesType q to quit. As the issue describes, VS Code's Python extension often injects its environment-activation line into stdin after the program started, so under the debugger the first thing the REPL read was a blank line and the chapter vanished right after its banner.Change (16 chapters, s01–s16; s17 already did this): an empty line is skipped and the prompt comes back;
q/exitstill quit; EOF / Ctrl-C still end the loop. Ins13_agent_teamsthepayload is Nonecase (CLI quit event) keeps breaking out, and only the empty payload is skipped.Test:
tests/test_repl_quit_commands.pyparses everys*/code.pyand asserts that each quit check exists, that""is not among its commands, and that the blank-input skip precedes it (s17 excluded, it already had the guard in the other order).pytest testspasses excepttest_goal_loop.py::test_bash_output_keeps_exit_code_when_the_tail_is_trimmed, which fails identically onmainon this machine.