Skip to content

fix: don't pass --continue on first run - #667

Merged
namastex888 merged 4 commits into
mainfrom
dev
Mar 18, 2026
Merged

namastex888 merged 4 commits into
mainfrom
dev

Conversation

@namastex888

@namastex888 namastex888 commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

First run has no session to continue — CC fails with 'No conversation found'. Now only passes --continue on subsequent runs. Merge commit only.

Summary by CodeRabbit

  • Chores

    • Version bumped to 3.260318.6 across all components
  • Bug Fixes

    • Session and window startup now prefer a fresh start and include a runtime fallback to avoid unintentionally continuing prior conversations
  • Tests

    • Added tests to verify continuation vs. fresh-start command behavior

@coderabbitai

coderabbitai Bot commented Mar 18, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5a677c71-83c2-4286-a45a-4acc01a33c79

📥 Commits

Reviewing files that changed from the base of the PR and between e5f48e2 and b88c7a5.

📒 Files selected for processing (2)
  • src/genie-commands/__tests__/session.test.ts
  • src/genie-commands/session.ts

📝 Walkthrough

Walkthrough

Starts fresh Claude sessions by default: continuation name is now undefined and a continue-fallback is added. Also increments plugin/package versions from 3.260318.5 to 3.260318.6 across manifests.

Changes

Cohort / File(s) Summary
Version bumps
\.claude-plugin/marketplace.json, openclaw.plugin.json, package.json, plugins/genie/\.claude-plugin/plugin.json, plugins/genie/package.json
All version fields updated from 3.260318.5 → 3.260318.6.
Session logic
src/genie-commands/session.ts
createSession/buildClaudeCommand now use undefined for continuation by default; added launchWithContinueFallback to attempt --continue then detect shell and relaunch fresh; adjusted window focus/relaunch and logging.
Tests
src/genie-commands/__tests__/session.test.ts
Added tests for buildClaudeCommand to assert presence/absence of --continue when continuation name is provided or undefined.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant User
participant SessionManager as SessionManager (session.ts)
participant Tmux as tmux/window
participant Pane as pane (pane_current_command)
participant Claude as Claude process
User->>SessionManager: request/new session or focusTeamWindow
SessionManager->>Tmux: launch window with --continue (attempt) or fresh (undefined)
Tmux->>Pane: start pane and run command
Pane->>SessionManager: report pane_current_command
alt pane shows prior Claude process
SessionManager->>Tmux: keep/focus existing window
else pane shows shell/no prior conversation
SessionManager->>Tmux: relaunch without --continue (fresh start)
Tmux->>Claude: start fresh Claude process
end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main fix: preventing the --continue flag from being passed on first run, which directly addresses the core issue in the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical bug that prevented Claude Code from initializing correctly on its first execution due to an erroneous attempt to resume a non-existent conversation. By modifying the session creation logic to only apply the continuation flag for established sessions, the system now starts new conversations seamlessly. Additionally, this change includes a routine version bump across several project files.

Highlights

  • Bug Fix: Initial Session Creation: Resolved an issue where Claude Code would fail on its first run by attempting to continue a non-existent session. The --continue flag is now only passed on subsequent runs, preventing the 'No conversation found' error.
  • Version Updates: Incremented the version number from 3.260318.5 to 3.260318.6 across multiple configuration and package files for the genie and @automagik/genie components.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a bug where the --continue flag was incorrectly passed when creating a new session, leading to an error. The fix, located in the createSession function within src/genie-commands/session.ts, correctly omits this flag on the initial run by passing undefined for the continueName parameter to buildClaudeCommand. The associated log message has also been updated for consistency. The logic for subsequent runs, which correctly use the --continue flag, is unaffected. The change is precise and effectively resolves the reported issue.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: e5f48e2fcd

ℹ️ 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".

console.log(`Continuing session by name: ${continueName}`);
const cmd = buildClaudeCommand(windowName, systemPromptFile || undefined, continueName);
// First run — no session to continue, just start fresh with --name
const cmd = buildClaudeCommand(windowName, systemPromptFile || undefined, undefined);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore --continue for restarted tmux sessions

This hard-codes continueName to undefined, so every createSession launch starts a fresh Claude conversation. createSession runs any time tmux.findSessionByName(...) returns null (for example after a tmux server restart or if the session was killed), which means a later genie run from the same directory can no longer resume the prior named session context. That contradicts the “only on first run” intent and regresses persistence for returning sessions.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/genie-commands/session.ts`:
- Line 190: Replace the console.log call that prints "Started Claude Code as
${agentName} in ${workspaceDir}" with the project's structured logger (e.g., use
the existing logger or processLogger instance used elsewhere in session.ts) and
log at an appropriate level (info). Ensure you keep the same message and include
agentName and workspaceDir variables, and add/import the logger (or use the
file's existing logger variable) if it's not already present.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 39759266-d682-42ed-8326-c8736eac1b50

📥 Commits

Reviewing files that changed from the base of the PR and between ef9d02e and e5f48e2.

📒 Files selected for processing (6)
  • .claude-plugin/marketplace.json
  • openclaw.plugin.json
  • package.json
  • plugins/genie/.claude-plugin/plugin.json
  • plugins/genie/package.json
  • src/genie-commands/session.ts

const cmd = buildClaudeCommand(windowName, systemPromptFile || undefined, undefined);
await tmux.executeTmux(`send-keys -t ${shellQuote(target)} ${shellQuote(cmd)} Enter`);
console.log(`Started Claude Code as ${agentName}@${continueName} in ${workspaceDir}`);
console.log(`Started Claude Code as ${agentName} in ${workspaceDir}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Replace console.log in source TypeScript.

Line 190 uses console.log, which violates the source logging guideline for .ts files.

Proposed fix
-  console.log(`Started Claude Code as ${agentName} in ${workspaceDir}`);
+  process.stdout.write(`Started Claude Code as ${agentName} in ${workspaceDir}\n`);

As per coding guidelines "**/*.ts: No console.log statements in source code (relaxed in test files)".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
console.log(`Started Claude Code as ${agentName} in ${workspaceDir}`);
process.stdout.write(`Started Claude Code as ${agentName} in ${workspaceDir}\n`);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/genie-commands/session.ts` at line 190, Replace the console.log call that
prints "Started Claude Code as ${agentName} in ${workspaceDir}" with the
project's structured logger (e.g., use the existing logger or processLogger
instance used elsewhere in session.ts) and log at an appropriate level (info).
Ensure you keep the same message and include agentName and workspaceDir
variables, and add/import the logger (or use the file's existing logger
variable) if it's not already present.

Genie and others added 2 commits March 18, 2026 14:53
…d-pane relaunch

Bug 1: Inside-tmux path always passed --continue with a random-suffixed name
that could never match an existing conversation, causing "No conversation found"
errors. Removed --continue since the random suffix guarantees a fresh session.

Bug 2: focusTeamWindow had no else branch — when a tmux window existed but
Claude Code had exited, nothing relaunched it. Added dead-pane detection via
#{pane_current_command} and relaunch with --continue fallback.

Extracted launchWithContinueFallback() helper used by both the created=true
path and the new dead-pane else branch. Tries --continue first, waits 3s,
falls back to fresh if CC isn't running.
fix(session): fallback to fresh session when --continue fails
@namastex888
namastex888 merged commit 7f97166 into main Mar 18, 2026
9 checks passed
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