Skip to content

codex: preserve buffered subagent thread labels - #36

Closed
VOIDXAI wants to merge 2 commits into
openai:mainfrom
VOIDXAI:voidxai/issue-31-buffered-thread-labels
Closed

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

Conversation

@VOIDXAI

@VOIDXAI VOIDXAI commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

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

@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: 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".

Comment thread plugins/codex/scripts/lib/codex.mjs Outdated
}
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.

@dkundel-openai dkundel-openai added the duplicate This issue or pull request already exists label Aug 11, 2026 — with ChatGPT Codex Connector

Copy link
Copy Markdown
Collaborator

Duplicate of #581.

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

Labels

duplicate This issue or pull request already exists

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

2 participants