Skip to content

feat(agent): add durable JSONL trace foundation - #94

Merged
Pepps233 merged 4 commits into
feat/self-evolution-basefrom
feat/harness-trace-foundation
Aug 23, 2026
Merged

Pepps233 merged 4 commits into
feat/self-evolution-basefrom
feat/harness-trace-foundation

Conversation

@Pepps233

@Pepps233 Pepps233 commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a private, runtime-neutral JSONL trace foundation that implements the existing callback-based telemetry contract.

One trace can now represent a complete Diffex process invocation across session bindings and live harness activations without importing either runtime or requiring AgentHarness completion.

Runtime wiring, transcript materialization, analysis, and evolution changes remain out of scope for this PR.

Reasoning

Immutable producer identity belongs in the trace header, while session and harness state can change during one process invocation and must be represented as ordered records.

Format-specific cursors preserve truthful durability boundaries without coupling the trace package to coding-agent or AgentHarness internals.

A streaming validator makes incomplete and corrupted traces diagnostically useful by retaining valid records while reporting structural failures.

Exclusive per-invocation files, serialized writes, and passive post-creation failures keep tracing isolated from application behavior.

Changes

  • Add the private @earendil-works/diffex-harness-trace package with only the telemetry package as a runtime dependency.
  • Keep immutable producer identity in the header, including Diffex version, source revision, runtime kind and version, trace schema version, and telemetry schema versions.
  • Add explicit session_attach records with stable binding IDs, session identity, path, format metadata, and attachment reasons.
  • Add harness_activate records for initial activation and live harness switching.
  • Replace numeric session ranges with session_segment records using coding-agent v3 entry cursors or AgentHarness durable sequence bounds.
  • Validate coding-agent entry ordinals, entry IDs, and SHA-256 prefix or content digests without importing coding-agent code.
  • Preserve strict single-record encoding, exclusive file creation, serialized writes, nested spans, events, span settlement, health counters, flush(), idempotent close(), missing-footer crash detection, and passive writer degradation.
  • Add a streaming whole-file reader that detects sequence gaps, duplicate or misplaced headers and footers, invalid span parentage, duplicate settlement, records after closure, partial final lines, missing footers, and incompatible trace schemas while retaining valid records for diagnostics.
  • Add coding-agent v3 and future AgentHarness cursor fixtures, telemetry adapter conformance coverage, and focused transition, truncation, writer failure, and recovery tests.
  • Add root TypeScript aliases, build ordering after telemetry, and refreshed workspace lock metadata.

Testing

  • node ../../node_modules/vitest/dist/cli.js --run test/harness-trace.test.ts from packages/harness-trace - 34 tests passed.
  • npm run check

- Persists telemetry spans and session ranges without transcript payloads
- Keeps recorder failures passive and marks incomplete invocations with missing footers
- Runs the shared telemetry adapter contract against durable JSONL output
- Protects ordering, crash markers, exclusive creation, and passive failure behavior
- Separates immutable producer identity from session and harness changes
- Validates recoverable JSONL streams without importing runtime packages
- Locks coding-agent and AgentHarness cursor formats to portable fixtures
- Protects diagnostics for transitions, truncation, writer failure, and corrupt structure
@Pepps233
Pepps233 marked this pull request as ready for review August 19, 2026 05:24
@Pepps233
Pepps233 merged commit 956c746 into main Aug 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant