fix(cli): prevent session flags from leaking through on retry#644
Open
kmizzi wants to merge 1 commit intoslopus:mainfrom
Open
fix(cli): prevent session flags from leaking through on retry#644kmizzi wants to merge 1 commit intoslopus:mainfrom
kmizzi wants to merge 1 commit intoslopus:mainfrom
Conversation
When `happy --continue` was used, the `--continue` flag was only extracted from claudeArgs when `startFrom` was null. On retry after an error (where the SessionStart hook had already set session.sessionId), the extraction was skipped, causing `--continue` to leak through alongside `--resume <id>` — triggering Claude's error: "--session-id can only be used with --continue or --resume if --fork-session is also specified." Fix: Extract all session flags unconditionally, then conditionally use the extracted values. Also consume one-time flags on error in the launcher retry loop, and enhance consumeOneTimeFlags() to handle -c, -r shorthands and --session-id. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
5 tasks
3 tasks
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
happy --continueerrors with"--session-id can only be used with --continue or --resume if --fork-session is also specified"whileclaude --continueworks fine--continue,-c) were only extracted fromclaudeArgswhenstartFromwas null. On retry after error (where the SessionStart hook had already setsession.sessionId), extraction was skipped — causing--continueto leak through alongside--resume <id>, producing conflicting flagsclaudeArgs, then conditionally use the extracted values to determinestartFrom. Also consume one-time flags on error in the launcher retry loop, and enhanceconsumeOneTimeFlags()to handle-c,-rshorthands and--session-idChanges
claudeLocal.ts--session-id,--resume <id>,--continue) to happen unconditionally before thestartFromcheckstartFromwhen it's not already set--resume/-r(without value) still passes through to Claude for the interactive session pickerhasContinueFlagreference →continueFlag.foundclaudeLocalLauncher.tssession.consumeOneTimeFlags()in thecatchblock of the retry loop, preventing flags from leaking on subsequent retriessession.tsconsumeOneTimeFlags()to handle-c(alias for--continue),-r(alias for--resume), and--session-idflagclaudeLocal.test.tssessionIdis already set from a previous hook notificationTest plan
happy --continueresumes last session without errorhappy --resume <id>resumes specific sessionhappy -cworks as alias for--continuehappy -ropens Claude's session picker🤖 Generated with Claude Code
via Happy