Skip to content

fix(codex): bridge app-server tool-progress to the gateway (#38835) - #50226

Merged
teknium1 merged 1 commit into
mainfrom
fix/codex-telegram-tool-progress
Jun 21, 2026
Merged

teknium1 merged 1 commit into
mainfrom
fix/codex-telegram-tool-progress

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Summary

On the Codex app-server runtime (api_mode codex_app_server), the gateway now shows verbose "running X" tool-progress breadcrumbs on Telegram (and other platforms), matching every other provider. Previously this route was silent until the final answer (#38835).

Root cause: the Codex app-server session processes item/started notifications (command execution, file changes, MCP/dynamic tool calls), but the session was constructed without an on_event hook — so the agent's tool_progress_callback was never invoked on this route. Other providers fire it from tool_executor.py.

Changes

  • agent/codex_runtime.py: add _codex_note_to_tool_progress() mapping an item/started notification → (tool_name, preview, args) for commandExecution / fileChange / mcpToolCall / dynamicToolCall (returns None for non-tool items like agentMessage/reasoning). Wire an on_event hook into CodexAppServerSession that forwards mapped events to agent.tool_progress_callback("tool.started", name, preview, args) — the exact signature the chat_completions path uses.
  • tests/run_agent/test_codex_app_server_integration.py: TestCodexToolProgressBridge — mapper coverage for all 4 item types + non-tool/other-method rejection, plus an integration test that the session is wired with an on_event hook that fires tool_progress_callback on a real item/started note.

Validation

The session's notification loop already invokes on_event(note) for every notification (codex_app_server_session.py:537); the construction site just never passed one. Verified the integration test fails without the on_event wiring and passes with it. 22 passing in the codex integration suite.

Scope note

Salvaged the tool-progress bridge from @jplew's PR #38836. That PR also bundled an unrelated last_reasoning gateway-display addition — dropped here to keep this focused on #38835; it can land separately if wanted.

Credit

Authorship preserved via co-author trailer; #38836 closes pointing here.

Infographic

telegram-sees-codex-working

…ogress (#38835)

When the main provider is the Codex app-server runtime (api_mode
codex_app_server), the gateway showed no verbose 'running X' tool-progress
breadcrumbs on Telegram while every other provider did. The app-server
session processes item/started notifications (command execution, file
changes, MCP/dynamic tool calls) but never surfaced them as Hermes
tool-progress events — the session was constructed without an on_event
hook, so the agent's tool_progress_callback was never invoked on this
route.

Add _codex_note_to_tool_progress() mapping item/started → (tool_name,
preview, args) for commandExecution / fileChange / mcpToolCall /
dynamicToolCall, and wire an on_event hook into CodexAppServerSession that
forwards mapped events to agent.tool_progress_callback('tool.started',
...) — the same signature the chat_completions path uses (tool_executor.py).
Non-tool items (agentMessage/reasoning) and non-item/started methods map
to None and are ignored.

Co-authored-by: jplew <462836+jplew@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: fix/codex-telegram-tool-progress vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 11308 on HEAD, 11304 on base (🆕 +4)

🆕 New issues (2):

Rule Count
not-subscriptable 1
not-iterable 1
First entries
tests/run_agent/test_codex_app_server_integration.py:515: [not-subscriptable] not-subscriptable: Cannot subscript object of type `None` with no `__getitem__` method
tests/run_agent/test_codex_app_server_integration.py:508: [not-iterable] not-iterable: Object of type `None` is not iterable

✅ Fixed issues: none

Unchanged: 5925 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/openai OpenAI / Codex Responses API labels Jun 21, 2026
@teknium1
teknium1 merged commit 2f4f23f into main Jun 21, 2026
35 checks passed
@teknium1
teknium1 deleted the fix/codex-telegram-tool-progress branch June 21, 2026 15:46
@alt-glitch

Copy link
Copy Markdown
Contributor

Related: #38835 (the issue this fixes), #38836 (@jplew's PR this salvages the tool-progress bridge from), #26541 (earlier competing attempt to surface codex app-server tool calls), #33200 (Discord variant of the same silent-progress gap).

This core-team salvage provides the focused on_event wiring for the Codex app-server route; it can serve as the canonical fix for the cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists provider/openai OpenAI / Codex Responses API type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants