acpmux: run_wait waits for an Actions run or a PR's checks and wakes the chat once

Merged
TE
2d ago
+293-3

Leo's words (2026-11-03): "hmm claude code desktop's summarization of tool calls/parsing of them seem kinda good? we should bea bel to do that AND have condensed tools that are callable in acpmux/cmux-next..."

Stacked on #33317 (background-run-and-notify); it lands after that one.

What

A new condensed tool in the acpmux MCP server: run_wait. It waits under the daemon for a GitHub Actions run, or for a pull request's checks, and wakes the chat once with the outcome, naming the failed jobs. The agent no longer polls CI itself.

  • Args: repo (OWNER/REPO), exactly one of run (an Actions run id) or pr (a pull request number), optional sha with pr (pins the head: if the PR's head is another commit, before or after the wait, the result is failed), and description (the condensed-tool contract: what the call is for; by default "checks of OWNER/REPO#N" or "Actions run N in OWNER/REPO").
  • It is a bg_start with notify that the server writes for you. The command makes one blocking gh call (gh run watch RUN --exit-status --interval 30, or gh pr checks N --watch --fail-fast --interval 30), reads once which jobs or checks failed, and prints the outcome as its last line: Checks of o/r#12 passed, or Actions run 7 in o/r failed: build, lint. There is no shell sleep loop. Every interpolated value is checked first (digits, hex, OWNER/REPO characters), so nothing in the script needs quoting.
  • New task flag resultLine (record field result_line): when the task has ended, its summary line is its last output line. So both the end notice title and structuredContent.summary carry that outcome; status still comes from the exit code (ok only for 0).
  • With no gh on PATH, the call is refused with a clear message before any task starts. The script checks again in the agent's environment and exits 127 with run_wait: gh is not installed.

Tests

  • acpmux_mcp_bg::tests::run_wait_checks_its_arguments: valid and refused argument shapes, including a repo with shell characters.
  • acpmux_mcp_bg::tests::run_wait_scripts_end_on_their_outcome: runs the generated script against a fake gh. A failed run ends on ... failed: build, lint with exit 1. A passing pinned PR ends on ... passed with exit 0. A PR pinned to another head fails with exit 2 and never waits (exactly one --watch call is recorded).
  • acpmux_mcp_bg::tests::a_result_line_task_is_summed_up_by_its_last_line.
  • The acpmux tool list snapshot gains run_wait.

Observed / Not run

  • Not run on this machine (no local cargo here). The new tests run on the fleet at this head through cmux-ci test; results go in a comment.

Changelog

  • Added: agents can wait for a GitHub Actions run or a PR's checks with the acpmux run_wait tool, which wakes the chat once with the outcome and names the failed jobs.

Agent session: agent session

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Adds run_wait, a new acpmux tool that waits in the background for a GitHub Actions run or a PR's checks and wakes the chat once with the outcome, naming the failed jobs, so the agent no longer polls CI.

  • Takes repo plus exactly one of run (Actions run id) or pr (pull request number); optional sha pins the PR's head commit, failing the wait if it points elsewhere.
  • Adds a resultLine task flag so an ended task's summary is its last output line, which carries the pass/fail outcome.
  • Refuses the call before any task starts when gh is not on PATH.