Skip to content

feat(amp-semantic): capture replay recording boundaries - #2152

Open
jxiwang wants to merge 67 commits into
mainfrom
codex/semantic-recording
Open

jxiwang wants to merge 67 commits into
mainfrom
codex/semantic-recording

Conversation

@jxiwang

@jxiwang jxiwang commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Captures compact amp-semantic/recording start, stop, and resume boundaries from Session Replay lifecycle decisions. Start/resume follows the first accepted full snapshot. Terminal stop is emitted before rrweb teardown, including customer stop and opt-out paths. The family contract also supports pause for future SDK use.

Stacked on #2151. This is the clean replacement for the recording portion of older draft #2080, using the current injected capture runtime.

Validation

  • Node 24, pnpm install --frozen-lockfile — passed
  • Semantic and Session Replay package dependency builds — passed
  • Semantic tests — 44 passed, 100% coverage
  • Session Replay Browser tests — 1,172 passed, 100% coverage
  • Semantic Playwright — 10 passed, including stop/resume transport
  • pnpm lint, pnpm lint:deps, pnpm test:examples — passed
  • Full workspace pnpm build on the parent stack stalled in unchanged Segment Session Replay Rollup. Full workspace pnpm test on the parent stack failed in unchanged analytics-react-native tests. This draft remains open pending green workspace gates.

Note

Medium Risk
Changes session-boundary teardown, re-init, and event-compressor ordering paths where mis-ordering could corrupt replay sequences; behavior is heavily covered by new unit and Playwright tests.

Overview
Adds amp-semantic/recording as a default semantic family: the host supplies start/stop/pause/resume plus a reason, and the recorder only stamps identity and transports the event (new schema branch and families.recording disable switch).

Session Replay drives those signals: ReplaySemanticAdapter emits start/resume on the first accepted full snapshot and a terminal boundary before rrweb teardown; session-replay.ts threads reason codes through customer stop, opt-out, sampling/targeting gates, recorder restart, new session, re-init, and errors. Session changes and re-init now close the old recorder with a semantic stop, flush the compressor, then send—so closing boundaries are not lost behind idle/worker queues.

EventCompressor.enqueueEvent gains forceSync for recording custom events: it drains pending worker/idle work, ignores stale worker replies, and writes boundaries in order. Terminal recording events are exempt from the emit guard that would otherwise drop events during stop.

Reviewed by Cursor Bugbot for commit 465f941. Bugbot is set up for automated code reviews on this repo. Configure here.

# Conflicts:
#	packages/amp-semantic/README.md
#	packages/amp-semantic/package.json

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Base automatically changed from codex/semantic-navigation to main November 18, 2026 21:12
# Conflicts:
#	packages/amp-semantic/README.md
#	packages/amp-semantic/e2e/replay.spec.ts
#	packages/amp-semantic/schema.json
#	packages/amp-semantic/src/index.ts
#	packages/amp-semantic/src/types.ts
#	packages/amp-semantic/test/schema.test.ts
#	packages/session-replay-browser/src/semantic-types.ts
#	test-server/session-replay-browser/sr-semantic-test.html
#	test-server/session-replay-browser/sr-semantic-test.js

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ac2a6d7. Configure here.

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.

2 participants