Skip to content

fix: fall back to ccr code when claude CLI is unavailable #12027

Merged
gomesalexandre merged 3 commits intodevelopfrom
fix/release-script-no-conversation
Feb 26, 2026
Merged

fix: fall back to ccr code when claude CLI is unavailable #12027
gomesalexandre merged 3 commits intodevelopfrom
fix/release-script-no-conversation

Conversation

@0xApotheosis
Copy link
Member

@0xApotheosis 0xApotheosis commented Feb 25, 2026

Description

tl;dr: for people like me who use Claude Code via Claude Code Router

When the claude CLI isn't authenticated (e.g. user has no Claude subscription and uses an API key via claude-code-router), the release script's summary generation fails and falls back to the raw commit list.

This PR adds ccr code as a fallback for summary generation:

  • Refactors the spawn logic into a shared spawnClaude helper
  • Tries claude CLI first (default); if it fails and ccr is on PATH, falls back to ccr code
  • Improves error output to capture both stdout and stderr (up to 500 chars each) for easier debugging

Issue (if applicable)

N/A

Risk

Zero risk. This only affects how Claude is invoked during release summary generation - no on-chain transactions, wallets, or protocol interactions are affected.

Testing

Engineering

Run the release script with and without a Claude subscription:

  • With Claude subscription: should use claude CLI directly
  • Without subscription but with ccr installed: claude fails, falls back to ccr code
  • Without either: falls back to raw commit list as before

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

Not user-facing - internal tooling change only.

Screenshots (if applicable)

N/A

Summary by CodeRabbit

  • Chores
    • Improved the release script's reliability by implementing a fallback mechanism and enhanced error reporting when generating release summaries.

@0xApotheosis 0xApotheosis requested a review from a team as a code owner February 25, 2026 00:45
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

Replaces the hard-coded Claude invocation in scripts/release.ts with a spawn-based abstraction, adds CLAUDE_ARGS, runtime detection of ccr, and a fallback to invoking ccr when claude fails, plus improved timeout/exit error reporting and aggregated stderr/stdout in failures.

Changes

Cohort / File(s) Summary
Release script (Claude/CCR flow)
scripts/release.ts
Replaces direct runClaude call with spawnClaude abstraction; adds CLAUDE_ARGS constant; detects ccr availability (isCcrAvailable); attempts claude first, falls back to ccr (ccr code ...) on failure; enhances timeout and non-zero-exit error messages and aggregates stderr/stdout for diagnostics.

Sequence Diagram(s)

sequenceDiagram
  participant Release as Release script
  participant FS as Prompt file
  participant Claude as claude (binary)
  participant CCR as ccr (fallback)

  Release->>FS: read promptPath
  Release->>Claude: spawnClaude('claude', CLAUDE_ARGS, promptPath)
  alt Claude succeeds
    Claude-->>Release: stdout (release summary)
  else Claude fails / times out
    Release->>Release: isCcrAvailable? (checks via `which ccr`)
    alt ccr available
      Release->>CCR: spawnClaude('ccr', ['code', ...CLAUDE_ARGS], promptPath)
      CCR-->>Release: stdout (release summary) / stderr aggregated
    else ccr unavailable
      Release-->>Release: return enhanced timeout/exit error with stderr/stdout
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • NeOMakinG

Poem

🐰 I hopped in code with ears alert,

Spawned Claude with args so curt,
If Claude slips, I find CCR's door,
I stitch the bytes and bring the score,
A tiny hop — release once more. 🥕

🚥 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 accurately summarizes the main change: adding a fallback to ccr when the claude CLI is unavailable, which is the primary objective of the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/release-script-no-conversation

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.

@0xApotheosis 0xApotheosis marked this pull request as draft February 25, 2026 00:48
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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 `@scripts/release.ts`:
- Line 242: The spawn invocation in generateReleaseSummary passes an invalid
Claude CLI flag '--no-conversation' which causes the Claude process to fail;
remove '--no-conversation' from the arguments (or replace it with the supported
'--no-session-persistence' if the goal is to avoid saving the session) in the
spawn call that creates the child process (the line using spawn('claude', ['-p',
'--model', 'opus', '--max-turns', '1', ...])) so the Claude CLI runs with only
valid flags.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c257772 and 60bb3b5.

📒 Files selected for processing (1)
  • scripts/release.ts

@0xApotheosis 0xApotheosis force-pushed the fix/release-script-no-conversation branch from 132b4af to c6f263b Compare February 25, 2026 01:19
@0xApotheosis 0xApotheosis changed the title fix: prevent release script from polluting claude conversation history fix: fall back to ccr code when claude CLI is unavailable Feb 25, 2026
@0xApotheosis 0xApotheosis force-pushed the fix/release-script-no-conversation branch 3 times, most recently from d087d89 to 407c115 Compare February 25, 2026 04:10
When the claude CLI isn't authenticated (e.g. user has no Claude
subscription and uses an API key via claude-code-router), the release
script now falls back to `ccr code` for summary generation.

- Refactor spawn logic into shared `spawnClaude` helper
- Check if `ccr` is on PATH and prefer it when available
- Improve error output to capture both stdout and stderr

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@0xApotheosis 0xApotheosis force-pushed the fix/release-script-no-conversation branch from 407c115 to 01cec10 Compare February 25, 2026 04:57
@0xApotheosis 0xApotheosis marked this pull request as ready for review February 25, 2026 04:57
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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 `@scripts/release.ts`:
- Around line 287-305: The isCcrAvailable() pre-check is unreliable; in
runClaude (which calls spawnClaude and uses CLAUDE_ARGS) remove the awaits to
isCcrAvailable() in the catch block and instead always attempt the fallback
spawnClaude('ccr', ['code', ...CLAUDE_ARGS], promptPath) after logging the CLI
failure, and delete or stop referencing isCcrAvailable() (and its spawn('which',
...) logic) so the code directly tries the ccr executable rather than depending
on the which check.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 60bb3b5 and 01cec10.

📒 Files selected for processing (1)
  • scripts/release.ts

Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

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

lgtm code-wise, will test when there are commits to release!

Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

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

Still happy with claude

Image

@gomesalexandre gomesalexandre enabled auto-merge (squash) February 26, 2026 13:20
@gomesalexandre gomesalexandre merged commit e317172 into develop Feb 26, 2026
4 checks passed
@gomesalexandre gomesalexandre deleted the fix/release-script-no-conversation branch February 26, 2026 13:34
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.

2 participants