Skip to content

fix(runtime): review follow-ups — traversal bounds, demand-bounded progress, failure conversion - #172

Merged
ScriptedAlchemy merged 1 commit into
mainfrom
fix/review-runtime-pipeline
Sep 1, 2026
Merged

fix(runtime): review follow-ups — traversal bounds, demand-bounded progress, failure conversion#172
ScriptedAlchemy merged 1 commit into
mainfrom
fix/review-runtime-pipeline

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

Test plan

  • @agent-bundle/runtime suite (153 passed / 1 skipped)
  • examples/rsc-agent-runtime suite (168 passed / 6 skipped)
  • pnpm eval:spot
  • pnpm typecheck
  • pnpm lint (boundary-lint green)

…ogress, failure conversion

Enforce document limits during JSON and Flight decode walks, bound live
progress by consumer demand, close the progress queue on setup failure,
and convert synchronous host throws into stream failures.
@changeset-bot

changeset-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ae563d4

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

@ScriptedAlchemy
ScriptedAlchemy merged commit 99eb375 into main Sep 1, 2026
4 of 9 checks passed
@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-01T18:59:12.372547Z ae563d4 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 deleted the fix/review-runtime-pipeline branch September 1, 2026 18:53

@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: ae563d4a57

ℹ️ 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".

Comment on lines +580 to +581
return yield* setup.pipe(
Effect.catch((error) => finalizeProgress(error).pipe(Effect.andThen(Effect.fail(error)))),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Finalize progress when setup is interrupted

When the request aborts before createAgentRenderEventSession has prepared the Flight root and shell, toPublicEventStream interrupts this setup effect rather than failing it. Effect.catch does not handle interruption, and the inner Stream.ensuring has not yet been installed, so the progress queue is never shut down and progressFailure remains unset; a host retaining the reporter can continue buffering successful reports after cancellation. Finalize the setup with an interruption-aware ensuring/exit handler and preserve an AbortError for the reporter.

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 #204 (merged as 7abd6b5). Setup finalization moved from Effect.catch to Effect.onExit, which also fires on interruption — an abort during Flight setup now finalizes progress with the abort outcome instead of leaving it pending. Regression test: aborting while execute never resolves finalizes the progress reporter with AbortError.

progressFailure = error;
})),
Stream.takeUntil((event) => event.type === 'complete'),
Stream.ensuring(Effect.suspend(() => finalizeProgress(progressFailure ?? handoffRequired()))),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the abort failure for active progress reporters

When an active request is aborted after the shell, Stream.interruptWhen interrupts this stream, but Stream.tapError does not record interruption as progressFailure. This finalizer therefore defaults to handoff-required, causing blocked and subsequent progress.report() calls to claim that the render completed instead of rejecting with the request's AbortError. Derive the progress failure from the stream exit or at least check the abort signal before choosing the handoff error.

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 #204 (merged as 7abd6b5). Stream finalization moved from tapError+ensuring (which never observed interrupts) to Stream.onExit: a mid-stream interrupt finalizes with the abort failure, while handoff-required is reserved for normal completion and post-complete teardown. Regression test: aborting after the shell event finalizes progress with AbortError, not handoff-required.

ScriptedAlchemy added a commit that referenced this pull request Sep 1, 2026
Rebased survivors of the stranded deslop/wave-3.5 commit (5a8723423)
onto current main. Applied:

- finalizers: sqlite connection close and Flight reader cancel no longer
  mask the original failure when teardown itself throws
- state drivers: shared pending-open tracker replaces the verbatim
  trackPendingOpen/close-drain duplication; drop runPromise(Effect.fail)
  ceremony in favor of direct rejections
- boundaries: remove the unused runSyncExit export from both seams, the
  dead ScopedEffectRuntime E type parameter from the rsc-runtime copy
  (matching the dev-seam copy), and the redundant string ternary in
  toDevError/toRuntimeError
- delete dead epoch-lease-registry.ts (zero importers; #161 rewrote the
  same concept in epoch-store.ts); dedupe boundRenderEventStream through
  emitBoundRenderEvent; trim migration-narration comments

Dropped as superseded: the reconciler progress-queue rework (#172
rebuilt that path with a demand-bounded design), the dev-seam trim of
interruptWhenAborted/runPromiseExit (#164 fixed and kept them with
tests), the sqlite #commit self-rewrite (#171 rewrote #commit), and the
lint-plugin inlining (#164 expanded the plugin around those helpers).
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