0.5.0 — wait tool for codex push notifications#4
Merged
Conversation
Replaces the dispatcher's poll-based ScheduleWakeup loop with a single blocking wait tool that returns the moment an agent terminates. Includes batch coalescing for fan-out tails and replay safety via a since cursor. Approved design; implementation follows in 0.5.0. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a single new MCP tool
waitthat replaces the dispatcher's poll-based ScheduleWakeup loop. The dispatcher callswaitonce after spawning a batch of codex agents; the call hangs until any agent terminates, then returns a batched list of all agents that transitioned within a short coalescing window. No more 5-min polls, no more prompt-cache misses on every wake.Why
The old pattern: dispatcher spawns N agents →
ScheduleWakeupevery ~5 min → wake → callstatus→ most still running → sleep again. Each wake re-reads the full conversation context (cache TTL is 5 min) and waiting agents are reacted to ~5 min after they actually finish.With this PR: dispatcher calls
waitonce, the connection stays open, Claude wakes exactly when an event happens. For a 5-agent fan-out where all complete near-simultaneously, that's 1 wake instead of 5-10 polls.Tool surface
Design + plan docs
docs/plans/2026-04-27-codex-worker-notifications-design.mddocs/plans/2026-04-27-wait-tool-implementation.md(executed by a magic-codex implementer agent in this same release cycle — meta)Test plan
npm run typecheck— cleannpm test— 117 passing (was 108); 9 new testschangeon update; zombie sweep does NOT emitagent_idsandsinceagents_still_runninghonorsagent_idsscopenpm run build— version-drift guard validates all 5 literals match 0.5.0wait, confirm one wake delivers all completions🤖 Generated with Claude Code