Skip to content

0.5.0 — wait tool for codex push notifications#4

Merged
wenqingyu merged 8 commits into
mainfrom
feature/wait-tool
Apr 28, 2026
Merged

0.5.0 — wait tool for codex push notifications#4
wenqingyu merged 8 commits into
mainfrom
feature/wait-tool

Conversation

@wenqingyu
Copy link
Copy Markdown
Owner

Summary

Adds a single new MCP tool wait that replaces the dispatcher's poll-based ScheduleWakeup loop. The dispatcher calls wait once 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 → ScheduleWakeup every ~5 min → wake → call status → 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 wait once, 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

wait({
  timeout_seconds?: number,        // default 1500 (25 min)
  since?: string,                  // ISO; replay events with ended_at > since
  agent_ids?: string[],            // optional scope
  terminal_only?: boolean,         // default true
  batch_window_ms?: number,        // default 100; coalesces fan-out tails
}) → {
  events: AgentSummary[],
  observed_at: string,             // pass as `since` next call
  agents_still_running: number,
  agents_running_ids: string[],
  timed_out: boolean,
}

Design + plan docs

  • Design: docs/plans/2026-04-27-codex-worker-notifications-design.md
  • Plan: docs/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 — clean
  • npm test117 passing (was 108); 9 new tests
    • Registry: emits change on update; zombie sweep does NOT emit
    • wait replay: returns historical events without blocking
    • wait replay: filters by agent_ids and since
    • wait live: resolves when agent reaches terminal
    • wait live: coalesces multiple terminations within batch window
    • wait live: clean timeout with no listener leak
    • wait live: agents_still_running honors agent_ids scope
  • npm run build — version-drift guard validates all 5 literals match 0.5.0
  • Manual: dispatch a fan-out batch, call wait, confirm one wake delivers all completions

🤖 Generated with Claude Code

abu-ismail-01 and others added 8 commits April 28, 2026 22:08
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>
Bumps all five version literals to 0.5.0 and adds the CHANGELOG entry
for the wait tool. Implementation commits f622df6..67271c9 land the
behavior; this commit only flips the version.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wenqingyu wenqingyu merged commit 432ffc2 into main Apr 28, 2026
2 checks passed
@wenqingyu wenqingyu deleted the feature/wait-tool branch April 28, 2026 15:14
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.

2 participants