feat(trace): session lineage fields (parentRunId/parentSessionId/delegationDepth) + runs index - #2873
Merged
esokullu merged 1 commit intoAug 21, 2026
Conversation
|
@alectimison-maker is attempting to deploy a commit to the esokullu's projects Team on Vercel. A member of the Team first needs to authorize it. |
Runs gain parentRunId, parentSessionId, and delegationDepth, normalized through a new browser-neutral run-header.js allowlist (bounded ids and depth, content-free by construction). delegationDepth resolves explicit value, else 1 for a run with a parent, else 0 for root runs. conversationId remains the session identity — the v2 schema adds a sessionId index over that field plus a parentRunId index for future session-level aggregation, created idempotently during upgrade with no data migration. Old v1 records stay untouched and fully readable. Mirrored to Firefox. Closes webbrain-one#2870
webbrain-one
force-pushed
the
feat/trace-lineage-fields
branch
from
August 21, 2026 07:08
94c01f4 to
4e72a8a
Compare
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
trace/run-header.js(Chrome + Firefox): allowlisted normalization ofparentRunId/parentSessionId/delegationDepth.startRunstores the three lineage fields on every run record;delegationDepthresolves to an explicit value, else 1 for a run with a parent, else 0.sessionId(overconversationId) andparentRunIdindexes for future session-level aggregation. No data migration.Motivation
Closes #2870.
WebBrain has natural fork scenarios with no data to support them: cloud runs (
cloud-runs.js) and workflow replays (replaySavedWorkflow) produce independent runs, so "which browser run did this derived run come from" is unanswerable, and cost attribution cannot aggregate across a session and its derived runs.conversationIdalready groups sibling runs in the Traces UI; a parent chain extends that pattern to derived runs.Design
conversationIdstays the session identity — no new field name, avoiding three-way compatibility cost (UI / export / storage).parentRunId,parentSessionId,delegationDepth(old runs default to null/0 and are untouched).normalizeRunHeader()follows the existingruntime-config.jsallowlist pattern: bounded string ids (≤200 chars, no control characters), bounded integer depth (0–64), trimmed. Nothing content-bearing can reach these fields.effectiveDelegationDepth(): explicit depth wins; a run with a parent but no depth is a direct child (1); everything else is a root (0).DB_VERSION 1→2;onupgradeneededcreates the indexes idempotently (indexNames.containsguard). ThesessionIdindex is keyed onconversationId(which IS the session identity) and carries the semantic name so session-level queries read naturally; IndexedDB skips records with null keys, so old runs are simply absent from the indexes. v1 data survives the upgrade byte-for-byte.Testing
node test/run.js— passed, 1956 tests (4 new: normalization boundaries, depth resolution, mirror identity + browser-neutrality, recorder wiring)node --checkon every touched file — passedSkipped: unpacked-browser manual verification (no browser session available in this environment). The IndexedDB upgrade path is covered by source-level idempotency assertions; runtime IDB behavior in Chrome and Firefox is not manually exercised.
Compatibility and risks
sessionIdwhile the field isconversationId— deliberate, documented in code, matching the issue design.Scope
Deliberately deferred: this PR is recorder-side support only. Plumbing
parentRunIdfrom the cloud-run and replay entry points is the next PR; session aggregation views/stats follow later.