Skip to content

[task-service] 🤖 fix: preserve turns across synthetic wake ends - #3949

Open
coadler wants to merge 4 commits into
mainfrom
fix/false-terminal-uncorrelated-wake-stream-end
Open

[task-service] 🤖 fix: preserve turns across synthetic wake ends#3949
coadler wants to merge 4 commits into
mainfrom
fix/false-terminal-uncorrelated-wake-stream-end

Conversation

@coadler

@coadler coadler commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Prevent synthetic child wake stream-ends from falsely interrupting a newer active workspace turn.

Background

A child can receive a sub-agent report, monitor wake, or family message while its delegated turn continues. That synthetic stream-end does not carry workspace-turn correlation metadata.

The fallback previously settled the current active handle as interrupted. The parent saw a false terminal while the child continued working.

This branch was rebuilt from current main after the workspace-turn manager and monitor reconciler refactors.

Implementation

  • Read child history once when an uncorrelated stream-end arrives.
  • Match direct and compaction-preserved workspace-turn anchors.
  • Ignore stale stream-ends that occurred before the active turn anchor.
  • Preserve manual non-synthetic input as an intentional supersede.
  • Read compaction follow-up content through the defensive shared accessor.
  • Keep synthetic wake ends nonterminal so the later correlated stream-end settles the handle.
  • Preserve conservative interruption when the history or active anchor cannot prove the relationship.

Risks

Moderate. This changes fallback settlement during queue and stream handoffs. Focused tests cover synthetic wakes, manual input, stale events, malformed compaction metadata, compaction anchors, and conservative fallback behavior.


Generated with xum • Model: openai:gpt-5.6-sol • Thinking: xhigh • Cost: $0.06

@coadler

coadler commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@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: 65cec367c1

ℹ️ 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 Outdated
@coadler

coadler commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator 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: 65cec367c1

ℹ️ 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
@chatgpt-codex-connector

This comment has been minimized.

@coadler

coadler commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed both P1 threads (PRRT_kwDOPxxmWM6bz40N, PRRT_kwDOPxxmWM6bz40Q) in 2314bfe:

  • Compacted turns: history scan now anchors on compaction-summary.pendingFollowUp.workspaceTurnMetadata.
  • Idle wake ends: defer only with live continuation evidence; otherwise settle the handle from the wake event with allowTerminalResettle.

@chatgpt-codex-connector

This comment has been minimized.

@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: 2314bfedb6

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

coadler commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed PRRT_kwDOPxxmWM6bz84z in 06a524b: a failed getHistoryFromLatestBoundary now falls back to the supersede settlement instead of returning unsettled, since that stream-end may be the only settlement signal for the waiter. Test injects the failure across all history reads.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 06a524b266

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

@chatgpt-codex-connector

This comment has been minimized.

@coadler

coadler commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed all three round-3 threads in 69541ae:

  • PRRT_kwDOPxxmWM6b0Mpp: hasLiveUncorrelatedWakeContinuationEvidence now includes hasActiveWorkspaceTurnDeferredBlockers (descendants, workflows, nested turns).
  • PRRT_kwDOPxxmWM6b0Mpv: wake settlements stamp provisionalOutcome; settleWorkspaceTurn permits a correlated end to replace them even from completed.
  • PRRT_kwDOPxxmWM6b0Mp0: deferral persists the end via persistDeferredUncorrelatedWakeEnd; stale recovery settles deferred uncorrelated ends once blockers clear; isLiveWorkspaceTurn counts auto-retry and monitor-wake continuations.

@chatgpt-codex-connector

This comment has been minimized.

@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: 69541ae996

ℹ️ 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/taskHandleStore.ts Outdated
Comment thread src/node/services/taskService.ts Outdated
Comment thread src/node/services/taskService.ts Outdated
Mux added 2 commits September 1, 2026 15:40
---

_Generated with `xum` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$0.00`_

<!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=0.00 -->
---

_Generated with `xum` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$0.00`_

<!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=0.00 -->
@coadler
coadler force-pushed the fix/false-terminal-uncorrelated-wake-stream-end branch from 69541ae to 71efd6c Compare September 1, 2026 20:41
@coadler coadler changed the title 🤖 fix: wake stream-ends no longer falsely settle active workspace turns [task-service] 🤖 fix: preserve turns across synthetic wake ends Sep 1, 2026
@coadler

coadler commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

The branch was rebuilt from current main. The previous broad settlement code is replaced by a focused nonterminal synthetic-wake guard.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T21:36:52.353314Z f9baa2f Manual request
🔒 Security Review Completed 2026-09-01T21:38:10.981601Z f9baa2f Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coadler

coadler commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

The branch was rebuilt from current main. Responses to the remaining threads:

  • PRRT_kwDOPxxmWM6b0hYD: provisional outcomes and deferred terminal recovery were removed. Synthetic wake ends remain nonterminal.
  • PRRT_kwDOPxxmWM6b0hYK: the provisionalOutcome persisted field was removed. Downgrades do not encounter a new strict-schema key.
  • PRRT_kwDOPxxmWM6b0hYN: deferred wake-event persistence was removed. The active handle waits for its correlated terminal event.
  • PRRT_kwDOPxxmWM6b0hYP: addressed in ae25266. User-triggered auto-compaction is manual supersession. Internal-resume compaction remains synthetic continuation.

@coadler

coadler commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

All prior threads are resolved. The latest commit adds the user-triggered auto-compaction regression and fix.

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

ℹ️ 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/workspaceTurnManager.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: ae252668a1

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Use the defensive compaction follow-up accessor when classifying manual child input.

This keeps malformed persisted compaction rows from leaving workspace turns live.

---

_Generated with `xum` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$0.06`_

<!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=0.06 -->
@coadler

coadler commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed PRRT_kwDOPxxmWM6eRcFD.

The manual-input classifier now uses getCompactionFollowUpContent(). Malformed persisted compaction metadata no longer throws. The regression test uses parsed: null and verifies that the active turn settles.

@coadler

coadler commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review commit f9baa2fc9.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: f9baa2fc94

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: f9baa2fc94

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

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