Skip to content

Close cutover iterators before setter delivery - #56

Merged
jefflinse merged 2 commits into
mainfrom
compare/opencode-worker
Sep 21, 2026
Merged

jefflinse merged 2 commits into
mainfrom
compare/opencode-worker

Conversation

@jefflinse

Copy link
Copy Markdown
Contributor

The lifecycle worker currently invokes cutover setters while its global read iterator remains open. A setter sharing a bounded connection pool with the reader can therefore wait forever for a resource held by that iterator.

This change folds and buffers accepted cutovers during the read, closes the iterator, and only then delivers them in order. A close failure suppresses all buffered delivery and is joined with any read or validation failure. An accepted prefix is still delivered before a later non-cancellation failure, while a delivery failure keeps precedence over failures observed later in logical stream order.

Cancellation before post-close delivery suppresses the buffered cutovers without discarding an independent read or validation failure. The public worker contract now states that setters may share a bounded resource with the reader. Regression coverage includes multiple cutovers from one read, validation plus close failures, cancellation/error composition, and an end-to-end one-slot shared-resource test.

Verification:

  • go test -count=1 -race ./...
  • go vet ./...
  • go build ./...
  • golangci-lint run

Closes #55

@jefflinse
jefflinse merged commit 1154aa8 into main Sep 21, 2026
6 checks passed
@jefflinse
jefflinse deleted the compare/opencode-worker branch September 21, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cutover worker delivers to setters while its read iterator is open

1 participant