Send the command line along with the output to the duck - #199
Merged
Merged
Conversation
cs50/cli#246 passes the failed command's line to _helpless as a second argument. Include it, as a transcript ($ cmd, then output), so cs50.ai can see what the student ran, not just what came back.
_help50_button hands the payload to command50 with output discarded, so no check could see it. Stub it and assert both forms: with a command line, "$ cmd" then the output; without one, the output alone. Whitespace-only output still hides the button even when a command line is supplied.
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.
Companion to cs50/cli#246, which passes the failed command's line to
_helplessas a second argument.Until now the duck received only the output, e.g.
make: *** No rule to make target 'foo', with no idea the student had typedmake foo.c. cs50.ai's/api/v1/helpwraps whatever it gets in a code block and asks the model to explain it, so the payload is now a short transcript:Output stays
$1, so the "empty output, nothing to explain" check is unchanged. If the second argument is absent (a cs50/cli base image without #246), the payload is the output alone, as before.tests/smoke.shnow checks the payload itself: it stubs_help50_button(which otherwise hands the payload tocommand50with output discarded) and asserts that_helpless OUTPUT CMDyields$ CMDfollowed by the output on the next line, that_helpless OUTPUTalone yields the output unchanged, and that whitespace-only output still hides the button even when a command line is supplied.Also verified under a pty with a fake
command50:cat nothere->showButton ask "$ cat nothere\ncat: nothere: No such file or directory"; a 3000-line script ending in a traceback -> payload keeps the command, the first lines, an omission marker, and the traceback.Merge after cs50/cli#246 has produced a new
cs50/cli:canary(or the payload will lack the command until the next rebuild; harmless).