🤖 feat: add bash monitor wake events#3268
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c8cd548974
ℹ️ 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 |
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ 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". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ab9f39bd6d
ℹ️ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f77ed9055e
ℹ️ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 564013ae0b
ℹ️ 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 |
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ 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". |
Add an optional bash monitor block for background processes that tails output with a regex, coalesces matching lines, and wakes the agent with a synthetic queued message. Surface monitor state in background process APIs/UI and keep task_await/task_list/task_terminate on the existing bash task IDs.
Validation:
- bun test src/node/services/backgroundProcessManager.test.ts src/node/services/tools/bash.test.ts
- make static-check
---
_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `2245854{MUX_COSTS_USD:-unknown}`_
<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=28.24 -->
Allow nullable omitted monitor options in the bash tool schema so strict-mode providers can pass null for optional values while the tool handler continues applying runtime defaults.
Validation:
- make fmt
- bun test src/node/services/backgroundProcessManager.test.ts src/node/services/tools/bash.test.ts
- make static-check
---
_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `2417461{MUX_COSTS_USD:-unknown}`_
<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=28.24 -->
Guard monitor-match subscription setup so AgentSession remains resilient when tests or startup-time doubles do not expose EventEmitter methods.
Validation:
- bun test src/node/services/agentSession.disposeRace.test.ts
- bun test src/node/services/agentSession*.test.ts
- bun test src/node/services/backgroundProcessManager.test.ts src/node/services/tools/bash.test.ts
- bun test src/browser/stores/GitStatusStore.test.ts
- make static-check
Note: a full local `make test` run reproduced the CI AgentSession failure fix, then exposed an unrelated local-only GitStatusStore window-listener issue; the GitStatusStore file passes in isolation.
---
_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `2739104{MUX_COSTS_USD:-unknown}`_
<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=28.24 -->
Reuse the latest normalized send options when queuing synthetic monitor wake turns so sendQueuedMessages can start the follow-up agent turn with a model and agent context.
Validation:
- bun test src/node/services/agentSession.disposeRace.test.ts
- bun test src/node/services/agentSession*.test.ts
- bun test src/node/services/backgroundProcessManager.test.ts src/node/services/tools/bash.test.ts
- make static-check
---
_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `2921293{MUX_COSTS_USD:-unknown}`_
<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=28.24 -->
Cap retained incomplete monitor lines to the bash line-byte limit so newline-free output from progress bars or long log records cannot grow memory unbounded while waiting for a line terminator.
Validation:
- bun test src/node/services/backgroundProcessManager.test.ts
- bun test src/node/services/agentSession.disposeRace.test.ts
- bun test src/node/services/backgroundProcessManager.test.ts src/node/services/tools/bash.test.ts
- make static-check
---
_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `3070966{MUX_COSTS_USD:-unknown}`_
<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=28.24 -->
Track monitor wake task IDs already queued for a busy session so repeated matches from the same background process do not append unbounded synthetic prompts before the agent can react.
Validation:
- bun test src/node/services/agentSession.disposeRace.test.ts
- bun test src/node/services/agentSession*.test.ts
- bun test src/node/services/backgroundProcessManager.test.ts src/node/services/tools/bash.test.ts
- make static-check
---
_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `3289765{MUX_COSTS_USD:-unknown}`_
<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=28.24 -->
Summary
Adds Claude-Code-style wake-on-match monitoring to background
bashcommands. A background bash can now include amonitorblock with a regex filter; matching output lines are coalesced and delivered to the agent as synthetic queued wake messages while the existingtask_awaitharvest path continues to work.Background
Long-running dev servers, watch tests, and log tails previously required polling with
task_awaitto notice important output. This change lets the process itself wake the agent when relevant output appears, without introducing a new tool family or task-ID namespace.Implementation
bashtool schema/result with an optional monitor block for background commands.BackgroundProcessManagerwith independent cursors, cooldown coalescing, match caps, dropped-line accounting, and cleanup on process termination.monitor-matchevents while waking the model throughAgentSession.queueMessage(..., { synthetic: true, agentInitiated: true }).Validation
bun test src/node/services/backgroundProcessManager.test.ts src/node/services/tools/bash.test.tsmake static-checkRisks
This touches background process lifecycle and queued-message wake plumbing. The implementation keeps monitors optional, preserves existing
bash:<id>task behavior, and stops only the monitor—not the process—whenmax_eventsis reached.Generated with
mux• Model:openai:gpt-5.5• Thinking:xhigh• Cost:2255777{MUX_COSTS_USD:-unknown}