Skip to content

Add in-app rebuild and restart from a local macOS workspace - #1

Merged
imann24 merged 2 commits into
mainfrom
codex/local-workspace-rebuild
Oct 7, 2026
Merged

imann24 merged 2 commits into
mainfrom
codex/local-workspace-rebuild

Conversation

@imann24

@imann24 imann24 commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Adds a Rebuild app action in the sidebar and command palette so a packaged macOS app can build a selected local workspace, update itself, and restart. The native folder picker remembers the workspace; the dialog shows build progress and logs while reading remains available.

Builds use a separate Cargo cache, then stage, ad-hoc sign, and verify the new app before exiting. Build failures leave the running app unchanged; the detached installer restores the previous bundle when replacement or the launch command fails. Installer errors are consumed once after relaunch, and worker panics recover to a retryable state.

Custom commands are restricted to the local main window. The rebuild command accepts no caller-supplied workspace path; it uses the native picker's saved selection. Tool discovery uses the current user's environment instead of embedding the build-machine PATH. An older installed app needs this version installed once to gain the control; setup and prerequisites are documented in the README.

Validation

  • 27 frontend unit tests passed.
  • 21 Playwright tests passed, including workspace selection, progress, retry, unavailable runtimes, transient polling failure, and native workspace authority.
  • 13 Rust tests passed; 1 local-journal test intentionally ignored. Regression coverage includes installer rollback, failure-marker consumption, stale logs, panic/poison recovery, duplicate starts, and native window checks.
  • macOS release packaging passed. Separate-cache building and ad-hoc signing/verification were also exercised during implementation.
  • Runtime tool discovery passed with a minimal environment and a temporary workspace containing spaces; generated Tauri app ACL and capability manifests were inspected.
  • Formatting and diff checks passed; dialog layout visually inspected.

Full live self-restart was not manually exercised. Rollback handles launch-command failure, not crashes after macOS accepts the launch request.

@eve-code-review-imann24 eve-code-review-imann24 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.

Adds a "Rebuild app" sidebar/palette action that builds a local workspace with pnpm tauri build, ad-hoc signs the result, swaps the running macOS bundle through a detached installer script and relaunches, with rollback.

Findings: 0 blockers, 4 should-fix, 1 nit.

Docs checked: the docs researcher found no linked ticket, spec, wiki or team conventions for this repo, so I judged the PR against its own description. I read rebuild.rs, rebuild-install.sh and RebuildDialog.tsx in full. I did not review RebuildDialog.css, App.tsx, the test fixture or rebuild.spec.ts in detail, and the PR diff was truncated for rebuild.rs. I did not run anything. The PR notes that a full live self-restart was not exercised manually.

Comment thread src-tauri/src/rebuild.rs Resolved
Comment thread src-tauri/src/rebuild.rs Resolved
Comment thread src-tauri/src/rebuild.rs Resolved
Comment thread src-tauri/src/rebuild.rs Resolved
Comment thread src/components/RebuildDialog.tsx Resolved
@eve-code-review-imann24

Copy link
Copy Markdown

I submitted one review on PR #1 as a COMMENT. It has no blockers, 4 should-fix findings and 1 nit. I didn't run any tests or builds.

The findings:

  • Stale failed state (rebuild.rs): the failed state is read from the last Update failed: line in a log file that survives restarts. After any failed in-app build, every later launch opens with that old error until the next rebuild overwrites the log.
  • Stuck building phase (rebuild.rs): if the worker thread panics, the status stays building forever and the UI keeps rebuild disabled until the app is restarted. In the same code, the previous run's log briefly shows up as the new build's output.
  • Arbitrary workspace path (rebuild.rs): rebuild_app runs pnpm exec tauri build in any directory the webview passes, and the only check is a copyable tauri.conf.json identifier. I asked the author to confirm that src-tauri/capabilities/default.json limits these commands to the main window, and to consider only accepting paths from the folder picker or the saved preference.
  • Sticky error (RebuildDialog.tsx): one failed status poll sets an error that is never cleared, so the alert stays even after polling recovers.
  • Build PATH baked in (rebuild.rs, nit): build.rs embeds the full build-machine PATH into every binary, including release builds.

The docs researcher found no linked ticket, spec, wiki or conventions, so I judged the PR against its own description. I read rebuild.rs, rebuild-install.sh and RebuildDialog.tsx in full. I didn't review the CSS, App.tsx, the test fixture or the Playwright spec in detail.

@eve-code-review-imann24

Copy link
Copy Markdown

starting review...

@eve-code-review-imann24 eve-code-review-imann24 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.

This PR adds a "Rebuild app" action that builds a local workspace, ad-hoc signs it, swaps the running macOS bundle through a detached installer, and relaunches with rollback.

Findings: 0 blockers, 0 should-fix, 0 nits. I checked the update (e6bd68b) against each point from my earlier review:

  • Stale failed state: the installer now writes a one-shot marker file that is consumed on first read. Old build logs no longer set the phase to failed on later launches.
  • Stuck building phase: the worker runs under catch_unwind with poison-tolerant locking, and panic is now unwind. A panic or a failure to spawn the worker ends in a retryable failed status. begin_rebuild also clears the previous log, so the dialog no longer shows it for the new run.
  • Arbitrary workspace path: rebuild_app no longer takes a path from the webview. The workspace comes from the native folder picker and is saved in the app config directory. It is validated at pick time and again at build time. The rebuild commands are restricted to the main window by a native label check and by a Tauri ACL. I confirmed in tauri-build that src-tauri/permissions/*.toml is picked up without changes to build.rs, and that validate_capabilities fails the build if a permission name is wrong.
  • Build PATH baked in: removed. Tools are now found at runtime by rebuild-build.sh.
  • Sticky poll error: poll errors are now kept in separate state and cleared on the next successful poll.

Docs checked: none applied. The docs researcher found no ticket, spec, wiki or team conventions for this repo. I read rebuild.rs, both shell scripts, the ACL and capability files and RebuildDialog.tsx. I did not run the build or tests. The Playwright mocks can't exercise the real ACL or the live self-restart, as the PR already notes. I'd run the packaged app once and confirm that opening a journal and the Rebuild dialog both work under the new permissions.

@eve-code-review-imann24

Copy link
Copy Markdown

I approved PR #1 at head e6bd68b. That review has no blockers, should-fix findings or nits, and every point from my first review is addressed. I didn't build or run the tests.

  • Stale failed state: the installer now writes a one-shot marker file that is consumed on first read, so old build logs no longer mark later launches as failed.
  • Stuck building phase: the worker catches panics and tolerates a poisoned lock, so a panic ends in a retryable failed status. begin_rebuild also clears the previous log, so the dialog no longer shows it for the new run.
  • Arbitrary workspace path: rebuild_app no longer takes a path from the webview. The workspace comes from the native folder picker and is validated when picked and again at build time. The commands are limited to the main window by a label check and by a Tauri ACL (permission) file. I checked in tauri-build that src-tauri/permissions/*.toml is picked up without changes to build.rs.
  • Build PATH baked in: removed. rebuild-build.sh now finds the tools at runtime.
  • Sticky poll error: poll errors are now kept in separate state and cleared on the next successful poll.

I did not review the CSS, App.tsx, the test fixture or the Playwright spec in detail. I also noted in the review that the Playwright mocks can't exercise the real ACL or a live self-restart, and suggested running the packaged app once under the new permissions.

@imann24
imann24 merged commit a8c2ff7 into main Oct 7, 2026
2 checks passed
@imann24
imann24 deleted the codex/local-workspace-rebuild branch October 7, 2026 13:30
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.

1 participant