Skip to content

Send the command line along with the output to the duck - #199

Merged
rongxin-liu merged 2 commits into
canaryfrom
help50-payload
Sep 22, 2026
Merged

rongxin-liu merged 2 commits into
canaryfrom
help50-payload

Conversation

@rongxin-liu

@rongxin-liu rongxin-liu commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Companion to cs50/cli#246, which passes the failed command's line to _helpless as 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 typed make foo.c. cs50.ai's /api/v1/help wraps whatever it gets in a code block and asks the model to explain it, so the payload is now a short transcript:

$ make foo.c
make: *** No rule to make target 'foo.c'.  Stop.

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.sh now checks the payload itself: it stubs _help50_button (which otherwise hands the payload to command50 with output discarded) and asserts that _helpless OUTPUT CMD yields $ CMD followed by the output on the next line, that _helpless OUTPUT alone 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).

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.
@rongxin-liu rongxin-liu self-assigned this Sep 22, 2026
@rongxin-liu
rongxin-liu merged commit 4fc98fa into canary Sep 22, 2026
1 check passed
@rongxin-liu
rongxin-liu deleted the help50-payload branch September 22, 2026 06:08
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.

1 participant