Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A track's dev command now runs on demand for each session in tmux, and Workshop serves it at <track>-<sid>.$WORKSHOP_DEV_DOMAIN through the same port 3002. A browser signs in to a dev host with a short-lived HMAC ticket, exchanged for a cookie that only that host receives. Workshop's own credentials are ignored on requests that come from dev-host pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 of 4 tasks
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.
Summary
Each session gets a Dev Server button. It opens
https://<track>-<sid>.$WORKSHOP_DEV_DOMAIN, and Workshop starts the track's dev command for that session on demand and serves it through its existing port 3002. Docker publishes no new ports. The feature is off unlessWORKSHOP_DEV_DOMAINis set.Routing (
src/server/dev-server-router.ts,dev-host.ts). Any request whose Host is<slug>-<12-hex sid>.<domain>is handled entirely by the router, including/api/*and WebSocket upgrades. On each request the router:devCommand;127.0.0.1:<port>.While the server is starting, HTML requests get a page that reloads itself and other requests get 503. A failed server shows its exit code, the last 50 log lines and a Retry link, and is never restarted automatically.
Auth. The button fetches a ticket valid for 60 s (
HMAC(auth token, sid, exp))./__workshop/authswaps it for aworkshop_devcookie that only that host receives, valid for 7 days. Workshop's own token never reaches a dev host.Origin guard (
auth-middleware.ts). Dev hosts count as the same site as Workshop, so the browser would attach Workshop'sSameSite=Strictcookie to requests made by a dev app's pages, including a request to open the terminal WebSocket.extractTokennow ignores Workshop credentials when the request'sOriginis a dev host, or whenSec-Fetch-Siteissame-siteand the request is not a top-level navigation.Process (
src/infrastructure/dev-server/dev-server.ts).dev-<sid>, in the session's workspace.terminal/tmux-flags.ts) plusPORT, and loadsdirenvwhen there's an.envrc.Proxy (
src/server/reverse-proxy.ts). The forwarding code was extracted from the code-server proxy, and/codebehaves the same. For dev hosts it rewritesHost, replaces client-suppliedx-forwarded-*, and strips Workshop cookies, a Bearer carrying the Workshop token, and a?token=holding it.Data and UI.
tracks.dev_commandcolumn, editable in track settings.GET /api/sessions/:sessionId/dev-serverreturns{ url }.opener = null.Deployment and docs.
WORKSHOP_DEV_DOMAINadded to the compose file and the unraid template.docs/docker.md.docs/plans/.What the reviewer should look at first:
auth-middleware.tsisFromDevHost: it changes how every Workshop request is authenticated once the domain is set.reverse-proxy.ts: confirm/codeis unchanged.Setup needed before this works: a wildcard DNS record and certificate for
*.<WORKSHOP_DEV_DOMAIN>, pointing at port 3002 with the Host header kept. Cloudflare's free certificate only covers one level below the zone (seedocs/docker.md).This replaces #57, which published a range of unauthenticated ports.
Test plan
npx vitest run: all 895 tests pass. New tests cover:/api/*on a dev host, a malformed//path;devCommandround-trip through the repository;python3 -m http.server, including exit-code capture.tsc -p tsconfig.server.jsonpasses.tsc -p tsconfig.jsonpasses apart from@xterm/addon-webgl, which is missing from the sharednode_modulesin this environment and fails the same way onmain.npm run build(blocked by the same missing module).🤖 Generated with Claude Code