Skip to content

Feature: Let ACP agents run builds, tests, and scripts in MandoCode terminals with live output and automatic cleanup - #152

Merged
DevMando merged 5 commits into
mainfrom
feature/acp-terminal-support
Dec 3, 2026
Merged

DevMando merged 5 commits into
mainfrom
feature/acp-terminal-support

Conversation

@DevMando

@DevMando DevMando commented Dec 3, 2026

Copy link
Copy Markdown
Owner

What this solves

ACP agents can now run non-interactive commands through MandoCode and show their output directly in the conversation. This makes builds, tests, and scripts visible and manageable in the same pane where the work is requested, without waiting for ACP v2.

What changes for users

  • Agents can start a command, read its output, wait for its result, stop it, and release it when finished.
  • Expandable command rows show live stdout/stderr, exit status, and whether output was truncated. Displayed output remains available after the terminal is released.
  • Commands belong to the current ACP session. Escape stops its command trees; clearing the session, restarting, changing folders, closing the pane, or losing the adapter cleans up owned terminals. Other panes remain independent.
  • Both the five ACP v1 terminal methods and the built-in MandoCode MCP tools use the same process backend. This also supports adapters that access host commands through MCP rather than the protocol methods.
  • Terminal access is enabled by default and can be disabled per ACP entry with clientTerminals: false. MCP access also requires the existing MandoCode bridge setting.

Execution boundaries

Commands run with ordinary user permissions and the ACP entry's environment rules. The starting directory must remain inside the pane's project, including through links; this is not a filesystem sandbox. Commands are non-interactive and use an explicit executable plus arguments, with an explicit shell when shell syntax is needed.

Each command has a ten-minute limit. Output defaults to 64 KiB and is capped at 1 MiB, retaining the most recent complete UTF-8 text. Each runtime permits eight running commands and 32 retained terminal IDs. Released IDs cannot be reused. ACP v2 negotiation is outside this change.

Validation

  • Full .NET 10 Release test suite: 2,038 passed, 1 existing skip.
  • Clean Release build: 0 warnings, 0 errors.
  • Automated coverage includes protocol/schema compatibility, real MCP calls, capability opt-out, session ownership, literal arguments and environment, live output without newlines, Unicode and output limits, child-process cancellation, pane isolation, and cleanup on clear, crash, and disposal.
  • Manual Codex test passed: create_terminal ran dotnet --version, wait_for_terminal returned 10.0.401 with exit code 0 and no truncation, and release_terminal succeeded while keeping the output visible.

Review organization

Five detailed commits separate protocol support, process lifecycle, MCP/UI integration, regression coverage, and README/changelog updates.

Related to #144 (terminal capability work).

Add typed create, output, wait, kill, and release messages and register them with the JSON source generator. Route terminal requests only when the client advertises terminal support, reject unknown sessions, and require an active turn before launching commands.

Expose the active session cancellation token so host commands remain attached to the owning turn rather than a short-lived RPC request. Preserve compatibility for handlers that do not provide terminal support.
…output

Introduce a reusable process manager with literal executable arguments, merged live stdout/stderr, UTF-8 tail buffering, exit status, and explicit wait, kill, and release operations. Enforce a ten-minute command lifetime, eight running commands, 32 retained IDs, and a one-MiB output ceiling.

Adapt the backend to ACP with session ownership, configured environment handling, and project-directory validation including link boundaries. Stop owned process trees on cancellation and clean up terminals when sessions are cleared, fail, or are disposed. Keep kill and release semantics distinct and make disposal idempotent.
…ommand rows

Provide create_terminal, get_terminal_output, wait_for_terminal, kill_terminal, and release_terminal through the existing MandoCode MCP bridge. Resolve ownership from the connected pane and active session, reuse the protocol backend, and retain command lifetime beyond individual MCP calls.

Render command output, truncation, and completion status in expandable transcript rows. Keep final output visible across turns and after release, bound the live display cache, and avoid marking running host commands incomplete when a model turn ends.

Wire terminal services into ACP startup and add the per-agent clientTerminals setting, enabled by default. Disabling it removes both protocol and MCP terminal access; the MCP route also respects the existing bridge setting.
Extend the mock adapter and command fixture to exercise all five terminal methods, real MCP calls, capability opt-out, active-session checks, and stale terminal IDs. Verify the terminal DTOs against the vendored ACP v1 schema.

Cover literal arguments, environment and working directory rules, stdout/stderr, output without newlines, Unicode tail limits, large output floods, and nonzero exit codes. Exercise cancellation with child processes, pane isolation, wait timeouts, release behavior, and cleanup on clear, crash, and disposal.

Verify live command rows retain final output across turns and release, and that the per-agent terminal flag controls host capabilities. Validation: full .NET 10 Release suite passed 2,038 tests with one existing skip; manual Codex create/wait/release returned SDK 10.0.401 and exit code zero.
Document protocol and MCP terminal access, live transcript output, executable arguments, session cleanup, and the clientTerminals opt-out. Explain environment handling, working directory boundaries, command and output limits, and that commands run with ordinary user permissions rather than a filesystem sandbox.

Record terminal support in the upcoming release highlights and test coverage. Clarify that ACP v1 is sufficient and this change does not add ACP v2 negotiation.
@DevMando
DevMando merged commit f0914df into main Dec 3, 2026
1 of 2 checks passed
@DevMando
DevMando deleted the feature/acp-terminal-support branch December 3, 2026 08:32
@DevMando DevMando mentioned this pull request Dec 3, 2026
8 tasks done
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