jobizzness / jobizzness/bench

bench restart --build cannot build, so it never restarts

Open
#85 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
1h 21m
Merged PRs (30d)
41

Description

`bench restart --build` cannot build on this checkout, so it never restarts — and it says so in a way that reads like a safety feature rather than a broken one.

## The evidence

`src/cli/restart.ts:140` spawns the build as pnpm:

```js
const child = spawn("pnpm", ["build"], { cwd, stdio: "inherit" });
```

and `pnpm build` fails immediately here:

```
$ pnpm build
ERROR packages field missing or empty
For help, run: pnpm help run
```

`pnpm-workspace.yaml` has no `packages:` key, in the committed version or with the local `allowBuilds` additions:

```yaml
allowBuilds:
esbuild: true
```

`restart.ts:147` then reports `build failed (); the running daemon has not been touched` and stops. That behaviour is correct and deliberate — the comment on it is right that restarting onto an unbuilt tree is how you end up with no cockpit. The problem is that the build cannot succeed at all, so `--build` is unusable, and the daemon quietly stays on whatever old code it was started with.

This is how #75's daemon half sat un-deployed for a day: the client was rebuilt and deployed repeatedly, `registry.ts` never went live, and mobile dispatch stayed broken.

`npm run build` runs the identical script from `package.json` and succeeds.

## Acceptance criteria

- [ ] `pnpm build` succeeds from a clean checkout, or the CLI stops depending on it.
- [ ] `bench restart --build` completes and brings the daemon up on the new code.
- [ ] A genuine build failure still leaves the running daemon untouched — do not fix this by removing the guard.
- [ ] Whichever way it is fixed, `pnpm build` and `npm run build` do not diverge; one should not work while the other does not.

## Out of scope

- The `allowBuilds` entries currently uncommitted in the working tree — decide separately whether those belong in the repo.
- Anything else in the restart path.

## Verification

```
pnpm build
pnpm typecheck
```

Then, on a machine with a daemon running: `bench restart --build`, and confirm from `bench ls` that the roster comes back.

## Related

- #75 — the change that was built and deployed but never actually ran, because of this.

Contributor guide

Open the contributing guide

Research direction

Start with src/cli/restart.ts:140-147 to trace the build command and preserved daemon guard, then compare the build script in package.json with pnpm-workspace.yaml. Run pnpm build, pnpm typecheck, and npm run build from a clean checkout. Done means both package managers agree, restart --build brings the daemon back, and genuine build failures leave it untouched.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.