Skip to content

feat(chat-swarm): deterministic worker continuation epoch transfer (#51-A) #120

Description

@James3014

Parent / purpose

Child implementation slice of #51. This issue owns #51-A deterministic worker continuation/rebind semantics only. It is intentionally transport-neutral and may proceed in parallel with #117.

Current source fence at creation:

  • repository: James3014/devspace
  • main: ab22dc9d0360bd02d00892734a5c51cdd0873f39
  • existing Swarm truth already includes workerId, carrierConversationFingerprint, checkpoint, continuationEpoch, task/attempt identity and fail-closed reconciliation.

Authority boundary

Preserve:

logical worker / task / attempt / continuation truth = Chat Swarm durable state
carrier creation/navigation/wake = #117/#105

Do not add browser/session-launch logic here. Do not create a second queue, worker registry, task authority or retry authority.

Required deterministic contract

At a safe continuation boundary:

worker W / epoch N / current carrier A
-> authenticated target carrier B requests continuation
-> request binds exact swarm + worker + sourceEpoch + targetEpoch
   + source carrier + target carrier + checkpoint hash + expiry/version
-> exact Owner approval / CAS
-> one atomic binding transfer
-> worker W becomes epoch N+1 on B
-> A is fenced from `next` / `submit`
-> durable readback recovers committed result after lost acknowledgement

Minimum V1 may allow transfer only when the worker is AVAILABLE, has no current task, and has a bounded checkpoint. Active/unknown effects must fail closed; they must not be cleared, requeued or duplicated by rollover.

Required invariants / hostile controls

  • target identity comes only from authenticated request metadata, never caller-supplied fingerprint;
  • source carrier must still equal the worker's current bound carrier at commit;
  • targetEpoch == sourceEpoch + 1;
  • exact replay is idempotent; changed material under the same attempt key is REPLAY_CONFLICT;
  • wrong swarm / worker / source epoch / target carrier fails closed;
  • parallel target carriers for the same worker: at most one commit;
  • expired request cannot commit;
  • response loss after commit is recoverable by durable readback and never creates a second replacement;
  • old carrier remains current until commit, then immediately loses worker authority;
  • old carrier next / submit after commit is rejected by existing worker identity checks;
  • no worker slot is added or consumed by continuation;
  • malformed/corrupt persisted continuation state fails closed;
  • restart preserves pending/committed continuation truth;
  • bounded capsule/checkpoint identity is hash-bound; no full transcript, hidden reasoning, credentials or raw tool dump is persisted.

Source shape

Prefer the smallest additive slice over current Swarm SQLite:

  • additive migration for durable continuation request/receipt state;
  • contract types/hash helper;
  • store transaction(s) for request/readback/commit;
  • coordinator methods that bind authenticated target identity and exact owner approval;
  • focused chat-swarm-continuation tests;
  • MCP/public tool registration may be included only if it remains bounded and does not pull P0: implement macOS zero-touch ChatGPT worker runtime pool #117 carrier behavior into this slice.

Verification

Required source acceptance:

  • focused continuation tests covering all positive/negative/replay/restart cases;
  • existing peer admission, task ledger, lifecycle, store and coordinator regressions;
  • database upgrade/reopen witness;
  • typecheck;
  • build;
  • npm test on macOS policy where practical;
  • git diff --check;
  • independent exact-head review before merge.

Claim ceiling

Source/CI completion of this issue may establish:

DETERMINISTIC_WORKER_CONTINUATION_SOURCE_ACCEPTED

It does not establish real ChatGPT conversation rollover, Auto Compact, zero-touch carrier creation, #117 completion, #51 overall completion or #104 Ultra parity.

Live #51 acceptance must later use #117/#105 to create the replacement carrier automatically with manual replacement-worker creation = 0 and manual continuation-ticket transfer = 0.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions