Skip to content

fix(desktop): prevent deleted profile respawn - #88120

Merged
teknium1 merged 1 commit into
NousResearch:mainfrom
helix4u:agent/fix-desktop-profile-delete-respawn
Aug 17, 2026
Merged

teknium1 merged 1 commit into
NousResearch:mainfrom
helix4u:agent/fix-desktop-profile-delete-respawn

Conversation

@helix4u

@helix4u helix4u commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Prevents Hermes Desktop from recreating a named profile immediately after it is deleted.

The existing delete interception stopped only the legacy pool entry and routed the DELETE request itself away from the deleted profile. The connections registry can also hold an explicit-local backend under conn:local::<profile>, while concurrent or delayed renderer work can already be waiting to start another backend. Either path can run ensure_hermes_home() after the profile directory is removed and resurrect it.

This change:

  • drains both local pool scopes, including the explicit-local registry entry;
  • blocks concurrent starts for the profile for the lifetime of the DELETE request;
  • rechecks the deletion barrier after awaited boot work; and
  • verifies that a named profile directory still exists at the final local process-spawn boundary, rejecting delayed retries after deletion completes.

The fix is generic Desktop lifecycle coordination. It does not add plugin-specific behavior.

Related Issue

Regression follow-up to #52279.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • apps/desktop/electron/main.ts: coordinate deletion with both local backend pool scopes and guard the final local spawn boundary.
  • apps/desktop/electron/profile-delete-routing.ts: add the process-local deletion gate, final local-start validation, and local pool-key enumeration.
  • apps/desktop/electron/profile-delete-routing.test.ts: cover concurrent deletion leases, deferred starts, delayed retries after directory removal, and both pool-key shapes.

How to Test

  1. Create and warm a non-default local profile so Desktop has a pooled backend for it, including through the explicit-local connection route.
  2. Delete the profile through Desktop or the Desktop SDK host.deleteProfile path while renderer connection work is active.
  3. Confirm the profile directory stays absent and Desktop does not start another backend with --profile <deleted-name>.

Focused verification run:

  • npm run typecheck
  • eslint electron/main.ts electron/profile-delete-routing.ts electron/profile-delete-routing.test.ts
  • vitest run --project electron electron/profile-delete-routing.test.ts (19 passed)

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Windows 11

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

The full Electron project run completed with 1,259 passing tests and 28 pre-existing Windows-host failures in POSIX file-mode, SSH control-socket, POSIX path, and temp-directory cleanup cases. The focused regression suite, targeted lint, and complete Desktop typecheck pass.

@helix4u
helix4u marked this pull request as ready for review August 17, 2026 03:49
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/desktop Electron desktop app (apps/desktop/*) area/profiles Multi-profile isolation, HERMES_HOME scoping labels Aug 17, 2026
@teknium1
teknium1 merged commit 2038d40 into NousResearch:main Aug 17, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/profiles Multi-profile isolation, HERMES_HOME scoping comp/desktop Electron desktop app (apps/desktop/*) P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants