Skip to content

🤖 fix: defer bash monitor wakes during task_await#3732

Merged
ethanndickson merged 2 commits into
mainfrom
fix-monitor-wake-task-await
Jul 16, 2026
Merged

🤖 fix: defer bash monitor wakes during task_await#3732
ethanndickson merged 2 commits into
mainfrom
fix-monitor-wake-task-await

Conversation

@ethanndickson

@ethanndickson ethanndickson commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

Defers a bash monitor wake while task_await is already waiting on the same process, preventing the wake from interrupting the wait it is meant to supplement without delaying monitor wakes from unrelated processes.

Background

The settled shown-frontier gate only synchronized with unfiltered output reads. A filtered task_await was invisible to that gate, so a monitor match could enqueue a synthetic wake during the active wait. The queued wake interrupted task_await, and agents could repeatedly restart the wait and be interrupted by the next monitor match.

Implementation

  • Track unfiltered reads and filtered task_await reads as blockers for same-process monitor wake delivery.
  • Expose a non-blocking delivery-state snapshot from BackgroundProcessManager so the workspace can defer only records for processes with active blocking reads.
  • Schedule a fresh drain when that process's read settles while continuing to deliver unrelated monitor matches from the current batch.
  • Reuse the shown-frontier gate after settlement: output displayed by an unfiltered await suppresses the redundant wake, while matched output hidden by a filter remains eligible for delivery.
  • Add regression coverage for both the filtered-await synchronization and the unrelated-process delivery invariant.

Risks

A monitor wake for a process can now be delayed for the duration of an active filtered task_await on that same process. This is intentional and bounded by the await. Wakes for other processes and filtered reads from other callers are unaffected.


Generated with mux • Model: openai:gpt-5.6-sol • Thinking: xhigh • Cost: $22.23

Hold same-process monitor wake delivery until an active task_await read settles. This lets the existing shown-frontier gate suppress output the await displayed while preserving wakes for matched output hidden by filters.

---

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

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

Copy link
Copy Markdown
Member Author

@codex review

@ethanndickson
ethanndickson enabled auto-merge July 16, 2026 04:36
@ethanndickson
ethanndickson disabled auto-merge July 16, 2026 04:36

@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: 69ed831f0d

ℹ️ 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/backgroundProcessManager.ts Outdated
Expose a non-blocking delivery state for each bash process so WorkspaceService can defer only the wake whose process is currently being awaited. Other monitor matches in the workspace continue to deliver immediately.

---

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

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

Copy link
Copy Markdown
Member Author

Addressed the Codex P2 finding about unrelated monitor wakes.

The drain now takes a non-blocking delivery-state snapshot per process. It leaves the blocked process's record pending, schedules a retry when that read settles, and continues delivering other processes' records from the same owner batch. Added a regression proving the unrelated wake is delivered before the blocked read resolves.

@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 717e16b410

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

@ethanndickson
ethanndickson added this pull request to the merge queue Jul 16, 2026
Merged via the queue into main with commit d25b50e Jul 16, 2026
23 of 24 checks passed
@ethanndickson
ethanndickson deleted the fix-monitor-wake-task-await branch July 16, 2026 05:20
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