Skip to content

Preserve unified trace ordering and import OTel observations - #67635

Merged
pelikhan merged 4 commits into
mainfrom
pelikhan-unified-trace-ordering
Oct 11, 2026
Merged

pelikhan merged 4 commits into
mainfrom
pelikhan-unified-trace-ordering

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Summary

The unified trace previously moved untimed events to the end and globally sorted recorded timestamps, which could separate tool lifecycle observations or reverse their source-local order when clocks regressed. It also omitted the local OpenTelemetry mirror.

  • Preserve sequential agent, AWF, MCP gateway, and GitHub API source order while interleaving streams with nondecreasing, merge-only timestamp anchors. Original timestamps and provenance remain unchanged; entirely untimed sources stay at the tail.
  • Import local OTLP spans, span events, and log messages, preserving trace lineage, resource/scope context, payloads, and nanosecond ordering. OTLP export batches are sorted by observation time rather than export order. Authoritative-copy precedence, malformed-record warnings, secret redaction, and symlink protections remain in place.
  • Update the ordering validator, embedded CLI parser dependencies, generated schema, metadata-only summaries, and specification. The numeric serialization-format version remains 1.

Ordering trade-off

Source-local sequence takes precedence over regressing wall-clock timestamps. Anchors are used only for merging and are not persisted as observed times. OTel collection reads available local mirrors only; it does not query a backend or invent missing spans. The merge remains in-memory with a stable global sort.

Validation

  • make fmt, make fmt-cjs, and make lint-cjs passed.
  • make agent-report-progress passed for the implementation; BASE_REF=HEAD make agent-report-progress passed for the follow-up test-only changes.
  • JavaScript type checking, generated-schema freshness, and focused parser, payload, renderer, ordering, and schema suites passed.
  • Targeted Go CLI parser and session-download tests passed.
  • Added deterministic generated merge cases, a 32,000-event/16-source scale case, single-pass clock-read coverage, empty inputs, missing and zero OTel clocks, and persistence redaction checks. All 23 tests in the expanded ordering and OTel suites passed.

pelikhan and others added 2 commits October 10, 2026 22:23
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 11, 2026 05:37
Copilot AI balanced review requested due to automatic review settings October 11, 2026 05:37
@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills...

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

Unable to emit PR review because this run cannot execute safeoutputs via bash; needed allowlist entry: tools.bash: - safeoutputs.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

No ADR enforcement needed for PR #67635: the PR does not carry the 'implementation' label and has 0 new lines in default business logic directories (threshold: 100). No custom .design-gate.yml present.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #67635

@github-actions github-actions Bot mentioned this pull request Oct 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An explicitly null OTLP event clock incorrectly inherits an observation clock, fabricating ordering evidence.

1 open finding
What changed in this PR

This PR preserves source-local trace ordering while adding local OpenTelemetry observations to unified sessions.

Changes:

  • Adds anchor-based, nanosecond-aware multi-source ordering.
  • Imports and safely summarizes OTLP spans, events, and logs.
  • Updates validation, schemas, documentation, embedding, and tests.
File Description
docs/​src/​content/​docs/​specs/​unified-agent-session-specification.md Documents ordering and OTel behavior.
docs/​public/​schemas/​unified-session.schema.json Adds nanosecond timestamp units.
actions/​setup/​session_parsers.go Embeds new parser modules.
actions/​setup/​js/​unified_session.test.cjs Updates ordering expectations.
actions/​setup/​js/​unified_session.cjs Integrates ordering and OTel collection.
actions/​setup/​js/​unified_session_render.cjs Adds metadata-only OTel rendering.
actions/​setup/​js/​unified_session_otel.test.cjs Tests OTel collection and safety.
actions/​setup/​js/​unified_session_otel.cjs Expands OTLP observations.
actions/​setup/​js/​unified_session_order.test.cjs Tests ordering and precision.
actions/​setup/​js/​unified_session_order.cjs Implements anchored source merging.
actions/​setup/​js/​types/​unified_session.d.ts Adds nanosecond typing.
actions/​setup/​js/​scripts/​validate_session.cjs Validates source-preserving ordering.
actions/​setup/​js/​scripts/​session_schemas.test.cjs Updates schema-ordering tests.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread actions/setup/js/unified_session_otel.cjs Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-10-11T05:40:30.983+00:00
review_event: REQUEST_CHANGES
top_themes:
  - backward-compatibility in unified-session validator
files_reviewed:
  - actions/setup/js/scripts/validate_session.cjs
  - actions/setup/js/unified_session.cjs
  - actions/setup/js/unified_session_order.cjs
  - actions/setup/js/unified_session_otel.cjs
  - actions/setup/js/unified_session_render.cjs
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 60.8 AIC · ⌖ 5.7 AIC · ⊞ 21.2K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REQUEST_CHANGES

The new ordering logic is headed in the right direction, but the validator now changes how existing v1 unified-session artifacts are interpreted when timestampUnit is absent. Because the file-format version stays at 1 and the schema still makes that field optional, this is a backward-compatibility break rather than a harmless refinement.

Blocking theme
  • actions/setup/js/scripts/validate_session.cjs: missing timestampUnit now silently falls back to milliseconds, which can mis-read older seconds-based source timestamps and produce false not timestamp ordered failures.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 60.8 AIC · ⌖ 5.7 AIC · ⊞ 21.2K
Comment /review to run again

Comment thread actions/setup/js/scripts/validate_session.cjs Outdated
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/unified_session_otel.cjs:57): A log with an explicitly present but null timeUnixNano currently inherits observedTimeUnixNano because ?? treats null as absent. That fabricates an ordering timestamp even though T-UAS-056 permits the fallback only when timeUnixNano is absent (and invalid clocks elsewhere remain untimed). Check property presence explicitly and avoid emitting null event metadata. - Preserve unified trace ordering and import OTel observations #67635 (comment)
  3. Review (actions/setup/js/scripts/validate_session.cjs:72): Defaulting a missing timestampUnit to milliseconds breaks validation of existing v1 sessions that recorded source-local timestamps in seconds, so this can start rejecting or reordering artifacts without a format-version bump. - Preserve unified trace ordering and import OTel observations #67635 (comment)
  4. Fix failing check agent (FAILURE): https://github.com/github/gh-aw/actions/runs/38115402738/job/114399371956.
  5. Fix failing check conclusion (FAILURE): https://github.com/github/gh-aw/actions/runs/38115402738/job/114404636570.

Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI.

Sous-chef head: c99246f
Sous-chef work: 34f38971738f6a752a646bd7797a6c8d47fb096e4eb6f91e946a91255433c8c4 365a89a8fda2f66dcf838d55e66b2463933dc83106fc76814e4769171402acf3 51e2287c3d1ee41b7e13769862add61dcd292a623cf943abc5968c984e246bcf f29d48165f38476943586a356d2ddd86bfec1e16f84a3c5d8e75850a6ab85e87
Sous-chef state: 4e4cf351ab6cdeaa1293732aed269b5dbc1fa0818b51a7dc5d596444c71e3cbf

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · 7.82 AIC · ⌖ 6.56 AIC · ⊞ 1K · ◷
Comment /souschef to run again

Copilot AI and others added 2 commits October 11, 2026 06:31
…e-ordering

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot October 11, 2026 06:46
@pelikhan
pelikhan merged commit 0259718 into main Oct 11, 2026
2 checks passed
@pelikhan
pelikhan deleted the pelikhan-unified-trace-ordering branch October 11, 2026 07:33
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.

4 participants