fix(uninstall): remove the mode flag from every host state dir by Soumyadip2003-AI · Pull Request #788 · DietrichGebert/ponytail · GitHub
Skip to content

fix(uninstall): remove the mode flag from every host state dir - #788

Open
Soumyadip2003-AI wants to merge 1 commit into
DietrichGebert:mainfrom
Soumyadip2003-AI:fix/uninstall-host-state-flags
Open

fix(uninstall): remove the mode flag from every host state dir#788
Soumyadip2003-AI wants to merge 1 commit into
DietrichGebert:mainfrom
Soumyadip2003-AI:fix/uninstall-host-state-flags

Conversation

@Soumyadip2003-AI

@Soumyadip2003-AI Soumyadip2003-AI commented Sep 1, 2026

Copy link
Copy Markdown

Summary

scripts/uninstall.js only deletes ~/.claude/.ponytail-active, but that is not where most hosts keep it. hooks/ponytail-runtime.js writes the flag beside each host's own state:

host state dir
Claude Code getClaudeDir() (~/.claude)
Codex $PLUGIN_DATA
VS Code Copilot $COPILOT_PLUGIN_DATA
Qoder ~/.qoder

On Codex, Copilot and Qoder the mode flag therefore survives uninstall. The statusline still reads it, and a later reinstall picks up a stale mode instead of starting from the configured default.

Repro (before this change)

$ QODER_SESSION_ID=x node hooks/ponytail-activate.js   # writes ~/.qoder/.ponytail-active
$ node scripts/uninstall.js
Removed config file: ~/.config/ponytail/config.json
$ ls ~/.qoder/.ponytail-active
~/.qoder/.ponytail-active                              # still there

Same result with PLUGIN_DATA (Codex) and COPILOT_PLUGIN_DATA (Copilot).

Fix

Sweep every location ponytail writes to, instead of resolving one.

Uninstall runs from a plain shell where PLUGIN_DATA / COPILOT_PLUGIN_DATA / QODER_SESSION_ID are usually unset, so importing the runtime's already-resolved statePath would just resolve back to ~/.claude — it has to check all four. removeIfExists already swallows ENOENT, so dirs that don't exist cost nothing.

Scope kept deliberately narrow: only .ponytail-active. The .ponytail-statusline-nudged flag is the same class of leak but is already covered by #680, so this doesn't touch it.

Verification

$ node --test tests/uninstall.test.js
uninstall script checks passed
✔ tests/uninstall.test.js

Full suite is unchanged (node --test tests/*.test.js): 83 pass, 1 pre-existing failure in csv: correct pandas one-liner passes, which is a local pandas/numpy install issue and is unrelated to this change.

The existing test now also seeds a Qoder flag (~/.qoder) and a Codex flag ($PLUGIN_DATA) and asserts both are gone.

hooks/ponytail-runtime.js writes .ponytail-active beside each host's own
state — Codex $PLUGIN_DATA, Copilot $COPILOT_PLUGIN_DATA, Qoder ~/.qoder —
but scripts/uninstall.js only ever deleted ~/.claude/.ponytail-active. On
those hosts the flag survives uninstall, so ponytail is still reported
active after the plugin files are gone.

Uninstall runs from a plain shell where those host env vars are usually
unset, so resolving one path the way the runtime does is not enough: sweep
every location ponytail writes to instead.

Repro (before this change):

  QODER_SESSION_ID=x node hooks/ponytail-activate.js   # writes ~/.qoder/.ponytail-active
  node scripts/uninstall.js
  ls ~/.qoder/.ponytail-active                          # still there

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T6gVj3n5kq5HFGqw7uvoPT
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