🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(seeder): add base64 payload style for huge data-URI IO (LFE-10152) (#15054)
Nikita Kabardin848a7689f817
diff --git a/.agents/skills/seed-test-data/SKILL.md b/.agents/skills/seed-test-data/SKILL.mdindex b9e8d606d5..0ecdad7dec 100644--- a/.agents/skills/seed-test-data/SKILL.md+++ b/.agents/skills/seed-test-data/SKILL.md@@ -29,25 +29,26 @@ this.## Need → command-| I need... | Command |-| --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| A very complex observation tree (v3) | `pnpm run seed -- trace-tree --observations 5000 --depth 12 --breadth 500` |-| The same tree readable in the v4 events UI | add `--v4` (writes `events_full`; `events_core` fills via MV) |-| Async parents whose subtree outlives their own span (subtree wall-clock duration badge) | add `--async-parents` to `trace-tree` (root + hub end immediately while children keep running) |-| A realistic agent flow over a timeline (graph view + scrubbable timeline) | `pnpm run seed -- agent-timeline --turns 6 --v4` (LangGraph refine loop planner→retriever→generator→critic→loop, staggered in time; add `--timing-only` for the pure timing fallback) |+| I need... | Command |+| --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| A very complex observation tree (v3) | `pnpm run seed -- trace-tree --observations 5000 --depth 12 --breadth 500` |+| The same tree readable in the v4 events UI | add `--v4` (writes `events_full`; `events_core` fills via MV) |+| Async parents whose subtree outlives their own span (subtree wall-clock duration badge) | add `--async-parents` to `trace-tree` (root + hub end immediately while children keep running) |+| A realistic agent flow over a timeline (graph view + scrubbable timeline) | `pnpm run seed -- agent-timeline --turns 6 --v4` (LangGraph refine loop planner→retriever→generator→critic→loop, staggered in time; add `--timing-only` for the pure timing fallback) || A demo-grade, real-looking agent trace (videos, screenshots, docs) | `pnpm run seed -- support-agent --v4 --id-prefix <hex>` (one fixed, fully handcrafted support-copilot refund run: guardrails, parallel context fan-out, 3-turn ReAct loop with real payloads/costs; deterministic — reseed with a FRESH prefix for a clean take; the prefix is the trace id, so a hex prefix reads like production) |-| A plain trace with no agentic types (collapsed-by-default graph panel) | add `--plain` to `trace-tree` (SPAN/GENERATION/EVENT only) |+| A plain trace with no agentic types (collapsed-by-default graph panel) | add `--plain` to `trace-tree` (SPAN/GENERATION/EVENT only) || An extremely DEEP single-chain trace (tree depth = observation count; layout stress) | `pnpm run seed -- deep-chain --v4` (1401 sequential generations, each the sole child of the previous — the mis-parented-instrumentation shape from LFE-10959 that collapses tree/timeline layouts; `--observations N` to change depth) |-| A super tough session (v3 legacy session view) | `pnpm run seed -- long-session --traces 300 --observations-per-trace 8` |-| Diverse v4 session shapes (chat / coding-agent / mixed) for the session-detail view | `pnpm run seed -- session-shapes --shape all` (the `agent` shape has I/O on AGENT/TOOL with no GENERATION — pre-LFE-10520 the "first generation" default rendered empty cards for it; the current "All observations with I/O" default renders it correctly; v4 on by default) |-| Many traces for list/filter performance | `pnpm run seed -- many-traces --count 100000 --days 14` |-| Scores with spaces in the name (filter/grammar testing) | `pnpm run seed -- scored-traces --traces 24 --v4` |-| Lots of scores on every node (dense score badges, tree-row overflow testing) | add `--scores-per-node 12` to `trace-tree` (N distinct scores per observation; try `--depth 2 --breadth 44` for many tall sibling rows) |-| Varied human-annotation queues (annotate UI / keyboard testing) | `pnpm run seed -- annotation-queue --core-items 12` (creates a "core types" queue covering every score-field render path + an "edge cases" queue with archived/stale/partial scores and observation/session/deleted/completed items) |-| Huge/malformed/unicode payloads | `pnpm run seed -- trace-tree --payload-bytes 1000000 --payload-style malformed` (styles: json, text, malformed, unicode, bignum) |-| Big integers beyond 2^53-1 (number-precision testing) | `pnpm run seed -- trace-tree --observations 1 --payload-style bignum` |-| See all scenarios and flags | `pnpm run seed -- list --json` |-| Predict without writing | add `--dry-run` |+| A super tough session (v3 legacy session view) | `pnpm run seed -- long-session --traces 300 --observations-per-trace 8` |+| Diverse v4 session shapes (chat / coding-agent / mixed) for the session-detail view | `pnpm run seed -- session-shapes --shape all` (the `agent` shape has I/O on AGENT/TOOL with no GENERATION — pre-LFE-10520 the "first generation" default rendered empty cards for it; the current "All observations with I/O" default renders it correctly; v4 on by default) |+| Many traces for list/filter performance | `pnpm run seed -- many-traces --count 100000 --days 14` |+| Scores with spaces in the name (filter/grammar testing) | `pnpm run seed -- scored-traces --traces 24 --v4` |+| Lots of scores on every node (dense score badges, tree-row overflow testing) | add `--scores-per-node 12` to `trace-tree` (N distinct scores per observation; try `--depth 2 --breadth 44` for many tall sibling rows) |+| Varied human-annotation queues (annotate UI / keyboard testing) | `pnpm run seed -- annotation-queue --core-items 12` (creates a "core types" queue covering every score-field render path + an "edge cases" queue with archived/stale/partial scores and observation/session/deleted/completed items) |+| Huge/malformed/unicode payloads | `pnpm run seed -- trace-tree --payload-bytes 1000000 --payload-style malformed` (styles: json, text, malformed, unicode, bignum, base64) |+| Big integers beyond 2^53-1 (number-precision testing) | `pnpm run seed -- trace-tree --observations 1 --payload-style bignum` |+| Huge base64 data-URI in ChatML IO (multimodal crash shape, LFE-10152) | `pnpm run seed -- trace-tree --observations 30 --payload-bytes 20000000 --payload-style base64 --v4` (one unbroken multi-MB base64 token in trace + root-observation IO; max 50 MB) |+| See all scenarios and flags | `pnpm run seed -- list --json` |+| Predict without writing | add `--dry-run` |## Contractdiff --git a/packages/shared/scripts/seeder/scenarios/payload.ts b/packages/shared/scripts/seeder/scenarios/payload.tsindex caede9c73d..68c456537a 100644--- a/packages/shared/scripts/seeder/scenarios/payload.ts+++ b/packages/shared/scripts/seeder/scenarios/payload.ts@@ -1,6 +1,12 @@import { Rng } from "./rng";-export type PayloadStyle = "json" | "text" | "malformed" | "unicode" | "bignum";+export type PayloadStyle =+ | "json"+ | "text"+ | "malformed"+ | "unicode"+ | "bignum"+ | "base64";export const PAYLOAD_STYLES: PayloadStyle[] = ["json",@@ -8,6 +14,7 @@ export const PAYLOAD_STYLES: PayloadStyle[] = ["malformed","unicode","bignum",+ "base64",];export const GEN_INPUT_PRICE = 2e-6;@@ -176,10 +183,55 @@ const buildBignumPayload = (targetBytes: number): string => {return `{${entries.join(",")}}`;};+const BASE64_ALPHABET =+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";++/**+ * Builds a ChatML-shaped payload whose user message embeds one giant base64+ * data-URI — the multimodal-trace shape (image/audio inlined instead of using+ * the media SDK) that stresses IO viewers with a single unbroken multi-MB+ * token: no whitespace to wrap on, no JSON structure to lazily expand.+ */+const buildBase64Payload = (rng: Rng, targetBytes: number): string => {+ // Random 4KB blocks tiled to size: deterministic via the rng stream, and+ // varied enough that ClickHouse compression doesn't collapse the payload+ // into something unrealistically small on disk.+ const blocks: string[] = [];+ const blockCount = Math.ceil(targetBytes / 4096);+ const distinctBlocks = Math.min(blockCount, 32);+ for (let b = 0; b < distinctBlocks; b++) {+ let block = "";+ for (let i = 0; i < 4096; i++) block += BASE64_ALPHABET[rng.int(0, 63)];+ blocks.push(block);+ }+ const parts: string[] = [];+ for (let b = 0; b < blockCount; b++) {+ parts.push(blocks[b % distinctBlocks]);+ }+ const b64 = parts.join("").slice(0, Math.max(targetBytes, 64));+ return JSON.stringify({+ messages: [+ { role: "system", content: "You are a helpful vision assistant." },+ {+ role: "user",+ content: [+ { type: "text", text: "What is in this image?" },+ {+ type: "image_url",+ image_url: { url: `data:image/png;base64,${b64}` },+ },+ ],+ },+ ],+ });+};+/*** Builds a payload string of approximately targetBytes. "malformed" returns* intentionally invalid JSON (truncated, unclosed) for JSON-viewer edge cases.* "bignum" returns integers beyond 2^53-1 for number-precision edge cases.+ * "base64" returns ChatML messages embedding one giant base64 data-URI for+ * huge-single-string IO-viewer edge cases.*/export const buildPayload = (style: PayloadStyle,@@ -195,6 +247,8 @@ export const buildPayload = (return buildUnicodePayload(rng, targetBytes);case "bignum":return buildBignumPayload(targetBytes);+ case "base64":+ return buildBase64Payload(rng, targetBytes);case "malformed": {const valid = buildJsonPayload(rng, targetBytes);return `${valid.slice(0, Math.floor(valid.length * 0.9))},"unclosed":"tr`;diff --git a/packages/shared/scripts/seeder/scenarios/trace-tree.ts b/packages/shared/scripts/seeder/scenarios/trace-tree.tsindex bdeab0d69e..c37e909bbe 100644--- a/packages/shared/scripts/seeder/scenarios/trace-tree.ts+++ b/packages/shared/scripts/seeder/scenarios/trace-tree.ts@@ -702,7 +702,7 @@ export const traceTreeScenario: ScenarioDefinition = {flag: "payload-style",type: "string",default: "json",- description: "json | text | malformed | unicode | bignum",+ description: "json | text | malformed | unicode | bignum | base64",},{flag: "v4",