Skip to content

chore: improve dev slot system - #795

Merged
paperclover merged 1 commit into
mainfrom
push-torzynrpnnrr
Oct 26, 2026
Merged

paperclover merged 1 commit into
mainfrom
push-torzynrpnnrr

Conversation

@paperclover

Copy link
Copy Markdown
Contributor

Summary

support jujutsu and running a dev server on the desktop app

Test plan

  • Works on my machine

Assisted-by: gpt-6.1-terra

@paperclover paperclover added the auto-merge Queue for automatic merge once all checks pass label Oct 26, 2026
@greptile-apps

greptile-apps Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 3/5

[Medium impact] The changes affect local development slots and a macOS desktop launch path.

Fix the registry switch that deletes saved dev data and the desktop process left alive by cleanup before merging.

Findings

  1. P1 Switching to Jujutsu deletes data ▶
  2. P1 Desktop outlives its slot ▶
Fix with agent prompt
### Issue 1
scripts/dev-slot.mjs:116
Switching an existing checkout to colocated Jujutsu changes `launchRegistry` without moving its saved reservations. For a stopped slot, the next `start` finds no reservation in `jj-launch.json`, treats the matching slot as an orphan, and deletes its data before creating it again. Projects and runs saved in the dev database are silently lost. Read or migrate the old reservation before allowing orphan cleanup.

### Issue 2
scripts/dev-slot.mjs:680-684
The desktop child is detached but never recorded in slot state, so `stop` and `cleanup` leave it running. `cleanup` can delete its files and release its ports for another checkout while the old window still points at those ports. Reloading that window then opens the other checkout's dashboard. Track the desktop process and stop it before deleting or reassigning the slot.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR adds Jujutsu workspace support and a macOS desktop window for dev slots.

  • Jujutsu checkouts can use the dev-slot helper.
  • Dev slots can open their UI in a separate macOS app window.

Reviews (1) · Last reviewed commit: "chore: improve dev slot system" · Reviewed by Greptile

Comment thread scripts/dev-slot.mjs
allocatorRoot,
cargoTargetDir: path.join(allocatorRoot, 'cargo-target'),
launchRegistry: path.join(info.mainCheckout, '.claude', 'launch.json'),
launchRegistry: info.jj ? path.join(allocatorRoot, 'jj-launch.json') : path.join(info.mainCheckout, '.claude', 'launch.json'),

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.

P1 Switching to Jujutsu deletes data

Switching an existing checkout to colocated Jujutsu changes launchRegistry without moving its saved reservations. For a stopped slot, the next start finds no reservation in jj-launch.json, treats the matching slot as an orphan, and deletes its data before creating it again. Projects and runs saved in the dev database are silently lost. Read or migrate the old reservation before allowing orphan cleanup.

Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/dev-slot.mjs
Line: 116

Comment:
**Switching to Jujutsu deletes data**

Switching an existing checkout to colocated Jujutsu changes `launchRegistry` without moving its saved reservations. For a stopped slot, the next `start` finds no reservation in `jj-launch.json`, treats the matching slot as an orphan, and deletes its data before creating it again. Projects and runs saved in the dev database are silently lost. Read or migrate the old reservation before allowing orphan cleanup.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment thread scripts/dev-slot.mjs
Comment on lines +680 to +684
const child = spawn(executable, ['--dev-desktop', String(slotPaths.uiPort)], {
detached: true, stdio: 'ignore', env: { ...process.env, ...slotEnvironment(slotPaths) },
})
child.on('error', (error) => console.error(`Could not open the desktop app: ${error.message}`))
child.unref()

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.

P1 Desktop outlives its slot

The desktop child is detached but never recorded in slot state, so stop and cleanup leave it running. cleanup can delete its files and release its ports for another checkout while the old window still points at those ports. Reloading that window then opens the other checkout's dashboard. Track the desktop process and stop it before deleting or reassigning the slot.

Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/dev-slot.mjs
Line: 680-684

Comment:
**Desktop outlives its slot**

The desktop child is detached but never recorded in slot state, so `stop` and `cleanup` leave it running. `cleanup` can delete its files and release its ports for another checkout while the old window still points at those ports. Reloading that window then opens the other checkout's dashboard. Track the desktop process and stop it before deleting or reassigning the slot.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@paperclover
paperclover merged commit b310585 into main Oct 26, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Queue for automatic merge once all checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant