Help50 rollout - #200
Open
rongxin-liu wants to merge 13 commits into
Open
Help50 rollout#200rongxin-liu wants to merge 13 commits into
rongxin-liu wants to merge 13 commits into
Conversation
- codespace.sh: override help50's _helpful/_helpless/_helped hooks to relay to the help50 extension via command50, which shows a button in the terminal title bar that hands the message to the CS50 Duck; skip _helpless when the failed command produced no output (e.g., grep with no match) - codespace.sh: set WORKDIR to the workspace so help50's helpers can find misplaced files (cs50/cli defaults it to $HOME) - Dockerfile, devcontainer.json: build and install help50.vsix - devcontainer.json: add a Sysadmins terminal profile (sudo bash), which gets a root shell without help50
tests/smoke.sh runs the built image under timeouts: non-interactive login shells exit (help50 must not start without a terminal), the help50 hooks are the codespace overrides and behave, help50.vsix and command50 are present, and root shells have no help50. Run in CI after each build and before any push.
Branch builds use cs50/cli:amd64 (main), which doesn't have help50 yet, so codespace.sh errored on every login shell sourcing /opt/cs50/lib/cli. Guard the source, and have the smoke test skip the help50 checks (visibly) when the base image lacks them, while still asserting that login shells start cleanly.
Add help50 integration
Only a successful command hid the button, so a later failure with no output (e.g., grep with no match) left a button about an earlier command. Now any completed command either replaces the button or clears it.
Hide a stale help50 button after a quiet failure
The advice is already on screen, so the button only added a click. Reserve it for failures no helper recognized, where the duck can ask cs50.ai. A recognized failure now clears any stale button like other outcomes do.
Don't show the help50 button when a helper already gave advice
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.
Send the command line along with the output to the duck
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.
Checkpoint of the cs50/codespace changes for the Help50 rollout, developed and tested on
canary(#196–#199), then fast-forwarded intodevelop. Merges 13 commits; the tree is identical toorigin/canaryatc31dc4b. The rebuiltcodespace:canaryimage was verified in a fresh codespace together with the merged cs50/ddb50.vsix#25 and cs50/help50.vsix#3.What lands on
mainhelp50 integration (
etc/profile.d/codespace.sh) — cs50/cli's/etc/profile.d/help50.shruns after each command and calls one of three hooks;codespace.shoverrides them for codespaces:_helpless(no local helper matched): prints "Clickhelp50above for help with that error" and shows a help50 button in the terminal title bar viacommand50 help50.showButton. Clicking it sends the failed command's output to cs50.ai for an explanation. The payload is a short transcript ($ <command line>then the output) when cs50/cli passes the command line (Keep the end of long output, and pass the command line to _helpless cli#246), the output alone otherwise. Whitespace-only output hides any pending button instead, sogrepwith no match,false, or a program exiting 1 stay quiet._helpful(a helper had advice, e.g.1s-> "Did you meanls?"): prints the advice inline as before and hides any pending button. No button, since the advice already answers the question._helped(command succeeded): hides the button if one is showing.Every completed command therefore either replaces the button or clears it, so it always refers to the last command.
command50runs detached with output discarded, so the prompt is never delayed and a missing extension server degrades silently.Supporting changes
Dockerfile: builds cs50/help50.vsix into/opt/cs50/extensions;devcontainer.jsoninstalls it alongside the other CS50 extensions.codespace.shsources/opt/cs50/lib/cliwhen present (tolerates a cs50/cli base image without help50) and exportsWORKDIR=/workspaces/$RepositoryNameso help50's "Did you mean tocdfirst?" suggestions fire in codespaces (cs50/cli defaults it to$HOME).devcontainer.json: adds a Sysadmins terminal profile (sudo bash) for a root shell, which cs50/cli's profile skips entirely, so no help50.tests/smoke.sh: runs the built image under timeouts and asserts non-interactive login shells exit, the hooks are the codespace overrides and behave (including the_helplesspayload shape),help50.vsixandcommand50are present, and root shells have no help50..github/workflows/main.yml: runstests/smoke.shagainst the built image after each build and before any push, onmainand on feature branches.Dependencies
Already on their default branches: cs50/cli#210, cs50/cli#245, cs50/cli#246 (via
cs50/cli:canary-> latest), cs50/help50.vsix#1 and #3, cs50/ddb50.vsix#23–#25, cs50/cs50.vsix.Merging
Squash-merge. Do not delete
developafterward; it is the long-lived integration branch.