Skip to content

fix(pi): move delivery flushing into the daemon - #80

Merged
Abhijeet Prasad (AbhiPrasad) merged 2 commits into
mainfrom
reproduce-idle-timeout
Sep 14, 2026
Merged

Abhijeet Prasad (AbhiPrasad) merged 2 commits into
mainfrom
reproduce-idle-timeout

Conversation

@AbhiPrasad

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) commented Sep 14, 2026

Copy link
Copy Markdown
Member

resolves https://linear.app/braintrustdata/issue/SDK-376

Pi waited for backend delivery at lifecycle boundaries. A slow flush blocked the next input for 10+ seconds and could time out.

Before:

  Pi -> journal ack -> wait for backend flush -> next input

After:

  Pi -> journal ack -> next input
          |
          +-> daemon flushes to Braintrust in the background

Keep ordered capture acknowledgement, but let the daemon flush turns, compaction, tree changes, and shutdown, as it does for Codex/Claude. Retry attempts keep the turn open. Delivery continues after Pi disconnects.

Pi waited for backend delivery at lifecycle boundaries. A slow flush
blocked the next input for 10+ seconds and could time out.

Before:
  Pi -> journal ack -> wait for backend flush -> next input

After:
  Pi -> journal ack -> next input
          |
          +-> daemon flushes to Braintrust in the background

Keep ordered capture acknowledgement, but let the daemon flush turns,
compaction, tree changes, and shutdown, as it does for Codex/Claude.
Retry attempts keep the turn open. Delivery continues after Pi disconnects.

Requires both the updated Pi extension and bt daemon.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 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-14T22:28:36.327170Z e5aeb16 New commits
ℹ️ About Codex in GitHub

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

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

@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


P2 Badge Enqueue each flush before continuing ingress dispatch

When Pi submits the next turn immediately after agent_end, that event may already be waiting in the ingress queue. Because the flush is started in an independently scheduled task, the ingress worker can enqueue before_agent_start and subsequent events into the session actor before flush_source_session enqueues its SessionMsg::Flush. The supposed turn-boundary flush can therefore checkpoint part of the next turn and be delayed behind arbitrary later traffic. Queue the flush message in actor order before processing the next ingress event, while leaving delivery itself asynchronous.

ℹ️ 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 (@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 (@codex) address that feedback".

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

ℹ️ 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 (@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 (@codex) address that feedback".

Comment thread src/plugins/pi/content/src/index.ts
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) merged commit a88118b into main Sep 14, 2026
20 checks passed
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) deleted the reproduce-idle-timeout branch September 14, 2026 22:38
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.

2 participants