Skip to content

Register scratch coroutine threads from coroutine units#320

Merged
oco777 merged 1 commit intomainfrom
codex/integrate-thread-registration-into-coroutine-base
Nov 16, 2025
Merged

Register scratch coroutine threads from coroutine units#320
oco777 merged 1 commit intomainfrom
codex/integrate-thread-registration-into-coroutine-base

Conversation

@oco777
Copy link
Copy Markdown
Owner

@oco777 oco777 commented Nov 16, 2025

Summary

  • add a shared Scratch coroutine base that registers running coroutines with the Scratch thread manager
  • route Forever/Wait/Say/Think timed units through the shared starter so Scratch thread IDs are captured
  • document the linkage so stop blocks and thread registration remain discoverable

Testing

  • not run (not requested)

Codex Task

@oco777 oco777 merged commit dac89cb into main Nov 16, 2025
3 checks passed
@oco777 oco777 deleted the codex/integrate-thread-registration-into-coroutine-base branch November 16, 2025 06:51
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

if (TryGetThreadContext(flow, out string existingActorId, out string existingThreadId) &&
!string.IsNullOrEmpty(existingThreadId))
{
return existingThreadId;

P1 Badge Update scratch thread when starting new coroutine

The new EnsureScratchThreadRegistered returns immediately when a thread ID is already present in flow.variables, so any later coroutine in the same script keeps using the first coroutine handle registered. In graphs that run multiple coroutine-based units sequentially (e.g., WaitSeconds then another WaitSeconds or a timed speech unit), StartScratchCoroutine will skip re-registration, leaving the thread manager pointing at an old coroutine. Stop blocks such as StopThisScript or StopOtherScratchThreadsOfActor will then stop the stale coroutine and leave the currently running one alive, so scripts cannot be reliably halted after the first coroutine unit executes. Consider updating the registered coroutine even when a thread ID already exists.

ℹ️ 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".

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant