Skip to content

fix(desktop): edit the default profile's SOUL.md from a single-profile setup#42871

Merged
OutThisLife merged 1 commit into
NousResearch:mainfrom
xxxigm:fix/desktop-profile-manage-and-delete
Jun 10, 2026
Merged

fix(desktop): edit the default profile's SOUL.md from a single-profile setup#42871
OutThisLife merged 1 commit into
NousResearch:mainfrom
xxxigm:fix/desktop-profile-manage-and-delete

Conversation

@xxxigm

@xxxigm xxxigm commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Bug 1 from the original PR — the only part still unfixed on main.

The "..." Manage-profiles overflow in the sidebar rail is the only UI that opens the profile manager (and thus the SOUL.md editor). It was gated behind profiles.length > 1, so a user with only the default profile couldn't edit the default's persona without first creating a throwaway second profile.

Fix: render the Manage overflow unconditionally in profile-switcher.tsx. The colored named squares and the default↔all toggle still only appear once a second profile exists.

Scope trimmed per review

Rebased on latest main and reduced to just the profile-switcher.tsx change, per @OutThisLife's review:

  • Dropped the Electron main.cjs change — superseded by prepareProfileDeleteRequest() / teardownPoolBackendAndWait on main (deterministic backend-exit wait instead of a fixed delay, plus primary-profile handling and PROFILE_NAME_RE validation).
  • Dropped the profiles.py / main.py changes — covered by main's existing remove_error + RuntimeError raise and cmd_profile's catch.

Test plan

  • Lint clean
  • Manual (desktop, single default profile): the "..." overflow is visible and opens the SOUL.md editor for default.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels Jun 9, 2026

@tonydwb tonydwb 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.

Code Review Summary

Verdict: Approved

Changes Overview

  • Fixes Windows profile deletion reliability by stopping the pooled dashboard backend before removal
  • Makes SOUL.md editable for default profile even in single-profile setups
  • Surfaces a hard error when directory deletion fails instead of falsely reporting success

Analysis

Correctness

  • The fix correctly addresses the Windows handle-exclusion issue where a running Hermes process keeps state.db/logs open
  • The stopPoolBackend call + 300ms delay is a reasonable workaround
  • The new RuntimeError when directory survives removal prevents false success reporting

Security

  • No security concerns

Code Quality

  • Excellent documentation in comments explaining the Windows handle issue and why the delay is needed
  • The ProfilePill change (always show Manage) is appropriately justified with comments

Testing

  • Good test coverage for the new RuntimeError behavior
  • Test verifies both the exception and that the directory remains on disk

Reviewed by Hermes Agent

@OutThisLife OutThisLife left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this — the SOUL.md fix is still wanted, but main has moved since the approval and the PR now conflicts (CONFLICTING), so it needs a rebase and a trim before it can land. Most of Bug 2 is already handled upstream, and in a more robust way than this branch.

Bug 2, electron side: main already wires prepareProfileDeleteRequest() into the hermes:api handler (apps/desktop/electron/main.cjs). It deterministically waits for the target profile's backend to exit (teardownPoolBackendAndWait -> waitForBackendExit) rather than sleeping a fixed 300ms, also handles the primary/active profile (teardownPrimaryBackendAndWait), and validates the name against PROFILE_NAME_RE (the /^\/api\/profiles\/([^/]+)$/ regex here also matches a trailing query/hash). Re-adding the 300ms version would regress that path.

Bug 2, Python side: main's delete_profile already records remove_error and raises RuntimeError when removal fails, and cmd_profile already catches RuntimeError. The if profile_dir.exists(): raise added here overlaps with that and would double up. It does cover one extra case (rmtree returning without raising yet the dir surviving), but _make_writable re-raises on real failures, so that's mostly belt-and-suspenders.

Bug 1 is the part that's still genuinely unfixed on main: profile-switcher.tsx still gates the Manage overflow behind multiProfile, so a single-profile user can't reach the SOUL.md editor. That one-line ungating (plus the comment) is good as-is.

Could you rebase on main and reduce this to just the profile-switcher.tsx change? Drop the electron change (superseded) and the main.py/profiles.py changes (covered by the existing remove_error raise), unless you want to reconcile the exists() check into that existing path in a single spot. Happy to re-review once it's down to the SOUL.md fix. Not approving in the meantime since merging as-is would bring back the weaker delete handling.

The "..." overflow that opens the profile manager (the only UI to edit a
profile's SOUL.md) was gated behind profiles.length > 1, so a user with
only the default profile couldn't edit its persona without first creating
a throwaway second profile. Render it unconditionally.
@xxxigm xxxigm force-pushed the fix/desktop-profile-manage-and-delete branch from 40c4109 to 30f7637 Compare June 9, 2026 23:53
@xxxigm xxxigm changed the title fix(desktop): edit default profile's SOUL.md + reliable profile delete fix(desktop): edit the default profile's SOUL.md from a single-profile setup Jun 9, 2026
@xxxigm

xxxigm commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed review @OutThisLife — agreed on all points.

Rebased on latest main and trimmed the PR down to just the profile-switcher.tsx ungating (Bug 1):

  • Dropped the Electron main.cjs change — prepareProfileDeleteRequest() / teardownPoolBackendAndWait on main supersede it (deterministic backend-exit wait + primary-profile handling + PROFILE_NAME_RE).
  • Dropped the profiles.py / main.py changes — main's existing remove_error + RuntimeError raise (caught by cmd_profile) already covers it.

It's now a single commit changing only profile-switcher.tsx. Ready for re-review.

@OutThisLife OutThisLife left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the trimmed PR — LGTM, approving.

Verified both "superseded by main" calls against origin/main:

  • main.cjs — correct to drop. prepareProfileDeleteRequest + teardownPoolBackendAndWait already do a deterministic SIGTERMawait waitForBackendExit(...) (vs the original setTimeout(300ms)), plus active/primary-profile handling (primaryProfileKey() → switch to default + teardownPrimaryBackendAndWait) and PROFILE_NAME_RE validation. Strictly better than the removed change.
  • profiles.py / main.py — also correct. profiles.py already accumulates remove_error and raises RuntimeError("Could not remove profile directory …") when the dir survives removal, with except RuntimeError handling downstream. The failed-deletion detection is covered.

Remaining change is a single commit touching only profile-switcher.tsx: ungating the Manage pill so a single-profile user can reach the manage overlay to edit the default profile's SOUL.md without creating a throwaway profile. multiProfile is still used for the named squares and the default↔all toggle, so nothing's orphaned. Comment accurately describes the new behavior.

Thanks for the clean rebase.

@OutThisLife OutThisLife merged commit 59ea2f9 into NousResearch:main Jun 10, 2026
20 checks passed
wachoo pushed a commit to wachoo/hermes-agent that referenced this pull request Jun 10, 2026
…42871)

The "..." overflow that opens the profile manager (the only UI to edit a
profile's SOUL.md) was gated behind profiles.length > 1, so a user with
only the default profile couldn't edit its persona without first creating
a throwaway second profile. Render it unconditionally.
changman pushed a commit to changman/hermes-agent that referenced this pull request Jun 10, 2026
…42871)

The "..." overflow that opens the profile manager (the only UI to edit a
profile's SOUL.md) was gated behind profiles.length > 1, so a user with
only the default profile couldn't edit its persona without first creating
a throwaway second profile. Render it unconditionally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard 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.

4 participants