-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(cli): fix session restore race that triggered premature exit #5185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: f660a18 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge OverviewThis PR properly fixes a race condition in CLI session restoration where historical Key improvements:
Files Reviewed (8 files)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c710df7d14
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
cli/src/ui/UI.tsx
Outdated
| const shouldAnswerResumeAsk = taskResumedViaSession && isResumeAskMessage(lastChatMessage) | ||
|
|
||
| // Determine if it's a command or regular message | ||
| if (isCommandInput(trimmedPrompt)) { | ||
| if (isCommandInput(trimmedPrompt) && !shouldAnswerResumeAsk) { | ||
| executeCommand(trimmedPrompt, onExit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep CLI commands executable during resume asks
When --auto is used with --session/--continue, a prompt that starts with / is still a CLI command (e.g., /exit, /clear). This new guard skips executeCommand whenever a resume ask is pending, so the command text is instead sent as a messageResponse and treated as user input by the resumed task. That means command-driven automation in resumed sessions no longer works and can even feed /exit or /clear to the model. Consider handling commands before the resume-ask branch or explicitly erroring instead of sending the command string as a response.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pandemicsyn are you not using /commands within the prompt? Could this not represent an issue then?
Context
I hit two linked issues in --session --auto flows:
This update fixes both: prevent early CI exit on historical completion, and ensure the prompt answers the resume ask so the session continues instead of stalling.
Implementation
CI exit guard (historical completion):
Resume ask handling (prevents hang):
of creating a new task.
Screenshots
Before:
that second invocation doesn't do anything
How to Test
Get in Touch