Fix Codex message-tool-only reply latency#95826
Closed
omarshahine wants to merge 3 commits into
Closed
Conversation
4 tasks
Contributor
Author
|
Closing this draft in favor of #95942. This draft was useful during investigation, but the branch also carried earlier iMessage debounce/read-receipt/docs changes from the performance stack. #95942 is the clean replacement scoped to the Codex Proof carried forward into #95942:
|
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.
What Problem This Solves
In
message_tool_onlysource-reply mode, Codex could successfully send the visible iMessage reply through themessagedynamic tool but still leave the turn waiting for assistant synthesis. That produced the slow post-send tail we saw in logs, ending in an incomplete-turn path even though the user-visible reply had already been delivered.Why This Change Was Made
The core embedded-agent path already knows when a message-tool-only source reply is delivered and should be treated as terminal. The Codex app-server dynamic tool bridge was not carrying that source-reply mode into its dynamic-tool termination decision, so delivered implicit source replies were not marked terminal for Codex runs.
This PR exports the existing delivery detector through the harness runtime barrel, passes
sourceReplyDeliveryModeinto the Codex dynamic tool hook context, and marks delivered implicit message-tool-only replies as terminal. Explicit cross-channel message sends are intentionally not treated as terminal source replies.User Impact
This benefits setups that use the Codex app-server harness with a channel configured for
sourceReplyDeliveryMode: message_tool_only, including iMessage-style flows where the model replies through themessagetool instead of an assistant final message.Expected benefit: removes the avoidable post-send wait/incomplete-turn tail after a successful visible message send. It does not address the separate cold plugin/provider discovery cost or the upstream model latency before the first tool call.
Evidence
node scripts/run-vitest.mjs extensions/codex/src/app-server/dynamic-tools.test.ts -- --reporter=verbose -t "message-tool-only source replies|explicit message-tool sends"node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/message-tool-terminal.test.ts -- --reporter=verbosenode scripts/run-vitest.mjs extensions/codex/src/app-server/dynamic-tools.test.ts -- --reporter=verbosenode scripts/run-vitest.mjs extensions/codex/src/app-server/run-attempt.turn-watches.test.ts -- --reporter=verbose -t "visible message call"git diff --check.agents/skills/autoreview/scripts/autoreview --mode local