Skip to content

Fix trace replay JSONB metric merge - #685

Merged
cquil11 merged 1 commit into
masterfrom
agent/fix-trace-replay-jsonb-merge
Aug 7, 2026
Merged

Fix trace replay JSONB metric merge#685
cquil11 merged 1 commit into
masterfrom
agent/fix-trace-replay-jsonb-merge

Conversation

@cquil11

@cquil11 cquil11 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Bind reconstructed full-response metrics as a JSONB object instead of a string.
  • Update the trace replay regression test to require an object parameter and reject double encoding.

Why

Historical AgentX artifacts need full-response metrics reconstructed from retained profiles. Passing the patch through JSON.stringify stored it as a JSON string; PostgreSQL JSONB concatenation then converted benchmark_results.metrics from 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.metrics when trace replay backfills full-response ITL/interactivity from historical AIPerf profiles.

persistPreparedTraceReplay now passes reconstructed metrics through tx.json(fullResponseMetrics) instead of JSON.stringify(...) before the metrics || … 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 turning metrics into 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.

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
inferencemax-app Ready Ready Preview Aug 7, 2026 6:36am

Request Review

@cquil11
cquil11 marked this pull request as ready for review August 7, 2026 06:37
@cquil11
cquil11 requested a review from adibarra as a code owner August 7, 2026 06:37
@cquil11
cquil11 merged commit f4be238 into master Aug 7, 2026
16 checks passed
@cquil11
cquil11 deleted the agent/fix-trace-replay-jsonb-merge branch August 7, 2026 06:37
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.

1 participant