Skip to content

Make the Studio build actually run on the linux builder (CS-001) - #176

Merged
Travis-Gilbert merged 3 commits into
mainfrom
feat/ide-substrate-wire
Aug 4, 2026
Merged

Make the Studio build actually run on the linux builder (CS-001)#176
Travis-Gilbert merged 3 commits into
mainfrom
feat/ide-substrate-wire

Conversation

@Travis-Gilbert

Copy link
Copy Markdown
Owner

Follows #175. That PR wired the studio-server stage into the image; deploy d301c820 was the first time the stage had ever run, and it failed in 0.3 seconds.

df -g and du -sg are BSD flags. GNU coreutils rejects both. On Debian df wrote nothing to stdout, the empty string read as 0 in (( 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.sh leaves BASH_SOURCE empty, so under set -u it 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_gib uses df -Pk and divides; fails loudly when it cannot read a volume rather than reporting 0, since an unanswerable probe is not an answer of "full".
  • The node_modules credit uses du -sk and still degrades quietly, because failing to credit an existing tree only makes the floor stricter.
  • smoke-server.sh falls back to cwd when BASH_SOURCE is empty; STUDIO_SERVER_DIR is the intended way in.
  • RUNBOOK records the container invocation.

Validation

  • shellcheck clean on both scripts (exit 0).
  • Swept every packaging/commonplace-studio/scripts/*.sh for other BSD-only constructs: clean.
  • df -Pk and du -sk verified on macOS, so the local path is unchanged.
  • Smoke harness verified end to end against the live container over stdin: it now runs to a real assertion and reports the artifact missing, which is true of the image running today.
  • The Studio compile itself is still unproven. This build is the first that can reach it.

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.
Copilot AI lite review requested due to automatic review settings August 4, 2026 14:13
@Travis-Gilbert
Travis-Gilbert merged commit bdd2767 into main Aug 4, 2026
2 checks passed
@ecc-tools

ecc-tools Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Travis-Gilbert, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6b82382a-9f7e-4587-a8a9-2d03ad87e7e5

📥 Commits

Reviewing files that changed from the base of the PR and between 2ab32f1 and c193fbc.

📒 Files selected for processing (7)
  • .commonplace-canonical
  • docs/plans/console/SPEC-COMMONPLACE-OPENWORK-FORK-1.0.md
  • docs/plans/ide-substrate-wire/FOLLOW-UP-CODE-SERVE-WEB.md
  • packaging/commonplace-studio/RUNBOOK.md
  • packaging/commonplace-studio/scripts/build.sh
  • packaging/commonplace-studio/scripts/smoke-server.sh
  • packaging/workspace/Dockerfile

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 make free_gib fail loudly when the probe can’t produce a numeric answer.
  • Fix the smoke harness when executed over stdin (bash -s) by falling back when BASH_SOURCE is empty (container-first invocation).
  • Ensure the studio-server Docker build stage is actually executed and its output shipped by adding COPY --from=studio-server ... and gating the build on BUILD_STUDIO_SERVER (not runtime IDE_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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

2 participants