fix: replace wandb_gql import with execute_graphql for wandb>=0.27.1 compat#3086
fix: replace wandb_gql import with execute_graphql for wandb>=0.27.1 compat#3086TM23-sanji wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3f4f653. Configure here.
| ) | ||
| res = wandb.Api().client.execute(query, variable_values={"entity": entity, "project": project}) | ||
| """ | ||
| res = wandb.Api()._service_api.execute_graphql(query, {"entity": entity, "project": project}) |
There was a problem hiding this comment.
Incompatible wandb GraphQL API call
Medium Severity
list_views now calls wandb.Api()._service_api.execute_graphql, which only exists after the wandb-core GraphQL routing change in wandb 0.27.1. The project still allows wandb>=0.26.1 and locks 0.27.0, so overview-view lookup can fail with AttributeError on supported installs. Failures are caught as warnings, so training continues but curated overview reuse/creation silently stops working.
Reviewed by Cursor Bugbot for commit 3f4f653. Configure here.
|
Closes #3087 |


Bug:
wandb_gqlimport fails with W&B SDK >=0.27.1Package: prime-rl
File:
prime_rl/utils/monitor/wandb.pyCommit:
256809b(latest main)Description
prime_rl/utils/monitor/wandb.pyimportsfrom wandb_gql import gql— a private, vendored module that was bundled inside the W&B Python SDK. W&B SDK v0.27.1 removed this vendored module as part of PR #11818 (routing GraphQL throughwandb-core).This means a fresh
pip install prime-rlresolves towandb>=0.27.1and fails at import time:This also breaks the
orchestratorandrlentrypoints since the monitor is imported at startup:Root Cause
The file uses two private/internal APIs from the wandb SDK:
from wandb_gql import gql—wandb_gqlwas a vendored copy of thegqlGraphQL library insidewandb/vendor/gql-0.2.0/wandb_gql/. W&B SDK v0.27.1 deleted it.wandb.Api().client.execute()—wandb.Api().clientwas thegql.Clientinstance. The modern replacement iswandb.Api()._service_api.execute_graphql().Both were never public API — they were internal implementation details that happened to be importable.
Fix
Replacement API:
wandb.Api()._service_api.execute_graphql()accepts a raw GraphQL query string (nogql()parsing needed) and returns a plain dict — same shape as before.Changes (3 lines in one file)
File:
prime_rl/utils/monitor/wandb.py1. Remove the import (line 18):
-from wandb_gql import gql2. Replace
gql()parsing +client.execute()with raw string +execute_graphql():That's it. The
_service_apiattribute exists in wandb SDK v0.27.0+ (earlier versions hadclient). Since v0.27.1 is required for the vendoredwandb_gqlremoval to be a problem, this is always available.Verified
WandbMonitorimports successfullylist_viewsimports successfullyrl @ config.toml --dry-runpassesWorkaround (temporary)
Until this fix lands upstream, pin
wandb<0.27.1:Context
This is the same issue that affected
wandb-workspaces(fixed in v0.4.2) and the W&B MCP server (temporarily worked around withwandb<0.27.1cap, then resolved by upgradingwandb-workspaces).References
Note
Low Risk
Narrow compatibility swap in W&B overview view listing; no auth, training, or data-path changes.
Overview
Restores W&B monitor import and startup on
wandb>=0.27.1, where the vendoredwandb_gqlmodule was removed.list_viewsnow sends a plain GraphQL string throughwandb.Api()._service_api.execute_graphql()instead ofgql()pluswandb.Api().client.execute(). Thewandb_gqlimport is dropped. Behavior for listing saved project views (used byensure_overview_view) is unchanged.Reviewed by Cursor Bugbot for commit 3f4f653. Bugbot is set up for automated code reviews on this repo. Configure here.