Skip to content

MCP session logging, notification handling, and safer shutdown/stdio lifecycle#25

Draft
jaromil wants to merge 52 commits intomainfrom
feat/mcp-agent
Draft

MCP session logging, notification handling, and safer shutdown/stdio lifecycle#25
jaromil wants to merge 52 commits intomainfrom
feat/mcp-agent

Conversation

@jaromil
Copy link
Member

@jaromil jaromil commented Feb 3, 2026

This branch improves MCP session observability and shutdown safety, and tightens stdio MCP process handling.

  • Adds MCP event logging and config to enable/disable it; documents MCP output/notification behavior
  • Formats MCP notifications consistently and routes them through the read loop; adds coverage for interleaved notifications
  • Introduces shutdown coordination (ordering + timeouts), process registry, and session close on shutdown; adds tests and docs
  • Ensures PTY/MCP subprocesses are managed safely (process groups) and stdio MCP children can’t take down the server
  • Redirects stdio MCP stderr to stdout to prevent deadlock under noisy stderr

Set codex_mode to mcp-server in bundled Codex agents.
Decision-only step; no tracked changes.
Document stdio framing, tools schema, and event shapes from codex mcp-server.
Decision-only step; no tracked changes.
Decision-only step; no tracked changes.
Default codex_mode for codex agents and validate allowed values.
Introduce a stdio-backed PtyFactory with a round-trip test.
Translate line-buffered input into MCP tool calls with tests.
Select MCP vs PTY paths and adjust tests for default MCP mode.
Send codex-notify signals after MCP turns with workflow-aware handler.
Wait for MCP initialization before prompt injection and add coverage.
Add MCP-focused WebSocket and agent input coverage with a fake MCP server.
Document MCP transcript output and workflow notify handling.
Submit MCP turns on CR and allow LF inside prompts.\nNormalize REST MCP input to append CR and force blocking output.\nAdd tests for multiline prompts and MCP send-input.
Convert LF to CRLF in MCP transcript output so xterm starts lines at column zero.\nAdd test coverage for CRLF normalization.
Implement a lightweight text buffer with CR normalization and tests.
Render session output in a scrollable text component and wire output to a text store.
Ensure cached session history populates the terminal text buffer on connect.
Render session output as segmented prompt/output spans with tests for segment assembly.
Remove xterm-specific wiring from the terminal service and socket callbacks.
Drop xterm canvas/helpers and clean terminal history test.
Add scrollback/font settings to status and use them in the frontend.
Treat \r as line reset in terminal buffers and tests.
Cover at-bottom notifications for the lightweight terminal view.
Refresh terminal UI references after removing xterm.
Skip echoed command lines in terminal output.
Show Temporal and Bottom buttons in the session header.
Drop the input-area scroll button now that the header owns it.
Allow dragging the input top edge to adjust its height.
Hide the textarea scrollbar until content overflows.
Expose session input font settings in status and apply them in the UI.
Use dynamic viewport sizing and safe-area padding so session headers and input stay visible.
Handle notifications outside response waits and cover idle output.
Always render MCP notifications with codex/event parsing and truncation.
Note that meta fields are omitted from console output.
Verify notifications between request/response still yield output.
Document notification formatting in codex MCP notes.
Add a new L1 with L2 tasks for non-ID payload fields.
Add the session config key and tests for its default and overrides.
Stop rendering MCP notifications in terminal output and persist them to per-session event logs when enabled.
Log a warning when codex event logging is enabled without a session log directory.
Mark the plan items complete after implementing event logging changes.
Centralize shutdown phase order and add coverage for sequence execution.
Use notify contexts and log repeated signals while keeping graceful shutdown.
Enforce per-phase and total shutdown deadlines with timeout coverage.
Track pid/pgid and terminate process trees with graceful timeouts.
Add manager CloseAll and wire session shutdown into the coordinator.
Track background processes and stop any leftovers during shutdown.
Exercise shutdown phase ordering to keep OTel and Temporal sequencing stable.
Document shutdown behavior and acceptance checks.
@jaromil jaromil self-assigned this Feb 3, 2026
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.

1 participant