Skip to content

Leave a dangling shared symlink alone when setting up an agent account - #14103

Merged
omarchybot merged 4 commits into
omacom:quattrofrom
manuaudio:fix/account-shared-dangling-symlink
Oct 31, 2026
Merged

omarchybot merged 4 commits into
omacom:quattrofrom
manuaudio:fix/account-shared-dangling-symlink

Conversation

@manuaudio

Copy link
Copy Markdown
Contributor

Adding, switching to or auto-switching between agent accounts fails outright when one of the primary home's shared folders is a symlink whose target doesn't exist yet. A dotfiles link like ~/.claude/skills -> ~/dotfiles/claude/skills before the dotfiles have synced is one example.

link_shared() in bin/omarchy-agent-account-state runs (primary / name).mkdir(parents=True, exist_ok=True) for every shared folder. On a dangling symlink, exist_ok doesn't help: mkdir raises FileExistsError. So omarchy agent account add claude Work dies with a traceback and "Couldn't set up a home for the new account.". It also leaves its scratch home in accounts/claude/.pending/login-*, because begin() doesn't clean up after itself. use and the automatic switch go through the same function.

  • A shared folder that is already a symlink is left as it is, since it's the person's own setup. The account still links to it, so it starts sharing as soon as the target exists.
  • begin() removes its scratch home if setting it up fails, so a failure no longer leaves a stray login-* folder.

Testing

agent-account-test.sh makes ~/.claude/skills a dangling symlink before the first add. It checks that the add succeeds, that the user's link is untouched and still shared into the new account, and that .pending is empty afterwards. On quattro the add fails with the FileExistsError above (not ok - adding an account works when a shared folder is a dangling symlink). With this change all 28 checks pass.

Found while auditing the new multi-account flow from #13770 in a sandboxed HOME.

🤖 Generated with Claude Code

@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no outstanding findings remain.

Summary

The PR preserves dangling shared-folder symlinks during account setup and removes scratch homes when setup fails. The latest change checks that the failed-add test reports the expected setup error.

Reviews (4) · Last reviewed commit: "Test failed account setup error" · Reviewed by Greptile

Comment thread bin/omarchy-agent-account-state Resolved
Comment thread test/shell.d/agent-account-test.sh Resolved

@chessing234 chessing234 left a comment

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.

everything seems fine, ready to merge.

@omarchybot omarchybot added the bug Something isn't working label Oct 15, 2026
quattro now writes a recovery receipt into the scratch home right after linking the shared folders. Both steps sit inside the cleanup, so a home that fails either is removed rather than left in .pending without a receipt recovery can read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 15, 2026
Comment thread test/shell.d/agent-account-test.sh Resolved
@omarchybot omarchybot added the ready Good to merge label Oct 15, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and verified. The bug is real on current quattro: with ~/.claude/skills as a dangling symlink, omarchy agent account add claude Work fails with [Errno 17] File exists and "Couldn't set up a home for the new account."

This branch conflicted with quattro in begin(), which now writes a login receipt into the scratch home after linking the shared folders. I merged quattro into the branch (187c0a7) and put both steps inside your cleanup, so a home that fails either one is removed instead of being left in .pending. Nothing else changed.

Checked on a disposable Omarchy worker: test/shell.d/agent-account-test.sh fails on quattro with the error above, passes at this head (29 checks), and fails again with only the link_shared() change undone. ./test/cli is green, and so is CI.

Second opinion from Codex Medium reviewed the combined change against quattro, including every caller of link_shared(), symlink loops, relative links and links to files on the installed Python, and the merge resolution. It found no defects. Its independence from my review is not guaranteed.

This is now waiting on the maintainer.

@manuaudio

manuaudio commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @chessing234 — I appreciate the review. I rechecked the current head and also tightened the failed-setup regression in e99d60bae so it proves the expected error path. The focused checks pass, the branch is clean, and both GitHub checks are green.

@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge and removed verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 16, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-checked at e99d60b. The new commit adds one assertion to test/shell.d/agent-account-test.sh: when a shared folder is a regular file, the failed add now has to print "Couldn't set up a home for the new account." That pins the failure to omarchy-agent-account-state begin (bin/omarchy-agent-account-add:217), which was the point Greptile raised. The string matches default/i18n/en/cli.json, and the test can't run in another language by accident, because test/shell.d/base-test.sh points OMARCHY_LANGUAGE_FILE at a missing file, so it always gets English.

On a worker built from the Omarchy ISO, at this head: agent-account-test.sh passes all 29 checks. The same test fails on current quattro (33783b1) and fails again with the fix in bin/omarchy-agent-account-state reverted, both with [Errno 17] File exists on the dangling ~/.claude/skills link. The full ./test/cli suite is green, and both CI checks are green.

The second opinion came from Codex Medium, which found nothing wrong with the new lines and agreed the change is still proportionate. Independence is not guaranteed. The locale point above came from Codex, and I checked it against the file. It merges cleanly into current quattro. Labelled verified and ready again. It's waiting on the maintainer.

@omarchybot
omarchybot merged commit f51ecf1 into omacom:quattro Oct 31, 2026
2 checks passed
@emirb emirb added this to the 4.5 milestone Nov 5, 2026
berenddeboer pushed a commit to berenddeboer/omarchy that referenced this pull request Nov 6, 2026
omacom#14103)

* Leave a dangling shared symlink alone when setting up an agent account

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Only skip a dangling shared link, and test failed-setup cleanup

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Test failed account setup error

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Omarchybot <[email protected]>
(cherry picked from commit f51ecf1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants