Skip to content

fix(session): commit manual charges before work - #995

Open
brendanjryan wants to merge 1 commit into
mainfrom
brendanjryan/commit-manual-stream-charges
Open

brendanjryan wants to merge 1 commit into
mainfrom
brendanjryan/commit-manual-stream-charges

Conversation

@brendanjryan

Copy link
Copy Markdown
Collaborator

Motivation

A manual stream charge must survive cancellation after billable work begins. Previously, disconnecting before emission released the pending charge.

Summary

  • Commit manual charges before stream.charge() resolves, retaining them on cancellation and generator failure.
  • Run the post-commit hook before allowing the generator to continue.
  • Remove reservation renewal during generator work, since manual charges are already committed.
async function* generate(stream) {
  await stream.charge()
  yield await performBillableWork()
}

Key design considerations

  • An awaited manual charge is durable even if subsequent work fails; callers should charge only for work they intend to bill.
  • Automatic iterables retain per-emission billing. Use manual charging to account for work before delivery.
  • Uncommitted reservations still expire and are released on cancellation.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 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-10-03T00:01:21.863688Z 8b0473b 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.

@pkg-pr-new

pkg-pr-new Bot commented Oct 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/mppx@995

commit: 8b0473b

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