Skip to content

Make CreateWatcher replay-safe after lost HTTP responses #17

Description

@sweetcornna

Problem

PR #15 makes watcher ownership single-owner inside the client, watcher table, and executor, but a protocol-level ambiguity remains: CreateWatcher can succeed while its HTTP response is lost. The client then has no watcher ID to poll or remove, while the daemon retains a live watcher and capacity reservation.

Blindly retrying the request is not safe today because there is no client-supplied operation identity; the retry can allocate a second watcher.

Required semantics

Define and document a bounded, sandbox-scoped operation/idempotency identity for CreateWatcher, including the E2B-compatibility/versioning decision and the deduplication retention window.

  • Sequential and concurrent requests with the same identity and the same canonical path/options return the original watcher ID.
  • A replay creates exactly one watcher-table record, one physical watcher, and consumes one capacity slot.
  • Reusing an identity with different path/options returns a deterministic conflict/error and does not mutate the original watcher.
  • If creation succeeded but the response was lost, retrying recovers the original watcher ID.
  • If the first request never reached the daemon, retrying creates exactly one watcher.
  • Deduplication state is bounded; expiry cannot leak a physical watcher or permanently consume the 128-watcher limit.

Acceptance tests

  • lost response after successful creation, then retry;
  • request never reached the server, then retry;
  • sequential replay;
  • concurrent replay;
  • same identity with mismatched path/options;
  • retention expiry;
  • watcher-table capacity and physical-process count return to baseline after cleanup.

Non-goals

Follow-up to #15.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions