Skip to content

fix(sdk): preserve model_name in get_combined_metrics#2446

Open
softpudding wants to merge 2 commits intoOpenHands:mainfrom
softpudding:fix/get_combined_metrics_model_name
Open

fix(sdk): preserve model_name in get_combined_metrics#2446
softpudding wants to merge 2 commits intoOpenHands:mainfrom
softpudding:fix/get_combined_metrics_model_name

Conversation

@softpudding
Copy link
Contributor

@softpudding softpudding commented Mar 14, 2026

The get_combined_metrics() method was creating a new Metrics() with the default model_name='default', losing the actual model name from tracked metrics. This fix extracts the model_name from the first metrics entry before creating the combined metrics.

Summary

[fill in a summary of this PR]

Checklist

  • If the PR is changing/adding functionality, are there tests to reflect this?
  • If there is an example, have you run the example to make sure that it works?
  • If there are instructions on how to run the code, have you followed the instructions and made sure that it works?
  • If the feature is significant enough to require documentation, is there a PR open on the OpenHands/docs repository with the same branch name?
  • Is the github CI passing?

softpudding and others added 2 commits March 14, 2026 10:44
The get_combined_metrics() method was creating a new Metrics() with the
default model_name='default', losing the actual model name from tracked
metrics. This fix extracts the model_name from the first metrics entry
before creating the combined metrics.

Co-authored-by: openhands <openhands@all-hands.dev>
@malhotra5 malhotra5 added the review-this This label triggers a PR review by OpenHands label Mar 15, 2026
Comment on lines +59 to +64
model_name = (
next(iter(self.usage_to_metrics.values())).model_name
if self.usage_to_metrics
else "default"
)
total_metrics = Metrics(model_name=model_name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm how would this work in the event we had multiple models with different names? Should we concatenate all the unique model names 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-this This label triggers a PR review by OpenHands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants