Skip to content

Commit 252cf1f

Browse files
authored
fix(cmd): unwrap build errors, remove premature startup message (#180)
1 parent 4fe9837 commit 252cf1f

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

internal/cmd/root.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,9 @@ var rootCmd = &cobra.Command{
123123
}
124124

125125
if !running {
126-
_, _ = color.New(color.FgCyan).Printf("Starting workspace %s...\n", ws.Name)
127126
workspaceExplicit = true
128127
if err := runUp(ctx, nil); err != nil {
129-
return fmt.Errorf("start workspace %q: %w", ws.Name, err)
128+
return err
130129
}
131130
_, _ = color.New(color.FgCyan).Printf("Waiting for OpenCode to be ready...\n")
132131
if err := waitForReadiness(ctx, ws.Port, ws.ExposePort, client); err != nil {

internal/docker/docker.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,12 @@ func BuildOverlayImage(ctx context.Context, base string, ws workspace.Resolved)
628628
return "", fmt.Errorf("close temporary workspace Dockerfile %q: %w", tmpDockerfilePath, err)
629629
}
630630

631+
// Workspace overlays are rebuilt unconditionally on every workspace startup.
632+
// We do NOT check whether overlayTag already exists locally and skip the build —
633+
// that would silently run a stale image when the user edits their Dockerfile
634+
// but the edit produces a build error. Build failure must abort startup.
635+
// Daemon-side layer cache already provides the fast path for unchanged Dockerfiles;
636+
// adding a second cache layer here would only mask user errors.
631637
hash := sha256.Sum256(dockerfileContent)
632638
hashHex := fmt.Sprintf("%x", hash)
633639
overlayTag := fmt.Sprintf("jailoc-%s:%s", ws.Name, hashHex[:8])

0 commit comments

Comments
 (0)