[task-service] 🤖 fix: correlate workspace-turn liveness - #3915
Conversation
|
@codex review Please review the workspace-turn lifecycle changes. |
This comment has been minimized.
This comment has been minimized.
|
@codex review Please review the implementation. The prior response only contained the completed security review. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8fbe142a01
ℹ️ 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".
|
Addressed both Codex findings in
Added regression tests for waiter preservation, handoff order, enqueue failure, and explicit cancellation. |
|
@codex review Both P1 findings are addressed in |
This comment has been minimized.
This comment has been minimized.
|
@codex review The security review completed, but no code-review approval appeared. Please run the code review for |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5674e42de
ℹ️ 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".
|
@codex review The CI unit test now matches the queued terminal continuation behavior in |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07eba9212c
ℹ️ 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".
This comment has been minimized.
This comment has been minimized.
|
Addressed The terminal attention record is now persisted before the background continuation starts. The Added a regression test that invokes |
|
@codex review The final attention-ordering finding is addressed in |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3da714e8cf
ℹ️ 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".
|
Addressed the current Codex findings in
The fix also preserves delivery callbacks after correlation removal. Stable child generations now use generation-specific terminal queue keys. Local validation passed:
|
|
@codex review Please review commit |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5f36592d3
ℹ️ 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".
|
Addressed
Added a regression for a workspace-turn entry with no callbacks. Local validation passed:
|
|
@codex review Please review commit |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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". |
This comment has been minimized.
This comment has been minimized.
|
@codex review All findings are resolved and local validation passes. Please run the code review for |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0e8fde0fff
ℹ️ 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".
|
@codex review The latest commits address all reported continuation and restart-recovery races. |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4616ece24
ℹ️ 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".
f4616ec to
10023aa
Compare
|
@codex review The branch was rebuilt from current main. The previous broad diff is replaced by a focused liveness and capacity fix. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
The branch was rebuilt from current main. These three findings refer to removed taskService code and are no longer present in the diff:
The replacement diff only changes correlation-aware liveness and stale-handle capacity accounting. |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10023aa1ac
ℹ️ 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".
Use exact stream and queued-turn correlation before slot accounting.
Keep busy-workspace admission tests aligned with exact handle liveness.
10023aa to
3c1d37b
Compare
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c1d37bb14
ℹ️ 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".
|
Addressed all four findings in 3f22e12:
|
|
@codex review All current findings are addressed. The full workspace-turn manager suite and make static-check pass. |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f22e1209f
ℹ️ 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".
Correlate compaction, retry, wake, queue, and send-preflight activity. Carry workspace ownership evidence through stale settlement. --- _Generated with `xum` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$0.19`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=0.19 -->
|
Addressed all four findings in
|
|
@codex review Please review commit |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f190cc897
ℹ️ 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".
| const hasUncorrelatedCreationReservation = | ||
| creationReservations != null && | ||
| creationReservations.size > 0 && | ||
| !hasCorrelatedCreationReservation; |
There was a problem hiding this comment.
Keep reservations from superseding prior turns
When handle A is live only through its active registration—for example, after a deferred stream-end while descendant work remains—and follow-up B enters send preflight, B's reservation makes hasUncorrelatedCreationReservation true for A. A concurrent task-list or capacity scan therefore terminally interrupts A before B reaches queue admission; if B's send subsequently fails, no replacement turn ever existed and A's waiter/result has already been lost. Creation reservations should keep their own handle live without becoming supersession evidence for other handles until the new send is admitted.
AGENTS.md reference: AGENTS.md:L150-L150
Useful? React with 👍 / 👎.
| const hasUncorrelatedRetryOrWake = | ||
| !hasActiveRegistration && (hasPendingAutoRetry || hasPendingBashMonitorWake); |
There was a problem hiding this comment.
Keep restart retries live before registration
During startup recovery of a non-task workspace, WorkspaceService.initialize() can schedule the correlated auto-retry before any process-local active registration is restored. While that retry is pending, this condition classifies it as uncorrelated solely because hasActiveRegistration is false, so a task-list or capacity scan settles the durable handle as interrupted and rejects its waiter even though the same turn is about to resume. Pending restart retries need correlation from their preserved message metadata, or an equivalent registration established before liveness checks.
AGENTS.md reference: AGENTS.md:L112-L112
Useful? React with 👍 / 👎.
Summary
Make workspace-turn liveness depend on exact turn correlation.
Background
A stale workspace-turn handle could remain running when unrelated work started in the same target workspace. The stale handle could then consume a
maxParallelAgentTasksslot.A second race could interrupt a newly persisted queued handle while
sendMessagecompleted its preflight work.This branch previously contained a broad pre-refactor handoff patch. The new branch starts from current main and contains only the liveness and capacity fix.
Implementation
sendMessageexposes queue or stream correlation.Risks
Moderate. This changes workspace-turn recovery and task admission. The tests cover streams, compaction, queued continuations, preflight races, retry paths, monitor wakes, ownership transfer, and unrelated activity.
Generated with
xum• Model:openai:gpt-5.6-sol• Thinking:xhigh• Cost:$0.19