fix(frontend): Support V1 conversations in MetricsModal#12678
Merged
Conversation
The MetricsModal was not working for V1 conversations because the contract has changed - we no longer get events that update stats on the fly. This change: - Adds proper TypeScript types for V1 metrics (V1TokenUsage, V1MetricsSnapshot) - Updates V1AppConversation.metrics from 'unknown' to typed V1MetricsSnapshot - Modifies MetricsModal to detect V1 conversations via useActiveConversation hook - For V1 conversations, fetches metrics using useBatchAppConversations instead of the metrics store - For non-V1 conversations, continues to use the existing metrics store Co-authored-by: openhands <openhands@all-hands.dev>
malhotra5
reviewed
Jan 29, 2026
malhotra5
reviewed
Jan 29, 2026
| usage: v1Metrics.accumulated_token_usage | ||
| ? { | ||
| prompt_tokens: | ||
| v1Metrics.accumulated_token_usage.prompt_tokens ?? 0, |
Collaborator
There was a problem hiding this comment.
Suggested change
| v1Metrics.accumulated_token_usage.prompt_tokens ?? 0, | |
| v1Metrics.accumulated_token_usage.prompt_tokens, |
NIT: do we need the conditional checks for the token values?
Collaborator
|
Hello @tofarr, I noticed an issue while running the code locally. The cost appears as $0.00 on my end. Please see the image below for additional details. Thank you! 🙏
|
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
…versations - Replace useBatchAppConversations with direct runtime conversation endpoint - Add getRuntimeConversation method to V1ConversationService - Implement getCombinedMetrics utility (TypeScript equivalent of Python SDK) - Create useSandboxMetrics hook for real-time metrics from sandbox - Add new types for runtime conversation info and metrics - Maintain backward compatibility with existing metrics modal UI - Enable real-time metrics updates every 30 seconds for V1 conversations Co-authored-by: openhands <openhands@all-hands.dev>
- Update useSandboxMetrics to only fetch when modal is actually open - Prevents unnecessary API calls every 30 seconds when modal is closed - Improves performance by reducing background network requests - Maintains real-time updates when modal is open Co-authored-by: openhands <openhands@all-hands.dev>
tofarr
added a commit
that referenced
this pull request
Jan 29, 2026
Co-authored-by: openhands <openhands@all-hands.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary of PR
The MetricsModal was not working for V1 conversations because the contract has changed - we no longer get events that update stats on the fly. This PR fixes the issue by:
V1TokenUsage,V1MetricsSnapshot)V1AppConversation.metricsfromunknownto the properly typedV1MetricsSnapshotuseActiveConversationhookuseBatchAppConversationsinstead of the metrics storeDemo Screenshots/Videos
Change Type
Checklist
Fixes
Resolves #(issue)
Release Notes
@tofarr can click here to continue refining the PR
To run this PR locally, use the following command:
GUI with Docker: