Skip to content

fix(hooks): preserve mode on invalid arguments - #677

Open
l2yujw wants to merge 1 commit into
DietrichGebert:mainfrom
l2yujw:fix/invalid-mode-noop
Open

fix(hooks): preserve mode on invalid arguments#677
l2yujw wants to merge 1 commit into
DietrichGebert:mainfrom
l2yujw:fix/invalid-mode-noop

Conversation

@l2yujw

@l2yujw l2yujw commented Aug 3, 2026

Copy link
Copy Markdown

Summary

Unsupported /ponytail mode arguments currently replace the active session mode with the configured default.

For example, when the active mode is ultra and the configured default is lite:

/ponytail ulta

silently changes the session to lite.

This PR makes unsupported arguments a no-op and adds a regression test proving that the active mode is preserved.

Root cause

The command parser assigned getDefaultMode() to every unsupported argument:

} else {
  mode = getDefaultMode();
}

The normal mode-write path then persisted that fallback as if the user had explicitly selected it.

Fix

Unsupported arguments now leave mode unset.

The existing downstream if (mode) guard prevents output and state mutation, while valid modes and bare status queries keep their existing behavior.

Verification

node --test tests/hooks.test.js
npm test
git diff --check

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