Skip to content

codex: preserve buffered subagent thread labels#36

Open
VOIDXAI wants to merge 2 commits intoopenai:mainfrom
VOIDXAI:voidxai/issue-31-buffered-thread-labels
Open

codex: preserve buffered subagent thread labels#36
VOIDXAI wants to merge 2 commits intoopenai:mainfrom
VOIDXAI:voidxai/issue-31-buffered-thread-labels

Conversation

@VOIDXAI
Copy link
Copy Markdown
Contributor

@VOIDXAI VOIDXAI commented Mar 31, 2026

Summary

  • replay buffered thread lifecycle notifications before turn-scoped filtering
  • keep early thread/started / thread/name/updated events from being dropped
  • preserve subagent labels in logs and progress output

Why

Closes #31.

If a subagent thread is announced before the main turn ID is known, the buffered lifecycle event can be discarded during replay. That leaves the runtime without the label and logs fall back to raw thread IDs like thr_2.

Validation

  • manually reproduced the subagent flow with the fake Codex fixture
  • verified the job log now records design-challenger instead of falling back to thr_2

@VOIDXAI VOIDXAI requested a review from a team March 31, 2026 03:38
Copy link
Copy Markdown

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

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: c8ae0c4878

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

}
for (const message of state.bufferedNotifications) {
if (belongsToTurn(state, message)) {
if (isThreadLifecycleNotification(message) || belongsToTurn(state, message)) {
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 Scope buffered lifecycle replay to active turn threads

Replaying every buffered thread/started and thread/name/updated notification unconditionally can pull unrelated threads into this capture when delayed notifications from another turn are present in the buffer (for example, while review/start or turn/start is still awaiting its response). Once registerThread adds that thread, later buffered item/* notifications from it pass belongsToTurn because trackedTurnId is still null, so this turn can incorrectly absorb foreign file changes, command executions, or reasoning/log output.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 09b2105. Instead of replaying unknown lifecycle notifications immediately, the turn capture now defers thread/started / thread/name/updated until the current turn has explicitly registered that thread. That keeps the early subagent label available once the collaboration item arrives, but foreign buffered threads stay out of the capture. I also added tests/codex-buffered-subagent.test.mjs, which buffers both a real subagent lifecycle event and an unrelated off-turn thread message to lock down this edge case.

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.

Buffered thread/started notifications can drop subagent names and log raw thread IDs

1 participant