[Bug]: WandbLogger.sync: reflect the already-synced None return
Describe the bug
WandbLogger.sync is annotated -> str, but the ordinary already-synced path returns None: an existing W&B run has summary["status"] == "succeeded" and overwrite retains its default False.
The current declaration, early return, and normal string return show the two supported outcomes. Consumers cannot safely rely on a string result for every successful call.
Local reproduction
This uses real OpenAI client/model objects and leaves sync unchanged. Only external retrieval, login, and W&B lookup collaborators are simulated; no credentials, server calls, or jobs are needed.
from unittest.mock import patch
from openai import OpenAI
from openai.types.fine_tuning import FineTuningJob
from wandb.integration.openai.fine_tuning import WandbLogger
job = FineTuningJob.model_validate({
"id": "ftjob-example", "created_at": 1700000000,
"hyperparameters": {"n_epochs": 1}, "model": "gpt-3.5-turbo",
"object": "fine_tuning.job", "organization_id": "org-example",
"result_files": [], "seed": 0, "status": "succeeded",
"training_file": "file-example",
})
with (
OpenAI(api_key="local-test-key", base_url="http://127.0.0.1:9") as client,
patch.object(client.fine_tuning.jobs, "retrieve", return_value=job),
patch("wandb.login", return_value=True),
patch("wandb.Api") as api,
):
api.return_value.run.return_value.summary = {"status": "succeeded"}
api.return_value.run.return_value.url = "https://wandb.invalid/example"
result = WandbLogger.sync(fine_tune_job_id=job.id, openai_client=client)
print(result, type(result).__name__)After the expected already-logged warning, this prints None NoneType. A consumer calling .upper() on the declared string result is accepted by mypy but fails on this path.
Expected behavior
Make the return annotation and all supported completion paths agree, retaining the existing no-overwrite behavior.
Environment
- W&B SDK: 0.30.0; also reproduced on main
8f93d444e29e4d1a50a888899f51051012ee2679 - Python: 3.12.12; mypy: 2.3.1
- OpenAI Python SDK: 3.11.0
- OS: macOS 26.1, arm64
- W&B server: not applicable to local checks
Source: wandb/wandb