Skip to content

feat: restore remote run cursors#238

Merged
roackb2 merged 1 commit into
mainfrom
codex/restore-remote-run-cursor
Jul 12, 2026
Merged

feat: restore remote run cursors#238
roackb2 merged 1 commit into
mainfrom
codex/restore-remote-run-cursor

Conversation

@roackb2

@roackb2 roackb2 commented Jul 11, 2026

Copy link
Copy Markdown
Owner

What changed

  • let ConversationRunConsumerService.select(...) initialize a run from a validated afterSequence cursor
  • preserve idempotent selection so the current run cannot be rewound or skipped accidentally
  • export the additive selection-options type from @roackb2/heddle-remote
  • update the hosted browser example to discard and reconstruct its consumer, modeling refresh-style resume
  • document cursor persistence and responsibility boundaries in the remote service README

Why

Remote products can persist an accepted run ID and last handled event sequence across a page refresh, but the consumer previously always restarted at sequence 0. That forced a product such as a browser editor to replay the entire retained stream even when it already had a durable cursor.

The cursor state machine already belongs to Heddle's remote consumer service, so this extends that existing boundary instead of adding a second product-specific resume implementation.

Developer impact

Existing callers are unchanged. A reconstructed client can now resume with:

consumer.select(
  { runId: persistedRunId },
  { afterSequence: persistedSequence },
)

The next accepted event must be exactly persistedSequence + 1. Duplicates remain suppressed, gaps still fail loudly, and selecting the same current run again never changes its cursor.

Validation

  • targeted consumer tests: 9 passed
  • full Heddle tests: 110 unit files / 640 tests; 32 integration files / 291 tests
  • yarn typecheck
  • yarn eslint
  • yarn remote:build
  • npm pack ./packages/heddle-remote --dry-run --cache /private/tmp/heddle-remote-npm-cache

@roackb2 roackb2 merged commit 06c8cd2 into main Jul 12, 2026
5 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.

1 participant