Skip to content

Chore: reconcile or remove the unused RetryPart message part #123

Description

@byapparov

Context

Raised as a deferred finding in the round-3 automated review of #122. It predates that PR and is out of scope for it.

MessageV2.RetryPart (type: "retry" with attempt, error, time) is defined in packages/cli/src/session/message-v2.ts and included in the Part union. It is mirrored in the generated SDK types (packages/sdk/src/gen/types.gen.ts). Nothing in the repo produces it.

Retries are surfaced instead through SessionStatus { type: "retry", attempt, message, reason, next } and, since #122, the headless NDJSON retry event. That leaves two in-repo models of "a retry happened": one unused schema and one live status/event pair. Both the part type and the NDJSON event are named retry, which makes it easy for SDK consumers to implement against the wrong one.

Proposal

Pick one of these:

  1. Remove RetryPart from the Part union and regenerate the SDK types. The live retry signal remains SessionStatus plus the NDJSON retry event.
  2. Adopt it. Persist a RetryPart per retry attempt in the processor's retry branch, so retries are replayable in stored history. Keep the status event as the live signal. The stored error must be sanitized the same way the exhausted-retry terminal error is: no provider response headers, body or URL.

Acceptance criteria

  • Only one persisted retry representation remains in message-v2.ts and the generated SDK types, or RetryPart is actually emitted with sanitized error data.
  • If option 1 is chosen: rg RetryPart packages/ returns no source hits after regeneration, and typecheck passes.
  • If option 2 is chosen: a processor test asserts one RetryPart per retry attempt and no raw provider response data in it.
  • EVENTS.md and SDK docs describe the chosen model.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions