Skip to content

[P2][hillclimb] Lifecycle wire contract v2: interoperable refresh/cancel/replace controls (follow-up to #86) #101

Closed

Description

@AetherAI3

Outcome

#86 proved read-only interoperability: protocol/qsearch-lifecycle/v1 (status only) plus a TypeScript status client, both checked against goldens generated by the Python implementation. The issue said explicitly that cancellation and replacement "write semantics need a separate follow-up after interoperability is proved". This is that follow-up. The goal is to let a non-Python host request refresh, cancel and replace through the existing service endpoints, without creating a second lifecycle authority or any retry or automation that changes the server's guarantees.

Starting point

  • The Python LifecycleClient already has explicit refresh, cancel and replace calls (docs/qsearch-lifecycle.md, "Explicit host controls"). Each makes one signed POST and binds the method, path and body in the MAC.
  • Contract v1 deliberately excludes them. A v1 client refuses them with UNSUPPORTED_CAPABILITY.

First milestone and strict scope

  • Contract v2. Publish nano.qsearch.lifecycle-wire.v2 as an additive version and leave v1 frozen. It must pin:
    • POST body bytes: empty for refresh and cancel; canonical JSON of a predator.qsearch.request.v2 for replace.
    • Body SHA-256 framing.
    • Response binding:
      • a control response must bind the requested digest;
      • a replace response must bind the new descriptor digest, plus lineage.replaces_request_digest == original.
    • The control-specific error codes: CANCELLATION_*, REPLACEMENT_*, ORIGINAL_ATTEMPT_UNRECONCILED, NEW_IDENTITY_REQUIRED, NEW_TARGET_REQUIRED, REQUEST_BUSY.
  • Goldens. Derive them from the real service with fake providers only, following the [P1][hillclimb] Publish a portable lifecycle wire contract and TypeScript read-only client #86 regen.py pattern. Record any Python discrepancy as a strict-xfail compatibility test.
  • TypeScript. Add refresh / cancel / replace to the TS client behind an explicit capability set chosen by the caller. A client created for status-only must keep refusing them.

Wire and governance rules

  • Each call makes exactly one POST and is never retried. A lost acknowledgement maps to TRANSPORT_UNAVAILABLE with next_action: MANUAL_RECONCILIATION (Python parity), never to an assumed success.
  • A cancellation request is not cancellation. Only a later status showing execution.status: CANCELLED confirms it. The client never infers cancellation from a timeout, a deadline or an acknowledgement.
  • Replace is refused locally before I/O unless the caller supplies a new request ID, a new digest and a different target. Server-side refusal stays authoritative.
  • Calling a client method grants no host or provider authority. ATLAS authority, reservation and budget checks stay server-side and unchanged. No budget logic goes in clients.
  • No endpoint, schema identity, receipt, provider or ledger changes. [P1][language] Define typed prepare, sample and optimize operations for quantum comm-ops #61 native operations stay out of scope.

Acceptance matrix

  • Bytes and MAC: the bytes and MAC for each control match Python byte for byte, with synthetic keys.
  • Exactly one POST:
    • every control is exactly one transport call (zero when refused locally);
    • nothing follows a response automatically: no status read, retry, cancel or replace.
  • Binding: a replace response with the wrong descriptor digest or parent digest is INVALID_RESPONSE.
  • Cancellation histories stay distinct, and none is reported as confirmed cancellation unless execution is CANCELLED:
    • lost acknowledgement
    • cancel already dispatched
    • provider reports RUNNING / DONE / ERROR after the cancel request
  • Compatibility: v1 fixtures and v1 clients stay byte-stable and keep passing.
  • Runs offline: fake providers or local simulator only; no live connection or spend.

Dependencies and lane boundary

Activity

  1. AetherAI3 commented on Nov 8, 2026

    @AetherAI3
    OwnerAuthor

    Landed on green self-hosted CI with normal merges (no --admin). Each merge was pinned to its verified head, and main's file contents equal the tested heads.

    • docs(protocol): lifecycle wire contract v2 + Python goldens for refresh/cancel/replace (#101, 1/2) #107 31b30df: nano.qsearch.lifecycle-wire.v2, the additive contract (v1 untouched).
      • Contents: caller-chosen capabilities (default ["status"]); POST framing; Python-exact canonical replacement bytes (code-point key order, number kind taken from the lexeme, repr floats); replace bound to the descriptor digest plus lineage; and a lost acknowledgement means observe, never an assumed effect.
      • Goldens come from the real service and Python client with fake providers: 15 canonical vectors and 21 refusals, signing for every control, 8 control histories (including cancel raced by completion and cancel before submission → NOT_RUN), 18 real service errors and 18 negatives.
      • Python tests: 189 passed, 7 strict xfails, all recorded discrepancies. Python's replace takes a parsed Mapping, so duplicate keys and depth limits are the caller's parser's concern, and Python has no capability set.
    • feat(sdk): TypeScript refresh/cancel/replace controls (wire v2) (#101, 2/2) #108 9e14862: the TS LifecycleClient gains refresh/cancel/replace behind capabilities, plus a lexeme-preserving canonicaliser and an injected SHA-256. StatusClient and v1 behaviour are unchanged.
      • Local: npm test 121/121 against the Python v2 and v1 goldens. CI: Node 20/24 green, plus all 6 required checks.
      • Held-out set: 20 cases, frozen before implementation and never shown to the implementer. Result 20/20: canonical bytes, local refusals, replace binding, lost acknowledgements.
      • Independent review found no CRITICAL or HIGH issues. A 36,669-input canonical differential against Python showed no byte or refusal mismatch beyond the documented stricter rules. One MEDIUM finding (sha256 invoked after the deadline) was fixed, with a failing test first.
    • Hillclimb: 3 TS candidates. One fixture-convention fix along the way: field is now unspecified for INVALID_RESPONSE negatives, matching v1.

    Follow-up owned by the #88 lane: a lifecycle_wire_v2 conformance capability that pins the v2 SHA256SUMS, regen --check and 8 stable v2 test IDs.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions