Skip to content

Conversation

@jif-oai
Copy link
Collaborator

@jif-oai jif-oai commented Jan 24, 2026

No description provided.

@jif-oai jif-oai changed the title feat: codex exec auto-subscribe to new threads [WIP] feat: codex exec auto-subscribe to new threads Jan 24, 2026
@jif-oai jif-oai changed the title [WIP] feat: codex exec auto-subscribe to new threads feat: codex exec auto-subscribe to new threads Jan 26, 2026
@jif-oai
Copy link
Collaborator Author

jif-oai commented Jan 27, 2026

@codex review

Copy link
Contributor

@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: 5164282cc6

ℹ️ 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 537 to 541
CodexStatus::Running => continue,
CodexStatus::InitiateShutdown => {
thread.submit(Op::Shutdown).await?;
}
CodexStatus::Shutdown => {
break;
}
CodexStatus::Shutdown => break,
Copy link
Contributor

Choose a reason for hiding this comment

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

P1 Badge Ignore ShutdownComplete from non-primary threads

With auto-subscribed threads, a background thread that finishes will emit ShutdownComplete (each session ends with this event), process_event maps it to CodexStatus::Shutdown, and this loop breaks unconditionally even if the primary thread is still running. That can terminate codex-exec early and drop the remaining output when a collaboration thread completes before the main session. Consider only breaking on Shutdown when thread_id == primary_thread_id (similar to the existing guard for InitiateShutdown).

Useful? React with 👍 / 👎.

@jif-oai
Copy link
Collaborator Author

jif-oai commented Jan 27, 2026

@codex review

Copy link
Contributor

@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: 639ce3d606

ℹ️ 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 +532 to +536
if thread_id != primary_thread_id && matches!(&event.msg, EventMsg::TurnComplete(_)) {
continue;
}
let shutdown = event_processor.process_event(event);
if thread_id != primary_thread_id && matches!(shutdown, CodexStatus::InitiateShutdown) {
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Badge Prevent cross-thread state mixing in event processor

With auto-subscribe, events from non-primary threads now flow through the single event_processor (process_event(event) here). The JSON/human processors maintain global per-turn state (e.g., running_commands, running_mcp_tool_calls, running_todo_list) and handle_task_complete() flushes all of it on any TurnComplete. If a secondary thread starts a command and the primary turn completes first, that command will be emitted as completed and removed; when its real ExecCommandEnd arrives it is dropped as “without matching begin”, losing output/exit code and corrupting logs. Consider a processor per thread or keying running_* state by thread_id and only flushing for the matching thread.

Useful? React with 👍 / 👎.

@jif-oai jif-oai merged commit dabafe2 into main Jan 28, 2026
32 checks passed
@jif-oai jif-oai deleted the jif/auto-sub branch January 28, 2026 13:03
@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants