Skip to content

fix(sensor): preserve Claude transcript content and incremental updates - #130

Merged
barisozbas merged 6 commits into
mainfrom
wt/claude-parser-refresh
Sep 23, 2026
Merged

barisozbas merged 6 commits into
mainfrom
wt/claude-parser-refresh

Conversation

@barisozbas

@barisozbas barisozbas commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Recover complete JSONL records conservatively, preserve mixed text and tool
results, correlate results with exact tool invocations, and distinguish child
sessions. Track content changes so incremental capture includes resumed turns.

Add synthetic parser and observer regression coverage and document limitations.

String/text-block messages, mixed user text and tool results, repeated identical
tool calls, malformed records, child-session identity, and appended turns now have
regression coverage. Subagent discovery includes nested subagents directories
documented in Claude Code.

What type of PR is this?

  • Bug Fix
  • Documentation Update

Related issue: None; parser maintenance. Complements #38 without implementing
its tool classification, MCP attribution, or error-status changes.

Why? Valid recorded content could be omitted or attributed to the wrong tool
invocation, and local incremental capture could skip resumed Claude sessions.

Test Plan

  • 329 sensor tests pass locally on Python 3.9 and 3.12, using synthetic transcripts
    and in-memory exporters. Ruff and whitespace checks pass.
  • CI sensor matrix passes on Python 3.9–3.13.
  • No live Claude sessions were read and no collector was contacted for validation.

Potential risks: Child-session IDs now include the agent identifier; downstream
consumers should use the recorded parent relationship. All recorded branches remain
in file order; this is not an active-branch reconstruction. Existing truncation is
unchanged. Native Windows/macOS/Linux installations were not end-to-end tested.

Revert Plan

Revert this commit to restore the previous parsing and incremental behavior;
previously written normalized session files are not automatically removed.

Recover complete JSONL records conservatively, preserve mixed text and tool
results, correlate results with exact tool invocations, and distinguish child
sessions. Track content changes so incremental capture includes resumed turns.

Add synthetic parser and observer regression coverage and document limitations.
Summary:
Add fixed-code parser recovery counters and per-source health summaries across
all ten capture sources, including runs with no usable sessions. Keep operational
records separate from captured telemetry and export them only with --otel-config.

Rotate diagnostics.jsonl and error.log, record partial run failures, and add
--fail-on-error for schedulers that need strict exit status. Document incomplete
coverage, single-writer rotation, and unchanged legacy console output.

This change builds on #130 and should merge after it. The PR targets its feature
branch to keep the diagnostic diff separate; main-only CI will run after retargeting.

Test Plan:
Synthetic tests cover partial/zero-output failures, malformed records, expected
live tails, missing inputs, log rotation, fixed-schema privacy, resource accounting,
and in-memory OTLP health serialization. No real sessions or collectors are used.

Revert Plan:
Revert this commit to restore the previous error reporting and CLI exit behavior.
Existing diagnostic files remain on disk and can be archived by the operator.
Summary:
Drain bounded log batches and reconcile submitted/exported counts so the SDK queue
cannot silently drop large captures. Validate protobuf acknowledgements, including
HTTP-success partial rejection, before marking delivery successful.

Track successful session snapshots in atomic hash-only destination checkpoints,
independently of local JSON files. Retry unacknowledged sessions on a later run;
continue sending sensor health even when sessions are already acknowledged.
Document at-least-once semantics, credential configuration, and retry limitations.

This builds on #131 (which builds on #130). Review and merge in that order; the
main-only CI matrix will run after retargeting this PR to main.

Test Plan:
Synthetic tests exercise queue overflow protection, dropped-record detection,
partial collector acknowledgements, retries, checkpoint failures, authentication
scope, and health-only runs. No live sessions or collectors are used.

Revert Plan:
Revert this commit to restore the previous exporter. Hash-only checkpoint files
remain harmless and are ignored by the previous version.
@barisozbas
barisozbas marked this pull request as ready for review September 19, 2026 12:55
fix(sensor): acknowledge OTLP delivery independently of local capture
feat(sensor): report bounded parser health and suspected format drift
@CLAassistant

CLAassistant commented Sep 23, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@barisozbas
barisozbas merged commit abc12c2 into main Sep 23, 2026
14 checks passed
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.

3 participants