Bundle: Software Garden fleet/PTY/subscription fixes (#1913, #1910, #1900, #1893)

Merged
AG
2mo ago
+6071-334

Founder request: bundle the finished Software Garden relay PRs so CI runs once while Actions is congested org-wide. Same pattern as cloud#4267.

Each one is merged unchanged with a merge commit, so the originals show as merged:

  • #1913 (efafa4d): Fleet-spawned Devin blocks on the interactive directory-trust prompt (directory_trust_required)
  • #1910 (e6bd9d6): provider subscription replies duplicate in Relay and don't write back to GitHub (MCP request replay plus idempotency_key; integration subscribe --events validation)
  • #1900 (d5f616e): fleet spawn's unconfirmed-spawn message hides a live agent; async agent remove (pending/liveness evidence, --wait removal; keeps the spawn_unconfirmed code)
  • #1893 (b8b6394): fleet spawn --task and relay messages injected into a PTY arrive truncated (bracketed paste, 16 KiB cap, --task-file, task-echo verification)

Each was reviewed and finished on its own PR: all checks green, 0 unresolved threads, and every bot finished on the head listed above. #1787 is intentionally excluded because it's parked on a design decision.

What the bundle adds on top

  • CHANGELOG.md: merged the four [Unreleased] blocks into main's [Unreleased - Minor] (union of bullets, sections ordered Added/Changed/Fixed).
  • crates/broker/src/runtime/tests.rs: one compile fix for a semantic conflict. #1913's new devin_directory_trust_error_expires_verified_spawn_and_releases_capacity test builds PendingVerifiedSpawn without the readiness_proven/task_event_id/task_verification fields that #1893 added, so the bundled broker lib tests did not compile (reproduced locally). The fixture is now an unready spawn with no task, which is the state the trust prompt blocks in. #1913's production handler (directory_trust_failed) is independent of those fields.

Review fixes on the bundle (all 43 bot threads answered and resolved)

The bots reviewed the full combined diff here; cubic had never reviewed the bot-authored originals. 36 findings are fixed, each with a fail-before/pass-after test:

  • Broker/PTY:
    • The PTY body cap applies only to PTY recipients; headless recipients are uncapped.
    • Muse gets its 16 KiB argv limit on CLI and node spawn, and can_inject waits for Muse's composer.
    • DECSET 2004 is detected across reads and only as a private-mode parameter.
    • An oversized wrap pointer falls back to a clipped envelope instead of requeueing forever.
    • An unlabelled delivery_verified event no longer claims echo.
  • MCP:
    • Idempotent replay is scoped to a digest of the acting agent token (identity + workspace).
    • Native tools send a tool-call idempotency key.
    • Retained keys expire lazily, with no timers.
  • CLI:
    • --task-file reads are bounded, and composed sandbox/auto-routed tasks are validated.
    • --wait-timeout is validated.
    • Removal-wait messaging and the no-workspace-key path are fixed.
    • Liveness evidence is ranked correctly and the hint is fleet-wide.
    • integration subscribe --list reads subscriptions once instead of per row.
  • Docs and tests:
    • Four #1893 changelog bullets had auto-merged under the released [13.1.1]; they are now in [Unreleased - Minor], and released sections match main.
    • Corrected the Devin trust recovery advice and other doc wording.
    • Fixed an MCP startup-test flake the bundle introduced: a real realtime client leaked a reconnect timer onto a later fake clock.

7 are declined with code-cited replies on their threads: echo whitespace normalization (×2), the pre-existing Devin wait-mode gate, the fleet ack for uninjectable payloads, wrap paste-marker accounting, #1900's release wording, and generated trajectory records.

Local verification on this head

  • cargo test -p agent-relay-broker: 1441 passed (lib), plus all integration targets. The 5 spawner::tests::broker_hook_* tests only fail when the shell inherits the broker's attestation git-config env; all 30 pass with it unset.
  • cargo test -p relay-pty (CI skip list): 265 passed. cargo clippy -- -D warnings and cargo fmt --check are clean.
  • npm run typecheck is clean and npm run lint shows 0 errors. Vitest across packages/cli, harnesses and harness-driver: 2294 passed. The 1 failure there (broker-process.test pid timing) and 3 in sdk agent-relay.test fail identically on main in this environment. Prettier is clean on the changed files.
  • The fleet E2E and RelayFlow regression shards run only in CI.

Merging this supersedes merging #1913/#1910/#1900/#1893 one by one; they will be closed with a link here once it lands.

🤖 Generated with Claude Code


[!NOTE]
High Risk
Changes core broker PTY injection, verified fleet spawn success criteria, and Devin startup gating—mistakes could block spawns, mis-report task delivery, or leave duplicate agents if operators retry unconfirmed spawns.

Overview
This bundle merges four relay fixes into one CI run: PTY task/message delivery, verified fleet spawn outcomes, Devin directory trust, and subscription/MCP idempotency (mostly documented in CHANGELOG.md; broker changes here center on spawn and injection).

PTY injection moves to shared injection_wire: bracketed paste when DECSET 2004 is latched (Devin always paste), typed fallback with ~1.5 KiB effective cap at default pace, 14 KiB body / 16 KiB envelope limits, control-character stripping, composer readiness waits (prompt_unproven), and pre-write injection_too_large rejection. Receipt for verified spawns is harness_acceptance only—echo, timeout fallback, and similar labels resolve as spawn_task_unconfirmed (live agent, do not retry) or spawn_task_failed when delivery clearly failed; failed tasks release the worker before reporting.

Fleet spawn tracks initial task event IDs and readiness order, rejects oversized PTY tasks before launch (headless/native exempt), and adds directory_trust_required for Devin after a 30s blocking trust prompt. Wrap delivers oversized relay messages as a bounded pointer instead of silent drop or infinite requeue.

CLI-facing behavior in the changelog includes --task-file, removal --wait, pending spawn evidence, and MCP/integration subscribe hardening. New broker integration tests cover Devin trust and Claude-style paste integrity.

Reviewed by Cursor Bugbot for commit 4690354e1ba1a94c8ce94a9405f48f448ded4ece. Bugbot is set up for automated code reviews on this repo. Configure here.


Agent Relay sessions

  • claude session 36e2deb9 · opened via gh pr create · last active 2026-10-08
  • claude session 2b09cf4d · contributor · ran gh pr commands · last active 2026-10-10
  • claude session add299c6 · contributor · pushed commits · last active 2026-10-10