Repository navigation
Conversation
claude --help (2.1.291) lists the --permission-mode choices acceptEdits, auto, bypassPermissions, manual, dontAsk and plan. PermissionMode had only DEFAULT, ACCEPT_EDITS and BYPASS_PERMISSIONS, plus DANGEROUSLY_SKIP_PERMISSIONS, which is a separate flag. Add AUTO, DONT_ASK, PLAN and MANUAL after the existing constants, so the existing ordinals stay the same. DEFAULT stays: the CLI no longer lists "default" but still accepts it, and reports a "manual" session as "default" in its init message. On a model that does not support "auto" (Haiku), the CLI silently falls back to "default" instead of failing; the AUTO javadoc says so. CLIFlagParityIT now reads the --permission-mode choices from --help. It gates on every SDK mode being one of them, with DEFAULT recorded as accepted but unlisted, and it warns about a choice that has no constant. Like the unmodelled-flag check, that is a warning rather than a gate, because the mode stays reachable: extraArgs is emitted after the SDK's own --permission-mode, and the CLI applies the last one. Against the old enum it reports auto, dontAsk, manual and plan.
The gate compared PermissionMode values with the choices claude --help lists, so it could not cover DEFAULT, which the SDK sends by default and the CLI still accepts without listing it, and it would fail on any other mode the CLI hides but keeps accepting. It now runs claude --permission-mode <value> --version for every value, which the CLI validates while parsing arguments, without starting a session. PermissionMode.isPermissionModeValue() replaces the three separate special cases for DANGEROUSLY_SKIP_PERMISSIONS. The help choices are parsed once, and the parse stops at the next option.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
claude --help(2.1.291) lists--permission-modechoicesacceptEdits, auto, bypassPermissions, manual, dontAsk, plan. Four of them had noPermissionModeconstant.public enum PermissionMode { DEFAULT("default"), // no longer listed, still accepted ACCEPT_EDITS("acceptEdits"), BYPASS_PERMISSIONS("bypassPermissions"), DANGEROUSLY_SKIP_PERMISSIONS("dangerously-skip-permissions"), + MANUAL("manual"), // new name for default + AUTO("auto"), // falls back to default on models without auto + DONT_ASK("dontAsk"), + PLAN("plan");The new constants are appended, so existing ordinals do not change.
CLIFlagParityITnow reads the--permission-modechoices from--help:The second check is a warning rather than a gate, for the same reason the existing unmodelled-flag check is. A missing mode is still reachable, because
extraArgsis emitted after the SDK's own--permission-modeand the CLI applies the last one.Evidence
Init-message
permissionModewith CLI 2.1.291,claude -p … --output-format stream-json --verbose:--permission-mode manualdefault--permission-mode defaultdefault--permission-mode autoauto--permission-mode acceptEdits --permission-mode planplan--permission-mode plan --permission-mode acceptEditsacceptEdits--permission-mode default --permission-mode autoautoThe
autofallback todefaulton a model that doesn't support it was observed on Haiku. It is documented onAUTO.Tests:
cliPermissionModeChoicesShouldHaveSdkConstantsreportsauto, dontAsk, manual, plan.CLIFlagParityTest.permissionModeValueschecks that every mode emits--permission-mode <value>exactly once and round-trips throughfromValue../mvnw clean verifypasses.Merge Danger
Door: two-way
Blast Radius: additive
Only new enum constants were added. Defaults and the emitted command are unchanged for the existing modes. A consumer with an exhaustive
switchoverPermissionModewill need to handle the new cases.