Skip to content

fix: clean up .reflexio stray plugin copies (#73)#74

Open
yyiilluu wants to merge 1 commit into
mainfrom
fix/issue-73-reflexio-stray-copy-cleanup
Open

fix: clean up .reflexio stray plugin copies (#73)#74
yyiilluu wants to merge 1 commit into
mainfrom
fix/issue-73-reflexio-stray-copy-cleanup

Conversation

@yyiilluu

@yyiilluu yyiilluu commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Removes redirected stray plugin copies under ~/.reflexio once a stable plugin cache root is found.
  • Prunes empty wrapper directories created by host path mangling so .reflexio stops accumulating per-project plugin trees.
  • Adds a regression assertion for the Codex hook stray-copy redirect path.

Test Plan

  • cd plugin && uv run pytest ../tests/test_install_scripts.py::test_codex_hook_redirects_reflexio_stray_copy_to_stable_root -q
  • cd plugin && uv run pytest ../tests/test_install_scripts.py::test_codex_hook_redirects_reflexio_stray_copy_to_stable_root ../tests/test_install_scripts.py::test_codex_hook_ensure_root_tracks_active_plugin_root -q
  • git diff --check

Note: full uv run pytest ../tests/test_install_scripts.py -q was attempted and hit existing environment-sensitive failures unrelated to this change (PATH-limited fake private Node tests and stale managed env test); the targeted regression and adjacent guard passed.

Fixes #73

Summary by CodeRabbit

  • Bug Fixes
    • Plugin system now properly removes stray plugin copies after redirecting them to their stable locations, eliminating unnecessary duplicate directories that may have accumulated.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e7d39756-d4f0-4842-8842-8f7c46d043a9

📥 Commits

Reviewing files that changed from the base of the PR and between 5a79e1e and c7e8859.

📒 Files selected for processing (2)
  • plugin/scripts/codex-hook.js
  • tests/test_install_scripts.py

📝 Walkthrough

Walkthrough

The PR extends the Codex hook's stray plugin copy handling: instead of merely logging redirection, the hook now deletes the stray copy directory from ~/.reflexio after redirecting to a stable plugin root, then iteratively removes empty parent directories while preserving real Reflexio state.

Changes

Stray Plugin Copy Cleanup

Layer / File(s) Summary
Stray plugin copy deletion and cleanup
plugin/scripts/codex-hook.js, tests/test_install_scripts.py
cleanupStrayPluginCopy(root) removes the stray directory via recursive deletion and attempts to prune now-empty parent folders without touching REFLEXIO_DIR state directories. stablePluginRoot(root) invokes this cleanup after finding a stable root. The test now asserts the stray directory is gone and the backend log contains the "removed" message.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Possibly related PRs

  • ReflexioAI/claude-smart#68: Introduces the initial stray copy redirection detection in plugin/scripts/codex-hook.js, which this PR extends with automatic deletion and cleanup.
  • ReflexioAI/claude-smart#26: Establishes the core hook wrapper and root resolution logic that this PR refines by adding post-redirect cleanup.

Poem

🐰 Stray folders cluttered the reflexio home,
We wandered and found where they'd roam,
Now redirect AND delete, no more strays to greet,
Clean parents left empty, their fate bittersweet! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: cleaning up stray plugin copies in .reflexio directory.
Linked Issues check ✅ Passed Changes directly address issue #73 by removing stray plugin copies and pruning empty wrapper directories to prevent accumulation and reduce disk space usage.
Out of Scope Changes check ✅ Passed All changes are scoped to the stated objectives: cleanup logic in codex-hook.js and corresponding test updates for the stray copy cleanup feature.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-73-reflexio-stray-copy-cleanup

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.reflexio takes up too much space.

1 participant