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:
- Remove
RetryPart from the Part union and regenerate the SDK types. The live retry signal remains SessionStatus plus the NDJSON retry event.
- 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.
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"withattempt,error,time) is defined inpackages/cli/src/session/message-v2.tsand included in thePartunion. 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 NDJSONretryevent. 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 namedretry, which makes it easy for SDK consumers to implement against the wrong one.Proposal
Pick one of these:
RetryPartfrom thePartunion and regenerate the SDK types. The live retry signal remainsSessionStatusplus the NDJSONretryevent.RetryPartper retry attempt in the processor's retry branch, so retries are replayable in stored history. Keep the status event as the live signal. The storederrormust be sanitized the same way the exhausted-retry terminal error is: no provider response headers, body or URL.Acceptance criteria
message-v2.tsand the generated SDK types, orRetryPartis actually emitted with sanitized error data.rg RetryPart packages/returns no source hits after regeneration, and typecheck passes.RetryPartper retry attempt and no raw provider response data in it.EVENTS.mdand SDK docs describe the chosen model.