Skip to content

Add a host-managed wait tool for Codex sessions#4262

Draft
Jules-Astier wants to merge 2 commits into
pingdotgg:mainfrom
Jules-Astier:agent/deferred-thread-resume
Draft

Add a host-managed wait tool for Codex sessions#4262
Jules-Astier wants to merge 2 commits into
pingdotgg:mainfrom
Jules-Astier:agent/deferred-thread-resume

Conversation

@Jules-Astier

@Jules-Astier Jules-Astier commented Jul 22, 2026

Copy link
Copy Markdown

What Changed

  • Register a namespaced t3.wait dynamic tool on new Codex threads.
  • Run waits in the T3 server for 1 second through 1 hour, without periodic model inference.
  • Cancel outstanding waits before turn interruption and when the provider session closes, including calls that race with cancellation.
  • Decode the experimental raw thread/start response at the same boundary used by typed requests.
  • Document the live-session contract and a separate follow-up architecture for durable timer/webhook resumes in docs/project/deferred-thread-resume.md.

The existing Codex adapter and web timeline already normalize and render dynamic-tool lifecycle items, so this does not add a parallel UI state.

Why

Agents currently monitor long-running commands, CI, deployments, and review work by repeatedly polling. Most checks contain no new information but still wake the model and consume inference. This gives T3 a focused host-owned primitive that keeps the current tool call open until a bounded timer expires.

This PR intentionally does not claim durable wake-up semantics. Restart-safe timers, external triggers, and PR webhooks need persisted waitpoints, idempotent delivery, and an explicit waiting lifecycle; those are designed in the included project doc as follow-up work.

Testing

  • vp test run apps/server/src/provider/Layers/CodexDynamicTools.test.ts apps/server/src/provider/Layers/CodexSessionRuntime.test.ts — 28 passed
  • vp run --filter t3 typecheck — passed (three existing Effect suggestions in orchestration/decider.ts)
  • Targeted vp lint, vp fmt --check, and git diff --check — passed
  • Live ephemeral smoke turn with codex-cli 0.144.6 — one t3.wait call, 1,006 ms elapsed, completed turn, expected assistant sentinel
  • Macroscope correctness and Effect service convention checks — passed after addressing the cancellation-registration race

Checklist

  • This PR is small and focused
  • I explained what changed and why

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3a84ea43-e5bf-4263-9727-3fe0cdd5f85a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jul 22, 2026
Comment thread apps/server/src/provider/Layers/CodexDynamicTools.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant