🤖 fix: align task lifecycle tool contracts - #3859
Conversation
Align task ID prompting with follow-up tool schemas, preserve precise await statuses, and enforce workflow-owned task isolation across lifecycle operations. Serialize workflow starts, resumes, retries, and interrupts with task-tree lifecycle locks while keeping cleanup retryable and deadlock-safe. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$87.15`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=87.15 -->
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
@codex review Please review the task ID prompting, lifecycle scope, workflow locking, cleanup retry, and deadlock handling changes. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 157ac63607
ℹ️ 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".
Provide the lifecycle and cleanup methods required by the hardened WorkflowService in router unit-test contexts. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$147.89`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=147.89 -->
|
@codex review Updated the router workflow test mocks to cover the new lifecycle lock and cleanup dependencies. Local static checks and all previously failing router tests pass. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b89611165
ℹ️ 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".
Resolve workflow lifecycle services from each descendant owner's session before listing or interrupting child-owned runs. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$147.89`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=147.89 -->
|
Addressed Codex finding
Local |
|
@codex review The child-owned workflow session finding has been addressed and its thread resolved. Please re-review the updated branch. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6cd78039e1
ℹ️ 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".
Stop workflow worker streams before taking the final background-process snapshot so concurrently registering bash tasks are included in cleanup. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$147.89`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=147.89 -->
|
Addressed Codex finding
Local |
|
@codex review The process cleanup ordering finding has been addressed and its thread resolved. Please re-review the updated branch. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Interrupt workflows owned by every descendant session and remove archived workflow-owned workers when deleting their user-owned parent subtree. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$147.89`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=147.89 -->
|
Addressed both Codex findings from the latest review:
Local |
|
@codex review Both latest workflow-tree cleanup findings have been addressed and their threads resolved. Please re-review the updated branch. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f423a54425
ℹ️ 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".
Wrap task invocation examples as inline code so generated hook documentation parses correctly in Mintlify. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$147.89`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=147.89 -->
|
@codex review Pushed the final generated-doc formatting fix; |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1cab3a3b38
ℹ️ 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".
Keep ordinary task stops working without workflow services, validate every active workflow worker against its exact owner run, and retain lifecycle resolvers for cleanup even when workflow tools are disabled. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$147.89`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=147.89 -->
|
Addressed both latest Codex findings:
Local |
|
@codex review Both latest workflow service/correlation findings have been addressed and their threads resolved. Please re-review the updated branch. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c3c2c70b9
ℹ️ 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".
Prevent stale or removal-racing workflow requests from recreating session state after their workspace has been deleted. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$147.89`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=147.89 -->
|
Addressed Codex finding
Local |
|
@codex review The missing-workspace workflow start finding has been addressed and its thread resolved. Please re-review the updated branch. |
|
Codex finding
const entry = findWorkspaceEntry(this.config.loadConfigOrDefault(), workspaceId);
if (entry == null) {
throw new Error("Cannot start workflow work from a missing workspace");
}The same commit adds |
|
@codex review The latest missing-workspace comment referenced the pre-fix code; the current head already has the explicit guard and regression test. The thread has been answered and resolved. Please review current head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6eaa8236db
ℹ️ 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".
Validate parent and descendant eligibility before deleting archived workflow workers so rejected task_remove calls have no destructive side effects. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$147.89`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=147.89 -->
|
Addressed Codex finding
Local |
|
@codex review The rejected-removal side-effect finding has been addressed and its thread resolved. Please re-review the updated branch. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 884c46ab6d
ℹ️ 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".
Keep background workflow creation serialized until the run is durably running and the background runner has been scheduled. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$147.89`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=147.89 -->
|
Addressed Codex finding
Local |
|
@codex review The background workflow start-lock finding has been addressed and its thread resolved. Please re-review the updated branch. |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Align task ID prompting and follow-up tool schemas with the runtime lifecycle contract, while hardening task/workflow stop behavior against scope bypasses, stale statuses, cleanup failures, and concurrency races.
Background
The task tools mixed camelCase result handles with snake_case follow-up inputs, contained contradictory guidance for inactive children and workflow rediscovery, and could mask
not_found/invalid_scoperesults. Workflow-owned workers were also inconsistently isolated across direct lifecycle operations, and stopping workflows exposed races between task creation, resume/retry, interruption, and cleanup.Implementation
taskId/taskIdstotask_id/task_idsmappings and corrects task rediscovery and inactive-child guidance.task_awaitstatuses with active-handle suggestions instead of replacing them with speculative sequencing errors.task_stopbehavior idempotent across agent tasks, workspace turns, and workflow runs.task_terminateschemas solely for rendering historical transcripts and updates generated docs/skills.Validation
make static-checktoolDefinitions,task_await,task_stop,task_remove,task_send_message, background bash integrationWorkflowRunner,WorkflowService,WorkflowTaskServiceAdapterTaskServiceunit suiteRisks
The main risk is in workflow/task lifecycle coordination. Coverage now exercises lock ordering, early and already-aborted signals, workflow cleanup retries, nested deferred sweeps, workflow-owned background processes, and stop-versus-start/resume races.
Generated with
mux• Model:openai:gpt-5.6-sol• Thinking:xhigh• Cost:$147.89