Skip to content

fix(codex): purge the plugin data Codex keeps for a root-manifest package - #966

Merged
777genius merged 3 commits into
mainfrom
fix/codex-purge-native-data
Nov 17, 2026
Merged

777genius merged 3 commits into
mainfrom
fix/codex-purge-native-data

Conversation

@777genius

@777genius 777genius commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #959.

remove --purge-data in user scope reported data_retained: false but left the plugin's data on disk. The managed Codex artifact keeps the package's root plugin.json and mcp.json. Codex 0.162 prefers them over the projected .codex-plugin layout and writes plugin data into its own profile, so the installer's purge never saw it.

Removing the root manifests from the projection is not an option: the installer uses the root plugin.json of the artifact for identity checks during repair, update and remove, and about seven existing tests rely on it. Instead, a confirmed Codex removal with --purge-data now also deletes Codex's own data directory.

  • The directory is <profile>/plugins/data/agent-plugins/<sha256(marketplace + NUL + plugin)>. The formula was checked against a real Codex 0.162.0 and is pinned by a test on an observed value.
  • Only that one directory is removed, and only when it is a strict child of the data root with no symlink at or below that root. A symlinked directory is refused and its target is left alone.
  • A client-neutral PurgeData flag on the deactivation request carries the user's intent to the adapter. Other clients ignore it.
  • It runs after Codex has confirmed the native removal, also on the path without the codex CLI when nothing is registered. If the directory cannot be removed, the removal still succeeds and a manual step with the path is reported, so repair does not reinstall a plugin that was already removed.
  • Project scope is unchanged (its data is already under the installer's control).

Tests: the unit tests cover purge only when requested and after a verified removal, the no-CLI path, a symlinked directory and the failure report. A RemoveGroup test goes through the real Codex adapter and fails if the flag is not passed down. Checked with a real Codex: user and project remove --purge-data leave no data. Lint passes.

Not covered: purging retained data later with the same command on an already removed installation still does not reach Codex's directory, because the binding is gone by then.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 69ffa4f and 1a38291.

Files selected for processing: 8

  • cli/internal/agentpluginscli/remove_multi_presentation.go
  • install/integrationctl/agentplugins/clients/codex/lifecycle_deactivate.go
  • install/integrationctl/agentplugins/clients/codex/native_data.go
  • install/integrationctl/agentplugins/clients/codex/native_data_test.go
  • install/integrationctl/agentplugins/domain/clients_runtime.go
  • install/integrationctl/agentplugins/usecase/codex_purge_native_data_test.go
  • install/integrationctl/agentplugins/usecase/remove_group_native.go
  • install/integrationctl/agentplugins/usecase/remove_session.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@777genius
777genius marked this pull request as ready for review November 17, 2026 00:17
@strix-security

Copy link
Copy Markdown

Strix is installed on this repository, but we couldn't run this PR security review because this workspace's trial has ended. Add a card to resume code reviews here.

So far, Strix has reviewed 392 pull requests, surfaced 113 security issues (1 critical/high) and blocked 3 risky merges across this workspace.

@777genius
777genius merged commit 3f13edc into main Nov 17, 2026
47 of 52 checks passed
@777genius
777genius deleted the fix/codex-purge-native-data branch November 17, 2026 00:17
@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.60976% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.09%. Comparing base (726899a) to head (1a38291).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...ationctl/agentplugins/clients/codex/native_data.go 76.92% 3 Missing and 3 partials ⚠️
...ernal/agentpluginscli/remove_multi_presentation.go 55.55% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #966   +/-   ##
=======================================
  Coverage   63.09%   63.09%           
=======================================
  Files        2254     2255    +1     
  Lines      135180   135217   +37     
=======================================
+ Hits        85294    85319   +25     
- Misses      37525    37531    +6     
- Partials    12361    12367    +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant