Skip to content

Keep the Ruby 3.2 CI floor off the OpenAI SDK's 3.3 requirement - #214

Closed
simonx1 wants to merge 2 commits into
mainfrom
fix/openai-dev-dep-ruby-3-2-floor
Closed

Keep the Ruby 3.2 CI floor off the OpenAI SDK's 3.3 requirement#214
simonx1 wants to merge 2 commits into
mainfrom
fix/openai-dev-dep-ruby-3-2-floor

Conversation

@simonx1

@simonx1 simonx1 commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Problem

bundle install fails on the Ruby 3.2 matrix job:

openai-0.77.0 requires ruby version >= 3.3.0, which is incompatible with the current version, 3.2.11

#207 moved the git-sourced openai dev dependency to a revision where upstream raised required_ruby_version from >= 3.2.0 to >= 3.3.0. The gemspec here still declares >= 3.2.0 and CI still tests that floor, so resolution on 3.2 has no valid candidate.

It went unnoticed because setup-ruby's bundler cache satisfied the entire lockfile, so bundle install never re-resolved and never read that gemspec. Any PR that touches a rubygems-sourced gem forces a real resolve on the 3.2 runner and trips over it — which is what #213 (rubocop 1.89.0) did. Its test (3.3) failure is only matrix fail-fast, not a real failure.

Fix

1. Gate the dependency on Ruby >= 3.3 (Gemfile). Nothing in the suite needs the official SDK:

  • spec_helper.rb's require 'openai' resolves to ruby-openai — both gems ship lib/openai.rb.
  • spec/integration/openai_mcp_integration_spec.rb uses ruby-openai's access_token: API, not the official gem's api_key:.
  • The only consumer is examples/openai_ruby_mcp.rb, which unshifts the gem's load path explicitly.

A dev-only example dependency shouldn't dictate the library's supported floor.

2. Install uncached on the 3.2 job (.github/workflows/ci.yml). The guard alone isn't enough — bundler-cache: true makes setup-ruby run bundle config set --local deployment true, and deployment mode requires the Gemfile's dependency list to match Gemfile.lock exactly:

The list of sources changed, but the lockfile can't be updated because frozen mode is set
You have deleted from the Gemfile: * openai

Local .bundle/config beats BUNDLE_* env vars in Bundler's settings precedence, so the job can't opt out of deployment mode via env. The cache is turned off for that one matrix entry instead.

Verification

  • Ruby 4.0.6 (unchanged path): Gemfile.lock byte-identical, RuboCop clean, 1701 examples / 0 failures.
  • Guard forced false (simulating 3.2): resolution succeeds and is purely subtractive — it drops only the GIT section, openai!, and the two transitive deps unique to it (cgi, connection_pool). No version churn on any other gem. RuboCop clean, 1701 examples / 0 failures.
  • Lockfile audit: all 68 rubygems-sourced gems in Gemfile.lock accept Ruby 3.2, so the uncached 3.2 resolve has nothing else it could downgrade.

Trade-offs

  • The 3.2 job loses gem caching (~30-60s slower) and resolves instead of replaying the lockfile.
  • examples/openai_ruby_mcp.rb will now fail on Ruby 3.2 at Gem::Specification.find_by_name('openai'). Left as-is — the example targets an SDK that genuinely requires 3.3. Happy to add a friendly abort if you want one.

The alternative is to drop Ruby 3.2 entirely (EOL since 2026-03-31, and .rubocop.yml already sets TargetRubyVersion: 3.3.5), which would be simpler but is a breaking change for users.

Once merged, @dependabot rebase on #213 should turn it green.

🤖 Generated with Claude Code

`bundle install` has been failing on the Ruby 3.2 matrix job since #207:

    openai-0.77.0 requires ruby version >= 3.3.0, which is incompatible
    with the current version, 3.2.11

#207 moved the git-sourced `openai` dev dependency to a revision where
upstream raised `required_ruby_version` from >= 3.2.0 to >= 3.3.0. The
gemspec here still declares >= 3.2.0 and CI still tests that floor, so
resolution on 3.2 now has no valid candidate.

It went unnoticed because setup-ruby's bundler cache satisfied the whole
lockfile, so `bundle install` never re-resolved and never read that
gemspec. Any PR that touches a rubygems-sourced gem forces a real resolve
on the 3.2 runner and trips over it — which is what #213 (rubocop 1.89.0)
did.

Nothing in the suite needs the SDK: spec_helper's `require 'openai'`
resolves to ruby-openai, which also ships lib/openai.rb, and the
integration spec uses ruby-openai's `access_token:` API. The only
consumer is examples/openai_ruby_mcp.rb, which unshifts the gem's load
path explicitly. So gate it on Ruby >= 3.3 rather than let a dev-only
example dependency dictate the library's supported floor.

Verified on 4.0.6 that Gemfile.lock is unchanged and the suite is green,
and with the guard forced false that resolution drops only the GIT
section, `openai!` and its two unique transitive deps (cgi,
connection_pool) with no version churn elsewhere — 1701 examples, 0
failures, RuboCop clean in both states.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

The Gemfile guard alone is not enough: `bundler-cache: true` makes
setup-ruby run `bundle config set --local deployment true`, and
deployment mode requires the Gemfile's dependency list to match
Gemfile.lock exactly:

    The list of sources changed, but the lockfile can't be updated
    because frozen mode is set
    You have deleted from the Gemfile: * openai

Local `.bundle/config` beats `BUNDLE_*` env vars in Bundler's settings
precedence, so the job cannot opt out of deployment mode with an env
var. Turn the cache off for that one matrix entry instead and install
explicitly.

The 3.2 job now resolves rather than replays the lockfile. That is safe
here: the re-resolution is purely subtractive (verified by forcing the
guard false locally -- it drops only the GIT section, `openai!`, and the
two transitive deps unique to it, with no version churn elsewhere), and
every one of the 68 rubygems-sourced gems in Gemfile.lock accepts Ruby
3.2, so there is nothing else for it to downgrade.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@simonx1

simonx1 commented Aug 21, 2026

Copy link
Copy Markdown
Owner Author

Superseded by a PR that drops Ruby 3.2 support outright instead of working around the OpenAI SDK's 3.3 floor.

@simonx1 simonx1 closed this Aug 21, 2026
simonx1 added a commit that referenced this pull request Aug 21, 2026
Supersedes #214, which kept the 3.2 job alive by gating the OpenAI SDK
dev dependency behind a Ruby-version check and disabling gem caching on
that one job.

## Problem

`bundle install` fails on the Ruby 3.2 matrix job whenever Bundler has
to resolve for real (i.e. whenever `setup-ruby`'s cache misses, as it
does on any PR that touches a rubygems-sourced gem — #213 is the current
example):

```
openai-0.77.0 requires ruby version >= 3.3.0, which is incompatible with the current version, 3.2.11
```

#207 and #212 moved the git-sourced `openai` dev dependency to revisions
where upstream raised its `required_ruby_version` to `>= 3.3.0`, while
the gemspec here still declared `>= 3.2.0` and CI still tested that
floor.

## Fix

Drop 3.2 instead of working around it. Ruby 3.2 has been EOL since
2026-03-31, `.rubocop.yml` already sets `TargetRubyVersion: 3.3.5`, and
a Gemfile/CI workaround for one dependency would have had to be
maintained indefinitely.

- `ruby-mcp-client.gemspec`: `required_ruby_version` is now `>= 3.3.0`.
- `.github/workflows/ci.yml`: the two-entry matrix becomes a single
`Test (Ruby 3.3, floor)` job, mirroring the shape of the 4.0.6 job. Gem
caching stays on for both.
- `README.md`: the Requirements section states the new floor.

No library code changes. No `Gemfile.lock` changes.

## Breaking change

This is a breaking change for anyone installing the gem on Ruby 3.2 —
RubyGems will refuse the next released version there. `CHANGELOG.md` is
written at release time in this repo, so the next release's **Breaking
Changes** section should carry an entry for this.

## Verification

- **Ruby 4.0.6:** `bundle install` leaves `Gemfile.lock` byte-identical;
RuboCop clean; 1701 examples, 0 failures.
- **Ruby 3.3.5 (new floor), uncached resolve in a fresh worktree:**
`Gemfile.lock` byte-identical after `bundle install`, so the CI job's
cached lockfile replay and a real resolve agree; RuboCop clean; 1701
examples, 0 failures.
- No branch protection or rulesets reference the old `test (3.2)` /
`test (3.3)` check names, so the rename is safe.

Once merged, `@dependabot rebase` on #213 should turn it green.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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