Make the Studio build actually run on the linux builder (CS-001) - #176
Conversation
CS-003, reopened. Deploy 4e33d620 built green off 01143ad and /opt/commonplace/studio-server was absent from the running container. Two independent defects, either one fatal alone. No COPY --from=studio-server existed anywhere. The stage wrote /out and the final image never took it, and BuildKit prunes a stage nothing copies from, so the fork was not merely uncopied, it was never compiled. That is why a build carrying the mangler patch finished without ever reaching the mangler. The gate shared a name with the runtime switch. Railway injects every service variable into whatever ARG a stage declares, so IDE_HOST set on the service to keep the runtime host on code-server during cutover would have switched the build off too. The safe-cutover shape this plan rests on, ship both binaries and flip a variable, was unreachable: pinning the variable deleted the binary from the next image. The stage is now gated on BUILD_STUDIO_SERVER, IDE_HOST is runtime only and the dead ARG in the base stage is gone, and the COPY exists. At BUILD_STUDIO_SERVER=0 the stage still writes /out so the COPY stays valid; what it omits is the launcher, which is the file entrypoint.sh probes with -x, so a skipped build falls back to code-server by itself. Proof is the container, not the Dockerfile. The previous done was read off the source, which is how this survived a green build.
The artifact is linux and a mac cannot build it, so the only machine that ever holds one is the container. The way in is railway ssh 'STUDIO_SERVER_DIR=... bash -s' < scripts/smoke-server.sh and piped that way there is no BASH_SOURCE, so under set -u the root derivation aborted at line 12 before a single check ran. A harness that only works when it lives on disk cannot smoke the one place that matters. Fall back to the cwd when BASH_SOURCE is empty. Spelled as an explicit if rather than A && B || C, which is the same SC2015 shape the expect helpers in this file already exist to avoid; shellcheck stays clean. Verified against the live container both ways: it now runs to a real assertion and reports the artifact missing, which is true of the image running today and is the thing the next deploy is meant to change.
Deploy d301c820 was the first time the studio-server stage ever ran, and build.sh server refused in 0.3s on a builder with hundreds of GiB free. `df -g` and `du -sg` are BSD flags. GNU coreutils rejects both, so on Debian df wrote nothing, the empty string read as 0 in the arithmetic, and every floor refused. Written on the mac, never run on linux, which is the same shape as the stage that was never copied. `df -Pk` and `du -sk` are POSIX and identical on both platforms; -P also keeps a long device name from wrapping and shifting the column. The free probe now fails loudly when it cannot read a volume instead of reporting 0, because a probe that cannot answer is not an answer of "full", and conflating the two is what produced a refusal nobody believed. The node_modules credit still degrades quietly, since failing to credit an existing tree only makes the floor stricter. Swept the other studio scripts for the same authoring bias: clean. Both forms verified on macOS so the local path is unchanged.
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
|
Warning Review limit reached
Next review available in: 54 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes Linux builder/runtime breakages in the Commonplace Studio workspace image pipeline by removing BSD-only df/du flags, hardening disk-space probes, and making the Studio build stage reliably run and be copied into the final image.
Changes:
- Make Studio disk-space guards portable on Debian by switching to
df -Pk/du -sk, and makefree_gibfail loudly when the probe can’t produce a numeric answer. - Fix the smoke harness when executed over stdin (
bash -s) by falling back whenBASH_SOURCEis empty (container-first invocation). - Ensure the
studio-serverDocker build stage is actually executed and its output shipped by addingCOPY --from=studio-server ...and gating the build onBUILD_STUDIO_SERVER(not runtimeIDE_HOST).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packaging/workspace/Dockerfile | Switch Studio build gate to BUILD_STUDIO_SERVER and ensure Studio artifacts are copied into the final image so the stage actually runs. |
| packaging/commonplace-studio/scripts/build.sh | Replace BSD-only df -g/du -sg with portable probes and make free-space detection fail loudly on unreadable volumes. |
| packaging/commonplace-studio/scripts/smoke-server.sh | Make smoke script runnable via bash -s by not requiring BASH_SOURCE to be set. |
| packaging/commonplace-studio/RUNBOOK.md | Document the stdin-based container invocation for the smoke harness. |
| docs/plans/ide-substrate-wire/FOLLOW-UP-CODE-SERVE-WEB.md | Update plan/rollback text to reflect BUILD_STUDIO_SERVER and the corrected “COPY makes the stage real” lesson. |
| docs/plans/console/SPEC-COMMONPLACE-OPENWORK-FORK-1.0.md | Align spec amendment A14 wording with the new build-time gate and the required COPY from the stage. |
| .commonplace-canonical | Update registry notes to reflect the new rollback arg and the Railway ARG-injection pitfall. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c193fbc4b4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # nothing to select, which is how an image that was supposed to ship both hosts | ||
| # quietly shipped one. The stage asserts its own launcher with `test -x`, so a | ||
| # broken Studio build fails the image here rather than at container start. | ||
| COPY --from=studio-server /out/ /opt/commonplace/studio-server/ |
There was a problem hiding this comment.
Add Studio sources to Railway's watched inputs
When a follow-up changes only packaging/commonplace-studio/** (such as UPSTREAM_TAG, the product overlay, patches, or build scripts), Railway will not rebuild this image: packaging/workspace/railway.toml watches packaging/workspace/** and several application paths, but not the Studio directory. This COPY makes those sources real production-image inputs, so the watch list should include them or deployments can continue serving a stale Studio artifact.
Useful? React with 👍 / 👎.
Follows #175. That PR wired the
studio-serverstage into the image; deployd301c820was the first time the stage had ever run, and it failed in 0.3 seconds.df -ganddu -sgare BSD flags. GNU coreutils rejects both. On Debiandfwrote nothing to stdout, the empty string read as0in(( build_free < need_build )), and every disk floor refused a builder with hundreds of GiB free. The guards were written on the mac and had never run on linux, which is the same shape as a stage that was never copied.Also fixes the smoke harness for the same class of problem:
railway ssh 'bash -s' < smoke-server.shleavesBASH_SOURCEempty, so underset -uit aborted before a single check ran. The container is the only machine that will ever hold a linux artifact, so a harness that only runs from disk cannot smoke the thing that matters.Changes
free_gibusesdf -Pkand divides; fails loudly when it cannot read a volume rather than reporting0, since an unanswerable probe is not an answer of "full".node_modulescredit usesdu -skand still degrades quietly, because failing to credit an existing tree only makes the floor stricter.smoke-server.shfalls back to cwd whenBASH_SOURCEis empty;STUDIO_SERVER_DIRis the intended way in.Validation
shellcheckclean on both scripts (exit 0).packaging/commonplace-studio/scripts/*.shfor other BSD-only constructs: clean.df -Pkanddu -skverified on macOS, so the local path is unchanged.