Repository navigation
Remove canonical account directories for uppercase registered IDs - #25126
Conversation
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Canonical removal paths —
ManagedDataAccountProfileRemoval.remove()now derives the profile directory,.pending-deletequarantine directory, andaccounts.json.<id>.rollbackname fromaccountId.toLowerCase(), so an uppercase registered spelling no longer resolves a non-existent directory and orphan the credentials. - Strict identity kept — the registered-id lookup remains case-sensitive with the case-insensitive guard throwing
Managed account not found.for a differently-spelled caller, so behavior is unchanged apart from the on-disk path. - Recovery tests — added a deferred-cleanup case for uppercase registrations and parameterized the quarantine/rollback-failure test over lower/uppercase spellings; verified they fail without the fix (the lowercase pending directory is never quarantined) and pass with it.
The change is correct and well-scoped. Directories are always created lowercase (add() via randomUUID(), requireAccount() at service.ts:247), so removal now matches launch and startup recovery (retry() already lowercases the registered set at profile-removal.ts:173). z.uuid() accepts uppercase, so the case reaches the path logic rather than bailing at validation. I ran the focused suite locally: 25/25 pass.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughProfile removal now lowercases the UUID when building the account, pending-deletion, and rollback-backup paths. The metadata path is unchanged. Tests cover uppercase UUID removal, cleanup after restart, and recovery from rename failures for lowercase and uppercase UUIDs. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to No actionable issue remains in the supplied review evidence; the change is mergeable after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change aligns removal with the directory used to launch an account, while preserving account-ID validation and storage-confinement checks. No new attack path was established. Older interrupted-removal files and duplicate stored identities remain recovery edge cases. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |

ELI5
Removing an account could hide it from Orca while leaving its credentials on disk when its registered UUID used uppercase letters. Removal now uses the same lowercase directory name as account launch.
What Changed
The profile directory, temporary deletion directory and metadata rollback file use the canonical lowercase UUID. Registered IDs keep their original spelling, and a caller using a different spelling is still refused. Existing recovery tests cover uppercase registrations, deferred cleanup and failed rollback.
Why
This extends the existing directory policy to removal and preserves the current recovery mechanism. No separate account lookup or deletion implementation is needed.
Linked Issue
Addresses the account-removal finding on #24662. Credit to the reviewer for identifying the case-sensitive filesystem mismatch.
Visual Proof
N/A — this changes credential-directory removal, with no interface changes. Before/after evidence uses the installed OpenCode CLI and filesystem state.
Testing
auth liststill reads the orphaned dummy credential; after, removal deletes that directory and the unrelated profile still works.Actual reproduction ran on macOS. Filesystem operations remain on the execution host and use existing path joins and removal callbacks for Windows, Linux, SSH and folder workspaces. No wire fields or Git commands change.
Review
Only the existing profile-removal implementation and its recovery test change. The fix preserves UUID validation, directory ownership checks, strict registered identity, metadata rollback, symlink refusal and deferred cleanup.
Agent skill upstream boundary
Notes
Existing historical orphan discovery is outside this focused repair. Initial test setup failures and database housekeeping differences are retained separately from the successful reproduction.
Checklist