Skip to content

Refresh all FineTuningJob properties in UpdateStatus(RequestOptions) - #1456

Open
codewithfourtix wants to merge 1 commit into
openai:mainfrom
codewithfourtix:fine-tuning-update-status-request-options
Open

codewithfourtix wants to merge 1 commit into
openai:mainfrom
codewithfourtix:fine-tuning-update-status-request-options

Conversation

@codewithfourtix

Copy link
Copy Markdown

FineTuningJob.UpdateStatus(RequestOptions) and UpdateStatusAsync(RequestOptions) read only the status field. After a job finishes, HasCompleted is true, but Status is still Running, Value (the fine-tuned model) is still null, and ResultFileIds is empty. The CancellationToken overloads do not have this problem, because they copy the full job.

Both overrides now use CopyLocalParameters, the same as the CancellationToken overloads. With ClientErrorBehaviors.NoThrow, an error response has no job in it, so the job properties stay as they are and only the raw response changes. Before, that case threw KeyNotFoundException.

Tests in FineTuningJobMockTests cover both cases, sync and async.

The UpdateStatus and UpdateStatusAsync overrides that take RequestOptions
read only the status field. They set HasCompleted, but Status, Value,
ResultFileIds and the other job properties kept the old values. The
CancellationToken overloads copy the full job.

Copy the full job in both overrides with CopyLocalParameters. With
ClientErrorBehaviors.NoThrow the response can be an error with no job,
so keep the job properties and update only the raw response.
Copilot AI balanced review requested due to automatic review settings October 21, 2026 07:18

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T07:22:54.574071Z 5f5de0e PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 5f5de0eead

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

return;
}

CopyLocalParameters(response, (InternalFineTuningJob)ClientResult.FromResponse(response));

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 Refresh BillableTrainedTokenCount too

When a running job later returns a completed payload with a non-null trained_tokens value, this full-refresh path still leaves BillableTrainedTokenCount at its old value (normally 0): CopyLocalParameters in OpenAI/src/Custom/FineTuning/FineTuningJob.cs copies the other deserialized fields but never assigns job.BillableTrainedTokenCount. The changed overloads therefore still do not refresh all exposed job properties; add that assignment and include trained_tokens in the regression response.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch. CopyLocalParameters not copying BillableTrainedTokenCount is fixed in #1413. This change routes through CopyLocalParameters, so it picks that up once #1413 lands. I kept it out here to avoid a conflict.

This branch has not been deployed

No deployments
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