Skip to content

🤖 fix: queue busy workspace turn follow-ups#3617

Open
ThomasK33 wants to merge 7 commits into
mainfrom
fix/workspace-turn-queue-followups
Open

🤖 fix: queue busy workspace turn follow-ups#3617
ThomasK33 wants to merge 7 commits into
mainfrom
fix/workspace-turn-queue-followups

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Jun 23, 2026

Copy link
Copy Markdown
Member

Summary

Queue follow-up messages for busy existing workspace turns instead of failing when the target workspace is already running.

Background

Parent/orchestrator workspaces can target an already-created workspace with task(kind="workspace", workspace.mode="existing"). That previously failed with existing workspace is busy; wait until it is idle, even though the chat layer already supports queued follow-up messages.

Implementation

  • Adds workspace.queueDispatchMode for existing workspace turns so orchestrators can choose tool-end or turn-end queue dispatch.
  • Records busy existing workspace turns as queued task handles and transitions them to running once the queued message is accepted.
  • Uses WorkspaceService's message-busy predicate before deciding whether an existing workspace turn is queued vs immediately running, so COMPLETING-phase turns are not marked active early.
  • Reserves/counts queued workspace-turn handles as active unless they are simply queued behind an already-counted workspace turn for the same target workspace.
  • Ignores stale uncorrelated stream-end events that occurred before the queued workspace-turn prompt in history, avoiding activation races during queue flush at prior turn completion.
  • Carries workspace-turn acceptance/failure/cancel callbacks through the message queue so pre-stream failures and queue clears settle the durable handle.
  • Rejects queued-turn acceptance if the handle is interrupted while the queued message is dispatching but before stream startup.
  • Keeps workspace-turn queued messages isolated from batching with other queued content, preserving one task handle per stream-end metadata marker.
  • Clears queued workspace-turn payloads when interrupted before dispatch, so a terminated queued handle cannot send later.
  • Updates synced tool docs/generated skill content for the new input parameter.

Validation

  • env MUX_ESLINT_CONCURRENCY=1 make static-check
  • bun test src/node/services/messageQueue.test.ts src/node/services/tools/task.test.ts src/common/utils/tools/toolDefinitions.test.ts src/node/services/taskService.test.ts --test-name-pattern 'MessageQueue|workspace turn queue dispatch mode|accepts workspace turn queue dispatch mode|createWorkspaceTurn (creates a normal workspace|reprompts only owner-created|queues busy owner-created|reserves a slot before queueing|counts active workspace turns)|uncorrelated stream-end before queued workspace turn prompt'
  • bun test tests/ui/chat/unreadIndicator.test.ts -t "hides Mark unread for already-unread rows" (local check for unrelated Integration CI flake)

Risks

Moderate risk in workspace-turn orchestration and queued-message handling. The queue now carries internal callbacks, so the implementation keeps workspace-turn messages single-entry to avoid orphaning task handles or applying metadata to the wrong turn.


Generated with mux • Model: openai:gpt-5.5 • Thinking: xhigh • Cost: $24.67

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

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

ℹ️ 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 thread src/node/services/taskService.ts Outdated
Comment thread src/node/services/taskService.ts
@mintlify

mintlify Bot commented Jun 23, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
Mux 🟢 Ready View Preview Jun 23, 2026, 4:41 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please take another look.

@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: 88454baa34

ℹ️ 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 thread src/node/services/messageQueue.ts
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please take another look.

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

ℹ️ 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 thread src/node/services/taskService.ts
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please take another look.

@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: 16df052fae

ℹ️ 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 thread src/node/services/taskService.ts Outdated
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please take another look.

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

ℹ️ 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 thread src/node/services/taskService.ts Outdated
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please take another look.

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

ℹ️ 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 thread src/node/services/taskService.ts
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Please take another look.

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.

1 participant