Skip to content

Generate input echoes from sideband events#138

Draft
t-kalinowski wants to merge 5 commits into
mainfrom
synthetic-input-echoes
Draft

Generate input echoes from sideband events#138
t-kalinowski wants to merge 5 commits into
mainfrom
synthetic-input-echoes

Conversation

@t-kalinowski

@t-kalinowski t-kalinowski commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

This PR removes output-inspection echo handling and makes consumed-input sideband events the only source of generated input echo text. The point is to stop treating prompt-shaped stdout/stderr as something to infer or suppress, while still preserving transcript context in overflow surfaces that need it.

Normal MCP replies now hide generated input echoes. Files-mode bundle transcripts and pager overflow pages keep generated echoes from the resolved timeline, so transcript-style surfaces still show consumed input without inspecting captured output.

User-facing changes

  • Normal repl replies no longer include generated input echoes; prompt-shaped stdout/stderr is preserved only when it was real output.
  • Files-mode output bundles include full generated input echoes in transcript.txt, even when the inline MCP preview omits them.
  • Pager overflow pages include full generated input echoes as separate text blocks before raw output.
  • Timeout follow-up prefixes and other non-overflow pager drains do not expose generated input echoes.

Internal changes

  • Added src/resolved_output.rs as the shared renderer for raw bytes, sideband events, text spans, images, and generated input echoes.
  • Deleted the pager-specific merge path and removed output-based echo trimming/suppression helpers.
  • Added ContentVisibility so generated echoes can be transcript-only without being serialized into normal MCP replies.
  • Kept files and pager backing stores separate: files mode still owns long-lived transcripts, request sealing, and timeout staging; pager mode still owns bounded ring, page cursors, and search state.
  • Updated docs, integration expectations, unit tests, and snapshots for the generated-echo contract.

Notes

  • R/Python input() and readline() normal-reply echo presentation remains follow-up scope; overflow transcript surfaces preserve generated input echo.
  • This remains a draft PR.

Diff composition

Measured against main, this PR is 1505 insertions and 4114 deletions across 66 files.

  • runtime src/: +901/-2774 (65.4% of churn)
  • inline tests inside src/: +191/-1121 (23.3% of churn)
  • tests in tests/: +252/-144 (7.0% of churn)
  • docs: +49/-53 (1.8% of churn)
  • snapshots: +112/-22 (2.4% of churn)

Largest files:

  • src/output_timeline.rs: +0/-1262
  • src/reply_presentation.rs: +26/-637
  • src/pending_output_tape.rs: +131/-509
  • src/resolved_output.rs: +455/-0
  • src/server/tests.rs: +0/-343

Remove output-based echo suppression and render input echoes only from consumed-input sideband events. Preserve captured output bytes even when they look like prompts or echoed input.
Skip generated input echoes when they would lead a reply, and merge adjacent generated echoes when they are retained after real output for attribution.
Review finding:
- [P1] Normalize the Python help banner instead of snapshotting it — /Users/tomasz/.codex/worktrees/183c/mcp-repl/tests/snapshots/python_help_snapshots__python_help_contract@transcript.snap:22-22 | With this literal banner in the snapshot, `cargo test --test python_help_snapshots` fails on Python versions whose pydoc banner says `enter "q" or "quit"` (e.g. Python 3.12.13) instead of including `exit`. The previous `<PYTHON HELP BANNER>` placeholder avoided this version-specific text, so the normalizer/snapshot should keep collapsing the banner even with the new `<<< >>>` prefix.

Response:
- Updated the Python help snapshot normalizer to recognize transcript help banners that start with `<<< >>> Welcome...`.
- Added a regression test for the short `enter "q" or "quit"` banner form.
- Updated the transcript snapshot to use `<PYTHON HELP BANNER>` again.
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