Skip to content

fix(rebuild): the rebuild script deletes a restarted hub's fresh handshake, then exits 1 after a successful deploy #1797

Open

Description

@jeonghun-jj-lee

Important

Problem — On 2026-10-13, rebuilding the Mac Studio (a hub machine) from main with the terminal rebuild script to deploy #1781 hit two defects. Both happened after the deploy itself had succeeded.

Defect 1: the script deletes the restarted hub's handshake. When the engine overlay has changed, the script stops the running engine and then deletes the handshake record unconditionally. On a machine whose hub runs as a launchd KeepAlive service, launchd has already restarted the hub, and within about a second the new hub writes a fresh handshake. The script then deletes that new one. On the Studio the hub came up at 17:15:47, wrote its handshake, and the record was gone at 17:15:48. The hub writes its handshake only at startup, so every window on the machine is left without one. A window reload then finds the engine's port in use with no handshake, takes the reclaim path, and restarts the hub at an uncontrolled moment. Recovering took a second, manual hub restart.

Defect 2: the script exits 1 after a successful deploy. The step that rehomes sessions from deleted worktrees ends on a conditional that is false when nothing needed rehoming, so the function returns non-zero. Under the script's exit-on-error setting the script stops there, after the deploy has completed but before its final summary, and exits 1.

Approach — Delete the handshake only while it still names the process the script stopped. Give the rehome step an explicit successful return.

Acceptance Criteria

  • A rebuild that stops a launchd-managed hub leaves the restarted hub's handshake in place, still naming the new engine and its binary hash.
  • A rebuild where no session needs rehoming exits 0 and prints its final deploy summary.
  • A rebuild on a machine whose handshake names a dead process still clears that stale record, as it does today.

Notes

Activity

  1. added
    bugSomething isn't working
    afkImplementable without human interaction
    on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

afkImplementable without human interactionbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions