Fix trace replay JSONB metric merge - #685
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
What changed
Why
Historical AgentX artifacts need full-response metrics reconstructed from retained profiles. Passing the patch through
JSON.stringifystored it as a JSON string; PostgreSQL JSONB concatenation then convertedbenchmark_results.metricsfrom an object into an array, causing chart metrics to fall back to zero.This preserves backward compatibility for historical artifacts while leaving current artifacts unchanged.
Validation
Further testing was skipped at request for a quick PR.
Note
Low Risk
Small ETL SQL binding change in trace replay ingest with a focused regression test; no auth or broad API surface.
Overview
Fixes corrupted
benchmark_results.metricswhen trace replay backfills full-response ITL/interactivity from historical AIPerf profiles.persistPreparedTraceReplaynow passes reconstructed metrics throughtx.json(fullResponseMetrics)instead ofJSON.stringify(...)before themetrics || …update. That keeps the bind as a JSON object so PostgreSQL merges into the existing JSONB document instead of treating the patch as a string and turningmetricsinto an array (which made charts read zeros).The trace replay ingest test mock adds
tx.json, and the persistence test now requires the metric patch in query values as a plain object and explicitly rejects a stringified duplicate.Reviewed by Cursor Bugbot for commit 5e41a4f. Bugbot is set up for automated code reviews on this repo. Configure here.