Skip to content

fix(streams): durable producer settles two inaccurate rejection reasons — close-drain reports producer-failed, single-attempt refusal reports retry-exhausted #1405

Description

@rickylabs

Summary

DurableStreamProducer's reconnect supervisor (#1326) settles every write explicitly and meters
every drop path — there is no silent loss. But two settled reason strings misdescribe the state
that produced them.

  1. Close-drain window. close() flips #accepted = false before the stopping transition
    (packages/plugin-streams-core/src/application/durable-stream-producer-supervisor.ts:205-226), so
    a write arriving during the drain is rejected as producer-failed while the producer is in
    fact healthy and closing (create-durable-stream.ts:131,251-261).
  2. Single-attempt refusal. A non-retryable append failure settles
    delivery-unknown: retry-exhausted even on attempt 1 (supervisor.ts:412-423). No retries
    were exhausted; the server positively refused.

Why it matters

Neither is a correctness defect and neither can produce a false delivered — both were verified safe
by the separate-session IMPL-EVAL of PR #1402. The cost is diagnostic: a caller or operator reading
producer-failed during an orderly shutdown will look for a failure that did not happen, and
retry-exhausted on a first-attempt refusal hides that the server rejected the write outright.

Accurate reasons are most of the value of settling writes explicitly rather than dropping them.

Acceptance criteria

  • A write rejected during the close-drain window settles with a reason naming the closing state,
    distinct from producer-failed
  • A non-retryable append failure on attempt 1 settles with a reason naming the refusal, distinct
    from retry-exhausted
  • Retry-exhaustion keeps its own reason for the case where retries genuinely were exhausted
  • Tests assert each reason for its own state, so a future refactor that collapses them fails
  • No change to which writes are accepted, rejected or delivered — reasons only

Provenance

IMPL-EVAL of PR #1402 (#1326), 2026-08-09, findings MINOR-1 and MINOR-2, both explicitly
non-blocking. Verdict record:
.llm/runs/release-0.0.5--orchestration/slices/w3-a-1326/evaluate.md.

Refs #1326.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions