Skip to content

fix(reconciler): finalize progress on interrupt, classify interrupts distinctly, surface flight-cancel rejections - #204

Merged
ScriptedAlchemy merged 1 commit into
mainfrom
fix/pr172-reconciler
Sep 1, 2026
Merged

fix(reconciler): finalize progress on interrupt, classify interrupts distinctly, surface flight-cancel rejections#204
ScriptedAlchemy merged 1 commit into
mainfrom
fix/pr172-reconciler

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

Fixes the three interacting reconciler findings from #172/#177 review:

  • ~582 (P2): setup finalization now uses Effect.onExit, so interruption during Flight setup finalizes progress exactly like failure (previously Effect.catch never fired on interrupts and progress could stay pending forever).
  • ~575-579 (P2): stream finalization moved from tapError+ensuring to Stream.onExit — an interrupted stream finalizes with the abort outcome instead of falling through to handoff-required; post-complete teardown aborts still finalize as handoff per the existing contract.
  • ~422 (P2, chore: deslop pass over the wave 3.5 delta #177): the Flight reader release distinguishes cancel rejections: with a prior stream failure the rejection is still suppressed (masking protection preserved), but a standalone cancel rejection now propagates through a flightDone deferred that the completion path awaits, so it surfaces distinctly instead of being swallowed.

Test plan

  • New dispatcher tests: abort during setup finalizes progress with AbortError; mid-stream abort finalizes as abort (not handoff-required); standalone flight-cancel rejection surfaces (24/24 pass, rebased on the state-migration merge)
  • pnpm typecheck, pnpm lint clean after rebase

Classify setup and stream interruption as aborts while preserving handoff after normal completion, and propagate standalone Flight reader cancellation failures before complete.
@changeset-bot

changeset-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bdbee09

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@agent-bundle/runtime Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T21:01:56.806399Z bdbee09 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ScriptedAlchemy
ScriptedAlchemy merged commit 7abd6b5 into main Sep 1, 2026
2 of 9 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bdbee09f6e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

> => {
if (snapshot.pending.length === 0) {
return Queue.clear(progressInputs).pipe(
return Deferred.await(flightDone).pipe(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bound the wait for Flight EOF

When the decoded root has no pending boundaries but the Flight source remains open, this unconditional Deferred.await(flightDone) prevents both stream() and dispatch() from ever emitting complete. Unlike the pending-boundary path, it does not race against sequence.remainingMs, so even a configured maxElapsedMs cannot terminate a stuck or long-lived transport; race this wait with the render deadline and tear down the Flight source on timeout.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #214 (merged as 4daf388). The no-pending-boundaries EOF wait is now raced against the render deadline through the same waitOrDeadline helper the pending-boundary path uses, so a configured maxElapsedMs terminates a stalled Flight transport with elapsed-time-exceeded and the source reader is cancelled on teardown. Regression test drives both stream() and dispatch() against a never-closing Flight source with maxElapsedMs: 150 and asserts timely failure plus exactly one source cancel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant