Skip to content

Remote script recordings: deliver batch step scripts through one daemon-side delivery receipt #4595

Open

Description

@thymikee

Purpose

A remote batch delivers no script versions from its steps. To keep the final script from being lost silently, a batch that would close an armed remote recording is refused with remote_script_batch_close_unsupported. Users run close on its own after the batch.

#4582 first delivered batch-step scripts by having the client read the daemon's batch answer: the step entries, partialResults and the failure position. Six review rounds kept finding new ways a daemon answer could make the client deliver the wrong version, retire a recording that never closed, or drop a failure. That approach was removed from #4582, which now carries only the result fields.

Required behavior

  • The daemon's request owner collects script delivery effects for the outer request, including nested batch steps, and attaches one delivery receipt to the outer response. This applies to successful and failed batches.
  • The receipt names, for each publication:
    • the newest full-script version (scriptRevision and its artifact);
    • an explicit close receipt when a step closed the recording, including when the final script could not be written;
    • the typed scriptDeliveryFailure that applies, if any, with its paired warning.
  • The client never reconstructs delivery from step results. It:
    • validates the receipt's publication against its own record (exact ID, tenant, session, endpoint);
    • validates a close receipt against the batch plan it submitted;
    • downloads at most one version per response;
    • retires the record on a validated close.
  • Remove the remote_script_batch_close_unsupported refusal once this lands.

Acceptance cases

Each case is a test that fails on a client that interprets step results.

From the round at d14e68a:

  1. A publication ID padded with whitespace does not mask the recording's real final version, and does not retire the record.
  2. An ok: false step entry delivers nothing and authorizes no later retirement.
  3. A failed batch whose error omits the failing step and command is never read as a full success.
  4. A null or other non-object entry in an artifact list does not throw, and does not hide a valid version.
  5. When both the daemon's step write and the client's download fail, both typed failures and warnings reach the batch result.

From earlier rounds:
6. A failed batch delivers the completed steps' newest version and keeps the original batch error.
7. A close whose final script the daemon could not write still retires the record, and discloses the failure.
8. A forged close entry, or a close the batch never reached, never retires the record.
9. The number of downloads and of entries examined is bounded, whatever the answer names.
10. Batch delivery warnings appear in CLI and MCP human output.
11. A failure position beyond the plan, or one whose command differs from the plan, authorizes nothing.
12. A malformed publication ID drops the artifact and keeps the batch's outcome.
13. Selecting the newest version runs in linear time.
14. A newer version on the batch's own payload is delivered even when no step carries one.
15. A higher-revision entry with the wrong artifact type, or for another recording, never masks this recording's version.
16. A failure a finished step reports reaches the batch result when only failures are present.
17. Step command names are resolved with normalizeBatchCommandName.

Completion conditions

  • A provider scenario runs a remote open with --save-script, then a batch of wait and close. It asserts that the caller file holds the final script and that the client record is retired.
  • ADR 0016 replaces the batch known-limitation note.

Follows #4564 and #4582.

Activity

  1. apex-sentinel-staging commented on Nov 16, 2026

    @apex-sentinel-staging

    Apex Sentinel · Issue review

    Suggested label: feature

    The issue specifies a new daemon-side delivery receipt design for remote batch script delivery and requests removing the current remote_script_batch_close_unsupported refusal, making it an enhancement request rather than a defect report.

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

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions