Skip to content

fix: harden MCP statement output surface#777

Merged
apstndb merged 4 commits into
mainfrom
fix/mcp-surface-hardening
Jul 6, 2026
Merged

fix: harden MCP statement output surface#777
apstndb merged 4 commits into
mainfrom
fix/mcp-surface-hardening

Conversation

@apstndb

@apstndb apstndb commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Reject backslash meta commands from MCP execute_statement
  • Cap MCP statement output capture and return an explicit truncation marker
  • Route progress bars only to the StreamManager TTY, disabling them when no TTY is available
  • Update MCP tool text to describe captured output rather than ASCII-only tables

Tests

  • make check

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces memory-safe output capturing and rejects backslash meta commands in the MCP execute_statement handler. Specifically, it adds an mcpOutputCapture helper to truncate output exceeding 1MB and updates the handler to reject meta commands like shell execution, output redirection, and teeing. Additionally, it refactors progress bar initialization to only instantiate when a TTY is available, preventing progress bar output from corrupting non-TTY streams (such as MCP). Comprehensive tests have been added to verify these behaviors. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Code Metrics Report

📊 View detailed coverage report (available for 7 days)

main (ec3190b) #777 (aec0bd4) +/-
Coverage 73.1% 73.1% +0.0%
Code to Test Ratio 1:1.3 1:1.3 +0.0
Test Execution Time 1m39s 1m42s +3s
Details
  |                     | main (ec3190b) | #777 (aec0bd4) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          73.1% |          73.1% | +0.0% |
  |   Files             |             87 |             87 |     0 |
  |   Lines             |           7814 |           7840 |   +26 |
+ |   Covered           |           5715 |           5736 |   +21 |
+ | Code to Test Ratio  |          1:1.3 |          1:1.3 |  +0.0 |
  |   Code              |          18201 |          18256 |   +55 |
+ |   Test              |          24473 |          24564 |   +91 |
- | Test Execution Time |          1m39s |          1m42s |   +3s |

Code coverage of files in pull request scope (54.8% → 56.2%)

Files Coverage +/- Status
internal/mycli/cli_mcp.go 83.0% +5.8% modified
internal/mycli/execute_ddl.go 41.9% +1.0% modified
internal/mycli/statements.go 56.9% -0.2% modified

Reported by octocov

@apstndb apstndb merged commit f23499f into main Jul 6, 2026
8 checks passed
@apstndb apstndb deleted the fix/mcp-surface-hardening branch July 6, 2026 20:38
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