Skip to content

fix(transcript): skip non-record JSON without losing session usage - #412

Open
DivyamTalwar wants to merge 1 commit into
activeloopai:mainfrom
DivyamTalwar:fix/transcript-skip-non-record-json
Open

DivyamTalwar wants to merge 1 commit into
activeloopai:mainfrom
DivyamTalwar:fix/transcript-skip-non-record-json

Conversation

@DivyamTalwar

@DivyamTalwar DivyamTalwar commented Sep 23, 2026 •

Copy link
Copy Markdown

Summary

Fixes #411.

A syntactically valid null JSONL line throws before the parser can finish the remaining transcript. Malformed JSON is already skipped per line, so this contradicts the existing fail-soft parsing contract and discards otherwise usable session usage.

Skip nulls, scalar values and arrays before reading record fields. Valid records before and after the rejected line still contribute, and empty inputs retain their fallback session identity and timestamp.

Version Bump

No release requested. Package versions, dependencies, lockfiles and release workflows are unchanged.

Test plan

The repository-native focused tests report 4 failures and 0 passing controls on unchanged production source; the prepared correction passes all 4 focused tests. The final commit is independently validated by the full Node 22/Linux suite with coverage, typecheck, build, duplication guard and critical-only bundle audit. The workflow enforces zero failed and zero skipped tests.

Exact submitted commit: 988559d10a36ae043420e5e0b8599f9c22205237. Independent Linux job, commands and logs. The checkout is pinned to this commit, not a combined patch branch.

The focused tests use isolated files or source fixtures and the real parser/cache/usage code. No customer data, credentials or live model/backend calls are required.

Compatibility and limits

Does not change transcript capture, redaction, supported tool detection, rotation or usage formulas. Corrupt input is skipped; no new transcript schema is introduced.

A clean full macOS suite and native Windows validation are not claimed. Upstream CI approval and maintainer review are separate from this passing independent gate.

Summary by CodeRabbit

  • Bug Fixes
    • Improved transcript handling when records contain valid JSON in an unexpected format. These entries are now skipped, allowing processing to continue and valid session details and memory-search counts to be retained. When no valid records are available, the parser continues to use the provided fallback session information.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: activeloopai/hivemind/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: c9b36396-0d1a-48cf-8d12-975115a7ac86

📥 Commits

Reviewing files that changed from the base of the PR and between ce30de7 and 988559d.

📒 Files selected for processing (2)
  • src/notifications/transcript-parser.ts
  • tests/shared/transcript-parser-record-shapes.test.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

parseTranscript now skips JSON values that are not records. Tests cover null, scalar, and array values, as well as valid records before and after a skipped value.

Changes

Transcript record-shape handling

Layer / File(s) Summary
Skip non-record JSON values
src/notifications/transcript-parser.ts, tests/shared/transcript-parser-record-shapes.test.ts
The parser skips null, scalar, and array values. Tests check that valid tool records still contribute session data and that empty input uses the fallback session ID, timestamp, and zero counts.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 98855

Valid non-record transcript lines can be skipped without losing the tested session usage or fallbacks. No merge-blocking issue is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the transcript parser fix and the preservation of session usage when non-record JSON is skipped.
Description check ✅ Passed The description includes the required Summary, Version Bump, and Test plan sections. It explains the bug, the correction, validation results, compatibility limits, and why no release is requested.
Linked Issues check ✅ Passed PR #412 implements the coding requirements in issue #411. parseTranscript skips null, scalar, and array JSON values after parsing and before reading record fields. The parser continues to process …
Out of Scope Changes check ✅ Passed The reviewed changes are limited to the non-record guard in src/notifications/transcript-parser.ts and focused tests in tests/shared/transcript-parser-record-shapes.test.ts. The changes do not mod…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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.

Transcript parsing aborts on a non-record JSON line

1 participant