fix(logs): keep compacted child span trees shaped as trees - #8403
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
1 issue found across 7 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/lib/execution/payloads/serializer.ts">
<violation number="1" location="apps/sim/lib/execution/payloads/serializer.ts:309">
P1: When an output carries `childTraceSpans`, this call can spill the whole `rest` object; the following spread then treats the reference as output and loses its ordinary fields. Compact `rest` with `preserveRoot: true` so only individual payload fields spill.</violation>
</file>
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
4ffec75 to
cc3ee9c
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Block output compaction spilled oversized child span lists to large-value references, so a span's children could stop being an array and trace span building threw while finalizing the run. That left pauses unpersisted and runs unfinalized. - Compact child span trees structurally, spilling only each span's payload fields - Drop non-list child spans with a warning when building trace spans - Finalize without spans if building them fails, so logs, pauses, and billing settle
A structurally compacted tree had no whole-tree bound, so a large one stayed inline in block logs and pause snapshots. A tree still over the threshold after its payloads spill is now dropped (or rejected), as generic compaction bounded it. Block log outputs compact generically again; new logs never carry child spans there.
…hole A tree over the threshold as a whole now keeps its shape, names, timing, status, and cost instead of disappearing, using the same content stripping the execution log applies to oversized traces (moved to a shared module). Only a tree whose skeleton is still over the threshold is dropped.
cc3ee9c to
5ce7f18
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 9 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
…s in the skeleton The structural walk now keeps only span objects and drops a child list that is not an array, so building a skeleton can never throw on a malformed entry. The skeleton keeps a nested child workflow's output.childTraceSpans.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 9 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Per-field compaction can spill an oversized modelToolCalls, toolCalls, or providerTiming to a large-value reference; the skeleton now drops such a field instead of reading it.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
Block output compaction ran the generic payload compactor over
childTraceSpans. Compaction works bottom-up, so when a nested span'schildrenlist grew past the threshold it became a large-array manifest or large-value reference instead of an array. Trace span building later spread that value (flattenWorkflowChildren) and threwTypeError: directChildren is not iterable. Span building ran outside the finalizationtry, so the pause was never persisted, the run was never finalized or billed, and the log stayedrunninguntil it was swept. Any later resume was then refused. Other readers that walk raw span trees (children.map,for…of) have the same exposure.compactBlockOutputsplitschildTraceSpansoff the block output:childrenand nestedoutput.childTraceSpansstay arrays, and each span's payload fields spill individually, with a cycle guard.summarizeTraceSpansWithoutIo, the same stripping the execution log applies to oversized traces, now shared fromtrace-spans/summarize.ts. A tree whose skeleton is still over the threshold is dropped with a warning; when large values are rejected, an oversized tree is rejected instead. This bounds the tree as generic compaction did, including in pause snapshots.compactBlockLogsapplies the same rule tolog.childTraceSpans.Testing
childrenandoutput.childTraceSpansno longer throw.bun run type-check,bun run lint,bun run check:audits, and the fullapps/simsuite pass.