Skip to content

Fleet spawn --task and relay messages injected into a PTY agent arrive truncated to their tail (silent), and spawn reports failure on success - #1893

Merged
khaliqgant merged 9 commits into
mainfrom
relayflow/relay-software-garden-746c5f53
Oct 10, 2026
Merged

khaliqgant merged 9 commits into
mainfrom
relayflow/relay-software-garden-746c5f53

Conversation

@agent-relay-code

@agent-relay-code agent-relay-code Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

PTY injection integrity and fleet task confirmation

Long fleet tasks and relay messages were typed into Claude one character every
5 ms. A 6.7 KB brief occupied the PTY write drainer for roughly 33 seconds, delaying
terminal-query replies and startup auto-responses while the composer could change.
The existing verification timeout acknowledged even a tail-only echo.

This change sends one bracketed paste to harnesses that have advertised DECSET
2004, followed by the existing delayed Enter. The capability is latched across
mode resets; composer readiness is checked independently before writing. A missing
composer, oversized body, or tail-only echo produces an explicit non-retryable
failure. Failed deliveries retain their identity and are never replayed or
subsequently acknowledged as successful duplicates. CRLF becomes LF; bare CR and
ESC cannot submit or terminate the body early.

The verification ladder is shared with wrap: exact echo, normalized head/tail
anchors, then paste summary. Missing heads only count as loss when the observation
window is retained. Absent echoes preserve timeout_fallback, now with a warning
and process-local counter. Wrap retains its existing failed-throttle timeout policy.

Verified fleet PTY spawns with a task remain pending after readiness until the
matching task verdict arrives; explicit task failures fail the spawn action.
Native and argv-task startup paths retain their existing readiness contract.
fleet spawn, agent spawn, and node agent spawn accept --task-file, read on
the requester and forwarded through existing task transport. Fleet requires
exactly one task source. Message commands and task input validate UTF-8 byte size.

Limits are 16 KiB globally, including the formatted envelope at the PTY boundary,
and 1,536 bytes for the default paced fallback. A slower explicit pace lowers that
cap. Codex retains its chunked initial-task path and uses the smaller derived cap.
The ordinary typed-path budget closes inside 90 seconds:
60 s startup + 15 s prompt recheck + 7.68 s typing + 0.25 s submit + 5 s verification
= 87.93 s. Steer acknowledgements include the injection budget.

Validation

  • Full broker and relay-pty run: 1,627 passed, 0 failed, 7 ignored.
  • Integrity integration suite, including the ignored stress test: 6 passed.
    Twenty cold starts each receive a >10 KB task and a >10 KB follow-up message,
    verified byte-for-byte in the fake harness's input transcript with one paste
    pair and one submit. Other arms cover tail loss/no replay, explicit size
    rejection, disappearing composer, and absent-echo compatibility.
  • CLI regression suites: 188 passed; CLI TypeScript checking passed.
  • cargo fmt --all --check and cargo clippy --all-targets passed. Clippy reports
    five pre-existing sliced-string warnings in Codex tests.
  • Live Claude startup probe observed DECSET 2004; no disable appeared during the
    six-second observation. Parser regression covers enable and disable in one read.

Commands (debug symbols disabled to fit the workspace disk):

env -u GIT_CONFIG_COUNT CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0 CARGO_INCREMENTAL=0 cargo test -p agent-relay-broker -p relay-pty
CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0 CARGO_INCREMENTAL=0 cargo test -p agent-relay-broker --test pty_injection_integrity -- --include-ignored
CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0 CARGO_INCREMENTAL=0 cargo clippy --all-targets
cargo fmt --all --check
npx vitest run packages/cli/src/cli/lib/task-input.test.ts packages/cli/src/cli/commands/fleet.test.ts packages/cli/src/cli/commands/local-agent.test.ts packages/cli/src/cli/commands/relaycast-groups.test.ts
npx tsc --noEmit -p packages/cli/tsconfig.json

This workspace injects core.hooksPath=/dev/null through GIT_CONFIG_COUNT.
Removing that setting only for the Rust test process lets the existing hook-chain
regressions exercise their own temporary repositories; all four then pass.

Compatibility and remaining work

Per reviewed-plan.md, absent-echo fallback still counts as spawn success. It is
not cryptographic or byte-for-byte receipt confirmation; the stronger ticket
acceptance needs a harness receipt protocol. The 20-run proof uses a raw-mode fake
Claude TUI through the real broker, not 20 authenticated Claude transcripts.

Wrap already bulk-wrote Claude input before this change. Fleet gains that behavior
plus explicit paste framing and readiness checks, rather than simply reverting
the 10.4.0 pacing fix. Large Claude inputs can now appear as pasted-content blocks;
the attribution envelope is unchanged.

Duplicate desktop/broker registrations remain a separate investigation requiring
the reporter's ambient MCP configuration. A node-side brief-file writer and
integration-command --task-file support are follow-ups. No workflow files were
changed, and no release or merge was performed.

Checks

Relayflow ran this repository's checks (.relayflow/check.sh) and they passed.

What ran (.relayflow/check.sh)
#!/bin/sh
# Fresh-machine equivalent of this repo's CI gate.
#
# Mirrors the jobs that gate a pull request on Linux:
#   .github/workflows/test.yml     -> test, lint
#   .github/workflows/codegen-models.yml -> codegen (generated files in sync)
#   .github/workflows/rust-ci.yml  -> rust-test, rust-clippy, rust-fmt
#
# Requires Node >= 22 (see .nvmrc / package.json engines).
set -e

cd "$(dirname "$0")/.."

# CI sets this on every workflow; keep local runs from emitting telemetry.
export AGENT_RELAY_TELEMETRY_DISABLED=1

# rust-ci.yml provisions cargo with dtolnay/rust-toolchain, which puts it on
# PATH. A toolchain is installed here but not exported by the login shell, so
# put it on PATH explicitly instead of silently skipping the Rust jobs below.
if [ -d "$HOME/.cargo/bin" ]; then
  PATH="$HOME/.cargo/bin:$PATH"
  export PATH
fi

# No CI workflow sets RELAY_BASE_URL. This sandbox exports it, and the CLI
# suites that assert "no ambient gateway is inherited" read the real
# environment (packages/cli/src/cli/lib/sdk-client.test.ts,
# commands/fleet-lifecycle-integration.test.ts), so leaving it set fails them.
unset RELAY_BASE_URL

# This sandbox has a 10 GB disk. A full-debug `cargo test` build of the
# workspace needs ~6 GB of debug info on top of the node_modules and dist
# trees, and runs the disk out mid-link. Dropping debug info keeps the same
# tests running; CI has the headroom and does not need this.
export CARGO_PROFILE_DEV_DEBUG=0
export CARGO_PROFILE_TEST_DEBUG=0
export CARGO_INCREMENTAL=0

# --- Dependencies -----------------------------------------------------------
npm ci

# test.yml installs rollup's platform-specific optional dependency explicitly,
# because npm sometimes skips it; failure here is non-fatal in CI too.
npm install --no-save rollup || true

# --- Code generation --------------------------------------------------------
# codegen-models.yml regenerates these from packages/utils/cli-registry.yaml and
# fails the PR if the committed output drifts.
npm run codegen:models
git diff --quiet packages/config/src/cli-registry.generated.ts packages/sdk-py/src/agent_relay/models.py || {
  echo "::error::Generated models are out of sync with cli-registry.yaml. Run 'npm run codegen:models' and commit the changes."
  exit 1
}

# --- Build ------------------------------------------------------------------
# Builds the Rust broker (skipped automatically when cargo is absent) and every
# workspace package. This is the same build `npm test` runs via its pretest
# hook, so the test step below invokes vitest directly instead of `npm test` to
# avoid building twice.
npm run build

# --- Lint / formatting ------------------------------------------------------
npm run lint
npm run format:check

# --- Tests ------------------------------------------------------------------
# Guard suites that test.yml runs ahead of the main suite.
node --test scripts/pr-proof/broker-transfer.test.mjs scripts/pr-proof/run-cloud.test.mjs scripts/flows/deploy-listeners.test.mjs scripts/pr-proof/event-from-input.test.mjs
npm run test:subscriptions:proof

# Main vitest suite (equivalent to `npm test`, whose pretest build already ran).
npx vitest run

# --- Rust (crates/broker, crates/relay-pty) ---------------------------------
# rust-ci.yml provisions a toolchain with dtolnay/rust-toolchain. Run these only
# when cargo is already present; this script does not install a toolchain.
if command -v cargo >/dev/null 2>&1; then
  cargo fmt -- --check
  cargo clippy -- -D warnings
  # This sandbox injects `core.hooksPath=/dev/null` through GIT_CONFIG_COUNT,
  # which defeats the spawner hook-chain tests that build their own temporary
  # repositories. CI has no GIT_CONFIG_* overrides; drop them for the tests.
  env -u GIT_CONFIG_COUNT cargo test
else
  echo "cargo not found - skipping Rust tests, clippy and fmt (rust-ci.yml equivalents)"
fi

# --- Deliberately omitted ---------------------------------------------------
# e2e-tests.yml, fleet-e2e.yml, relay-evals.yml, stress-tests.yml: need
#   ANTHROPIC_API_KEY and real agent CLIs driving live PTY sessions.
# test.yml coverage job: `npm run test:coverage` duplicates the suite above and
#   its only extra step is the Codecov upload, which needs a Codecov token.
# test.yml windows-credential-acl and swift-test jobs: need Windows and a Swift
#   toolchain on macOS respectively.
# prod-smoke.yml, publish.yml, verify-publish*.yml, deploy-relayflows.yml,
#   relay-*-qualification*.yml: deployment, npm/GitHub publishing and
#   cleanroom/Daytona cloud runs, all gated on registry and cloud credentials.
# test-build.yml / test-install.yml: build and install the released binaries
#   with Bun and a network install of agent-relay; not part of the source gate.

What the repair agent found

Repair notes — PTY injection integrity branch

Gate failures and what caused them

.relayflow/check.sh initially stopped at npm run format:check. Everything
after it (the guard suites, the vitest suite and the whole Rust section) never
ran. Findings, in the order the gate hits them:

1. format:check — untracked relayflow working files (fixed in place)

prettier --check . flagged plan.md and reviewed-plan.md. Both are
relayflow scratch documents listed in .git/info/exclude, so they are not part
of the repository and do not exist in CI; prettier reads .prettierignore, not
.git/info/exclude, so it checked them anyway. Formatted them in place
(npx prettier --write plan.md reviewed-plan.md). No repository file changed.

2. Rust jobs were silently skipped — toolchain not on PATH (fixed in check.sh)

check.sh guards the rust-ci.yml equivalents with command -v cargo. A
toolchain is installed at ~/.cargo/bin (cargo 1.99.0) but the login shell does
not export it, so cargo fmt, cargo clippy and cargo test were all skipped —
which hides the bulk of this branch, since the fix is in Rust. check.sh now
puts $HOME/.cargo/bin on PATH when it exists, the way
dtolnay/rust-toolchain does in CI.

3. Two CLI suites fail on an ambient RELAY_BASE_URL (fixed in check.sh)

  • packages/cli/src/cli/lib/sdk-client.test.ts › does not inherit a persisted
    gateway when an explicit agent token is supplied
  • packages/cli/src/cli/commands/fleet-lifecycle-integration.test.ts › reuses
    the persisted Cloud target across spawn, attach, message, list, and release
    without --base-url

Both assert that no ambient gateway is inherited, and both reach
createAgentRelay without an env override, so they read the real process
environment. This sandbox exports RELAY_BASE_URL=https://cast.agentrelay.com;
no workflow in .github/workflows/ sets it. env -u RELAY_BASE_URL npx vitest run <both files> passes 36/36, so check.sh now unsets it. The tests are
correct as written and were not touched.

4. Four Rust hook-chain tests fail on the sandbox git config (fixed in check.sh)

spawner::tests::broker_hook_chain_* (4 tests) build their own temporary
repositories and assert the repository's own hooks still run while the broker's
core.hooksPath is active. This sandbox injects core.hooksPath=/dev/null
through GIT_CONFIG_COUNT=4, which defeats them. CI sets no GIT_CONFIG_*
overrides, so check.sh now runs env -u GIT_CONFIG_COUNT cargo test. With
that, cargo test is 1347 + 254 + 25 passing, 0 failing.

5. cargo test runs the 10 GB disk out with full debug info (fixed in check.sh)

Once item 2 let the Rust section actually run, cargo test built the workspace
with the default debug = true and filled the disk mid-link (5.9 GB of debug
info in target/ on top of node_modules and the dist trees, leaving under
30 MB free). check.sh now exports CARGO_PROFILE_DEV_DEBUG=0,
CARGO_PROFILE_TEST_DEBUG=0 and CARGO_INCREMENTAL=0. The same tests run; only
the debug info is dropped. CI has the headroom and needs none of this.

None of these five are regressions from this branch; items 2–5 are environment
differences and are fixed only in .relayflow/check.sh, which is not committed.

Outside the gate, left alone

cargo clippy --all-targets -- -D warnings reports five
sliced_string_as_bytes errors in crates/broker/src/pty_worker.rs test code
(lines 2722/2733/2801/2851/3040 region). All five are present in the branch
point (238b522) and are test-only. rust-ci.yml and check.sh run
cargo clippy -- -D warnings without --all-targets, which passes, so this is
pre-existing and out of scope here.

Branch fixes committed in this pass

  1. crates/relay-pty/src/pty.rs — the bracketed-paste capability latch parsed
    every PTY output byte with its own processor.advance() call until DECSET
    2004 was observed. For a harness that never enables 2004 that is permanent,
    and it sits in the single reader thread that has to keep up with the child.
    Per-byte stepping is now reserved for chunks containing the literal 2004
    (a complete enable sequence must contain it, so enable+disable inside one
    read is still caught); every other chunk is bulk-parsed with one mode check
    afterwards, which still latches a DECSET split across reads. Covered by a new
    paste_capability_latches_when_decset_spans_two_reads test, verified to fail
    without the post-chunk check.
  2. Same file — bracketed_paste_enabled() had taken over consumed_offset()'s
    doc block, including its intra-doc link definition. Each has its own docs
    again.
  3. crates/broker/src/protocol.rs and packages/harness-driver/src/protocol.ts
    — the delivery_verified.verification and delivery_failed.reason doc
    comments still listed only echo / timeout_fallback. They now enumerate
    echo_anchors, paste_summary, prompt_unproven, echo_head_missing and
    injection_too_large, keeping the Rust and TypeScript protocol definitions in
    sync as .claude/rules/rust.md requires.
  4. CHANGELOG.md — added the missing Changed entry for the new 16 KiB body
    cap. It is user-visible (message send|reply|dm and the broker now reject
    larger bodies, including to native-runtime workers) and was only documented
    in docs/harnesses/injection.md.
  5. summary.md was committed into the repository in 924171f even though
    .git/info/exclude lists it as a relayflow working file. Untracked with
    git rm --cached so it stays on disk but out of the repository.

Fixes #1890

Review in cubic


Note

High Risk
Changes core PTY injection, delivery verification, and verified fleet spawn success criteria—incorrect behavior could silently lose tasks or block legitimate spawns.

Overview
Hardens PTY task and message delivery so large briefs use bracketed paste when DECSET 2004 is latched (with typed fallback and size gates), and echo verification only counts whole-payload receipt—not head/tail anchors or collapsed-paste markers.

Verified fleet spawns with a task no longer report spawned:true, ready:true unless delivery is confirmed (echo / echo_normalized); unconfirmed acks become spawn_task_unconfirmed (live agent, do not retry), terminal failures use spawn_task_failed / echo_head_missing, and oversized tasks are rejected before launch. Shared injection_wire enforces 16 KiB envelope / 14 KiB body caps; wrap delivers a pointer when over limit.

CLI adds --task-file (fleet requires exactly one of --task / --task-file); generic message commands stay uncapped at the Relaycast layer. relay-pty latches paste capability with efficient DECSET 2004 scanning. New integration tests and expanded runtime tests cover adversarial echo modes.

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

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 44c4daa1-8f05-4fd7-8519-69f71168c4b3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread crates/broker/src/runtime/fleet.rs Resolved

@devin-ai-integration devin-ai-integration 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.

Devin Review found 4 potential issues.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread crates/broker/src/wrap.rs Resolved
Address the three P1 findings on PR #1893.

Endpoint anchors and a collapsed-paste marker were treated as positive
delivery confirmation, and the verified fleet spawn branch reported
spawned:true, ready:true without inspecting the verification label at
all. An agent that swallowed its whole task, received only its head and
tail, or echoed nothing produced the same successful spawn result as one
that received every byte.

Only whole-payload evidence confirms a delivery now: `echo` (verbatim)
or `echo_normalized` (verbatim once the TUI's wrapping whitespace is
removed from both sides, which replaces the head/tail `echo_anchors`
rung). Matching endpoints around an unobserved middle become
`echo_incomplete` and a collapsed paste stays `paste_summary`; both ack
the delivery without claiming receipt. A tail without its head still
fails with `echo_head_missing`, and an absent echo still reports
`timeout_fallback`.

`verification_label_confirms_receipt` is the single source of truth for
which wire labels count as receipt, kept in lockstep with
`EchoVerdict::confirmed` by test. A verified spawn whose initial task is
acked without it resolves as `spawn_task_unconfirmed`, which names the
live agent and warns against retrying (a retry duplicates the agent)
rather than reporting success or a retryable failure; the pending entry
is still retired so the readiness deadline cannot release a live worker.

Wrap keeps its failed-throttle policy on absent echoes and on evidence
of loss, but records a collapsed paste as unverified: that verdict
indicates nothing about loss, so it must not back the injection delay
off on every delivery to a paste-collapsing TUI.

Regressions: missing, changed and reversed anchors; a partial paste and
a redrawn earlier paste marker; label/verdict agreement; timeout
dispositions; runtime arms feeding timeout_fallback, paste_summary,
echo_incomplete and a missing label through the spawn-completion
handler. The PTY integration suite gains the reviewer's `middle_lost`
and `paste_tail` fixture modes as negative-confirmation assertions.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@agent-relay-code
agent-relay-code Bot marked this pull request as draft October 4, 2026 08:20
@agent-relay-code

Copy link
Copy Markdown
Contributor Author

Checks

The latest revision breaks checks that passed before it. It was pushed so the work is not lost, and the pull request is now a draft; it is not ready to merge.

What ran (.relayflow/check.sh)
#!/bin/sh
# Fresh-machine equivalent of this repo's CI gate.
#
# Mirrors the jobs that gate a pull request on Linux:
#   .github/workflows/test.yml     -> test, lint
#   .github/workflows/codegen-models.yml -> codegen (generated files in sync)
#   .github/workflows/rust-ci.yml  -> rust-test, rust-clippy, rust-fmt
#
# Requires Node >= 22 (see .nvmrc / package.json engines).
set -e

cd "$(dirname "$0")/.."

# CI sets this on every workflow; keep local runs from emitting telemetry.
export AGENT_RELAY_TELEMETRY_DISABLED=1

# rust-ci.yml provisions cargo with dtolnay/rust-toolchain, which puts it on
# PATH. A toolchain is installed here but not exported by the login shell, so
# put it on PATH explicitly instead of silently skipping the Rust jobs below.
if [ -d "$HOME/.cargo/bin" ]; then
  PATH="$HOME/.cargo/bin:$PATH"
  export PATH
fi

# No CI workflow sets RELAY_BASE_URL. This sandbox exports it, and the CLI
# suites that assert "no ambient gateway is inherited" read the real
# environment (packages/cli/src/cli/lib/sdk-client.test.ts,
# commands/fleet-lifecycle-integration.test.ts), so leaving it set fails them.
unset RELAY_BASE_URL

# This sandbox has a 10 GB disk. A full-debug `cargo test` build of the
# workspace needs ~6 GB of debug info on top of the node_modules and dist
# trees, and runs the disk out mid-link. Dropping debug info keeps the same
# tests running; CI has the headroom and does not need this.
export CARGO_PROFILE_DEV_DEBUG=0
export CARGO_PROFILE_TEST_DEBUG=0
export CARGO_INCREMENTAL=0

# --- Dependencies -----------------------------------------------------------
npm ci

# test.yml installs rollup's platform-specific optional dependency explicitly,
# because npm sometimes skips it; failure here is non-fatal in CI too.
npm install --no-save rollup || true

# --- Code generation --------------------------------------------------------
# codegen-models.yml regenerates these from packages/utils/cli-registry.yaml and
# fails the PR if the committed output drifts.
npm run codegen:models
git diff --quiet packages/config/src/cli-registry.generated.ts packages/sdk-py/src/agent_relay/models.py || {
  echo "::error::Generated models are out of sync with cli-registry.yaml. Run 'npm run codegen:models' and commit the changes."
  exit 1
}

# --- Build ------------------------------------------------------------------
# Builds the Rust broker (skipped automatically when cargo is absent) and every
# workspace package. This is the same build `npm test` runs via its pretest
# hook, so the test step below invokes vitest directly instead of `npm test` to
# avoid building twice.
npm run build

# --- Lint / formatting ------------------------------------------------------
npm run lint
npm run format:check

# --- Tests ------------------------------------------------------------------
# Guard suites that test.yml runs ahead of the main suite.
node --test scripts/pr-proof/broker-transfer.test.mjs scripts/pr-proof/run-cloud.test.mjs scripts/flows/deploy-listeners.test.mjs scripts/pr-proof/event-from-input.test.mjs
npm run test:subscriptions:proof

# Main vitest suite (equivalent to `npm test`, whose pretest build already ran).
npx vitest run

# --- Rust (crates/broker, crates/relay-pty) ---------------------------------
# rust-ci.yml provisions a toolchain with dtolnay/rust-toolchain. Run these only
# when cargo is already present; this script does not install a toolchain.
if command -v cargo >/dev/null 2>&1; then
  cargo fmt -- --check
  cargo clippy -- -D warnings
  # This sandbox injects `core.hooksPath=/dev/null` through GIT_CONFIG_COUNT,
  # which defeats the spawner hook-chain tests that build their own temporary
  # repositories. CI has no GIT_CONFIG_* overrides; drop them for the tests.
  env -u GIT_CONFIG_COUNT cargo test
else
  echo "cargo not found - skipping Rust tests, clippy and fmt (rust-ci.yml equivalents)"
fi

# --- Deliberately omitted ---------------------------------------------------
# e2e-tests.yml, fleet-e2e.yml, relay-evals.yml, stress-tests.yml: need
#   ANTHROPIC_API_KEY and real agent CLIs driving live PTY sessions.
# test.yml coverage job: `npm run test:coverage` duplicates the suite above and
#   its only extra step is the Codecov upload, which needs a Codecov token.
# test.yml windows-credential-acl and swift-test jobs: need Windows and a Swift
#   toolchain on macOS respectively.
# prod-smoke.yml, publish.yml, verify-publish*.yml, deploy-relayflows.yml,
#   relay-*-qualification*.yml: deployment, npm/GitHub publishing and
#   cleanroom/Daytona cloud runs, all gated on registry and cloud credentials.
# test-build.yml / test-install.yml: build and install the released binaries
#   with Bun and a network install of agent-relay; not part of the source gate.
Output on this branch (last 80 lines)
  1073:1   warning  Async function 'killOrphanedBrokerProcesses' has a complexity of 17. Maximum allowed is 15   complexity
  1404:1   warning  Async function 'waitForEnrolledNodeReadiness' has a complexity of 23. Maximum allowed is 15  complexity
  1455:7   warning  The value assigned to 'latest' is not used in subsequent statements                          no-useless-assignment
  1493:1   warning  Unused eslint-disable directive (no problems were reported from 'complexity')
  1876:8   warning  Async function 'runUpCommand' has a complexity of 108. Maximum allowed is 15                 complexity
  2577:1   warning  Unused eslint-disable directive (no problems were reported from 'max-depth')
  2702:7   warning  Unused eslint-disable directive (no problems were reported from 'max-depth')
  2755:8   warning  Async function 'runStatusCommand' has a complexity of 35. Maximum allowed is 15              complexity

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/lib/broker-process-identity.ts
   88:8  warning  Async function 'readBrokerProcessIdentity' has a complexity of 17. Maximum allowed is 15  complexity
  151:1  warning  Function 'readBrokerIdentityFile' has a complexity of 18. Maximum allowed is 15           complexity

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/lib/core-maintenance.ts
  212:8  warning  Async function 'runUninstallCommand' has a complexity of 34. Maximum allowed is 15  complexity

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/lib/doctor.ts
  143:1  warning  Async function 'checkBrokerReliability' has a complexity of 31. Maximum allowed is 15  complexity

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/lib/exit.ts
  73:7  warning  Unused eslint-disable directive (no problems were reported from 'no-console')

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/lib/fleet-attach-target.ts
  22:8  warning  Async function 'resolveFleetAttachTarget' has a complexity of 19. Maximum allowed is 15  complexity

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/lib/fleet-hint.ts
  54:8  warning  Async function 'resolveFleetHint' has a complexity of 20. Maximum allowed is 15  complexity

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/lib/jsonc.ts
   8:8  warning  Function 'stripJsonComments' has a complexity of 17. Maximum allowed is 15  complexity
  90:5  warning  There is no `cause` attached to the symptom error being thrown              preserve-caught-error

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/lib/node-provider-child.ts
  662:5  warning  There is no `cause` attached to the symptom error being thrown  preserve-caught-error

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/lib/sandbox-repo.ts
   29:8  warning  Function 'resolveSandboxRepository' has a complexity of 36. Maximum allowed is 15  complexity
   66:5  warning  There is no `cause` attached to the symptom error being thrown                     preserve-caught-error
  228:1  warning  Function 'parseRepository' has a complexity of 21. Maximum allowed is 15           complexity

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/lib/sdk-client.ts
   91:1  warning  Function 'resolveBaseUrlForSelection' has a complexity of 19. Maximum allowed is 15         complexity
  151:1  warning  Function 'validatePersistedRelaycastBaseUrl' has a complexity of 22. Maximum allowed is 15  complexity

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/lib/skills-install.ts
  263:7  warning  There is no `cause` attached to the symptom error being thrown  preserve-caught-error
  266:5  warning  There is no `cause` attached to the symptom error being thrown  preserve-caught-error

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/lib/workspace-session.ts
  81:8  warning  Function 'persistWorkspaceSession' has a complexity of 21. Maximum allowed is 15  complexity

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/mcp/inbox.ts
  14:8  warning  Function 'formatInbox' has a complexity of 21. Maximum allowed is 15  complexity

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/mcp/resources.ts
  48:8  warning  Function 'eventToResourceUris' has a complexity of 22. Maximum allowed is 15  complexity

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/mcp/telemetry.ts
  145:48  warning  Async arrow function has a complexity of 38. Maximum allowed is 15  complexity
  201:9   warning  There is no `cause` attached to the symptom error being thrown      preserve-caught-error

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/telemetry/client.ts
  63:11  warning  Variable name `__filename` trimmed as `_filename` must match one of the following formats: camelCase, UPPER_CASE, PascalCase  @typescript-eslint/naming-convention
  64:11  warning  Variable name `__dirname` trimmed as `_dirname` must match one of the following formats: camelCase, UPPER_CASE, PascalCase    @typescript-eslint/naming-convention
  76:1   warning  Function 'buildCommonProperties' has a complexity of 17. Maximum allowed is 15                                                complexity

/home/daytona/.relayflow-v2-supervisor/durable/repository/packages/cli/src/cli/telemetry/orchestrator-harness.ts
  115:8  warning  Function 'detectOrchestratorHarness' has a complexity of 17. Maximum allowed is 15  complexity

✖ 108 problems (0 errors, 108 warnings)
  0 errors and 4 warnings potentially fixable with the `--fix` option.


> @agent-relay/monorepo@13.1.0 format:check
> prettier --check .

Checking formatting...
[warn] .relayflow/check-report.md
[warn] .relayflow/pr-body.md
[warn] Code style issues found in 2 files. Run Prettier with --write to fix.

What the repair agent found

Repair notes — PTY injection integrity branch

Gate failures and what caused them

.relayflow/check.sh initially stopped at npm run format:check. Everything
after it (the guard suites, the vitest suite and the whole Rust section) never
ran. Findings, in the order the gate hits them:

1. format:check — untracked relayflow working files (fixed in place)

prettier --check . flagged plan.md and reviewed-plan.md. Both are
relayflow scratch documents listed in .git/info/exclude, so they are not part
of the repository and do not exist in CI; prettier reads .prettierignore, not
.git/info/exclude, so it checked them anyway. Formatted them in place
(npx prettier --write plan.md reviewed-plan.md). No repository file changed.

2. Rust jobs were silently skipped — toolchain not on PATH (fixed in check.sh)

check.sh guards the rust-ci.yml equivalents with command -v cargo. A
toolchain is installed at ~/.cargo/bin (cargo 1.99.0) but the login shell does
not export it, so cargo fmt, cargo clippy and cargo test were all skipped —
which hides the bulk of this branch, since the fix is in Rust. check.sh now
puts $HOME/.cargo/bin on PATH when it exists, the way
dtolnay/rust-toolchain does in CI.

3. Two CLI suites fail on an ambient RELAY_BASE_URL (fixed in check.sh)

  • packages/cli/src/cli/lib/sdk-client.test.ts › does not inherit a persisted
    gateway when an explicit agent token is supplied
  • packages/cli/src/cli/commands/fleet-lifecycle-integration.test.ts › reuses
    the persisted Cloud target across spawn, attach, message, list, and release
    without --base-url

Both assert that no ambient gateway is inherited, and both reach
createAgentRelay without an env override, so they read the real process
environment. This sandbox exports RELAY_BASE_URL=https://cast.agentrelay.com;
no workflow in .github/workflows/ sets it. env -u RELAY_BASE_URL npx vitest run <both files> passes 36/36, so check.sh now unsets it. The tests are
correct as written and were not touched.

4. Four Rust hook-chain tests fail on the sandbox git config (fixed in check.sh)

spawner::tests::broker_hook_chain_* (4 tests) build their own temporary
repositories and assert the repository's own hooks still run while the broker's
core.hooksPath is active. This sandbox injects core.hooksPath=/dev/null
through GIT_CONFIG_COUNT=4, which defeats them. CI sets no GIT_CONFIG_*
overrides, so check.sh now runs env -u GIT_CONFIG_COUNT cargo test. With
that, cargo test is 1347 + 254 + 25 passing, 0 failing.

5. cargo test runs the 10 GB disk out with full debug info (fixed in check.sh)

Once item 2 let the Rust section actually run, cargo test built the workspace
with the default debug = true and filled the disk mid-link (5.9 GB of debug
info in target/ on top of node_modules and the dist trees, leaving under
30 MB free). check.sh now exports CARGO_PROFILE_DEV_DEBUG=0,
CARGO_PROFILE_TEST_DEBUG=0 and CARGO_INCREMENTAL=0. The same tests run; only
the debug info is dropped. CI has the headroom and needs none of this.

None of these five are regressions from this branch; items 2–5 are environment
differences and are fixed only in .relayflow/check.sh, which is not committed.

Outside the gate, left alone

cargo clippy --all-targets -- -D warnings reports five
sliced_string_as_bytes errors in crates/broker/src/pty_worker.rs test code
(lines 2722/2733/2801/2851/3040 region). All five are present in the branch
point (238b522) and are test-only. rust-ci.yml and check.sh run
cargo clippy -- -D warnings without --all-targets, which passes, so this is
pre-existing and out of scope here.

Branch fixes committed in this pass

  1. crates/relay-pty/src/pty.rs — the bracketed-paste capability latch parsed
    every PTY output byte with its own processor.advance() call until DECSET
    2004 was observed. For a harness that never enables 2004 that is permanent,
    and it sits in the single reader thread that has to keep up with the child.
    Per-byte stepping is now reserved for chunks containing the literal 2004
    (a complete enable sequence must contain it, so enable+disable inside one
    read is still caught); every other chunk is bulk-parsed with one mode check
    afterwards, which still latches a DECSET split across reads. Covered by a new
    paste_capability_latches_when_decset_spans_two_reads test, verified to fail
    without the post-chunk check.
  2. Same file — bracketed_paste_enabled() had taken over consumed_offset()'s
    doc block, including its intra-doc link definition. Each has its own docs
    again.
  3. crates/broker/src/protocol.rs and packages/harness-driver/src/protocol.ts
    — the delivery_verified.verification and delivery_failed.reason doc
    comments still listed only echo / timeout_fallback. They now enumerate
    echo_anchors, paste_summary, prompt_unproven, echo_head_missing and
    injection_too_large, keeping the Rust and TypeScript protocol definitions in
    sync as .claude/rules/rust.md requires.
  4. CHANGELOG.md — added the missing Changed entry for the new 16 KiB body
    cap. It is user-visible (message send|reply|dm and the broker now reject
    larger bodies, including to native-runtime workers) and was only documented
    in docs/harnesses/injection.md.
  5. summary.md was committed into the repository in 924171f even though
    .git/info/exclude lists it as a relayflow working file. Untracked with
    git rm --cached so it stays on disk but out of the repository.

agentrelaybot added 2 commits October 7, 2026 23:47
…are-garden-746c5f53

Session-Id: f9b2ae4e-847e-47c7-9996-b6545ca4353c
…n task failure, never drop oversized wrap messages

Review on #1893:

- Cursor (high): a task verdict that arrives before proven readiness
  (startup-fallback worker_ready releases the task first) is now recorded on
  the pending spawn, and the later proven worker_ready resolves the action
  from it, as success (whole-payload echo) or spawn_task_unconfirmed.
  Previously the verdict was ignored and the spawn timed out and was
  released after a successful delivery.
- Cursor (medium): a worker already ready when the launch returns had its
  PTY task queued unbound to the action; it now resolves as
  spawn_task_unconfirmed instead of plain success.
- Devin: a failed initial task (delivery_failed, or an immediate queue
  error) now expires the pending spawn with spawn_task_failed, so
  maintenance releases the worker and its fleet identity before reporting.
  A corrected retry can reuse the name.
- Devin: an oversized wrap message is delivered as a bounded notice naming
  the sender, size, limit and message ID instead of being silently dropped
  after it left the queue.
- Devin: `message post|reply|dm send` no longer apply the PTY injection cap.
  The limit stays at the PTY boundary (and on fleet task input).

Also merges origin/main, completing the PendingVerifiedSpawn literals both
sides extended, and fixes the two red checks this head caused:
- Fleet E2E resume: a verified spawn with a task now completes after task
  verification, and node-a's stub delays readiness 27 s, so the 30 s settle
  waits become 60 s.
- RelayFlow 1615: the fake Claude now redraws its prompt after Enter, as the
  real composer does, so the pre-write composer check can prove readiness
  for the second message.

Each new test fails with its fix reverted (mutation-checked) and passes
with it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Session-Id: f9b2ae4e-847e-47c7-9996-b6545ca4353c
@AgentRelayBot
AgentRelayBot marked this pull request as ready for review October 8, 2026 07:29
@AgentRelayBot

Copy link
Copy Markdown
Contributor

bugbot run

@AgentRelayBot

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review skipped.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread crates/broker/src/pty_worker.rs Resolved
Comment thread crates/broker/src/pty_worker.rs Resolved
…ed tasks before launch; keep the reminder on rejection

Cursor review on #1893 (6ffef38):

- Body caps ignored the envelope. The PTY worker caps the formatted
  envelope at 16 KiB, but readTaskInput and queue_and_try_delivery_raw
  accepted a 16 KiB raw body, so a brief at the advertised limit launched a
  worker that then failed injection_too_large and was released. Bodies are
  now capped at MAX_BODY_BYTES (16 KiB less a 2 KiB ENVELOPE_RESERVE_BYTES)
  in the CLI and in raw delivery, and the fleet spawn action rejects an
  oversized task with spawn_task_too_large before registering or
  launching anything.
- The MCP reminder throttle was marked sent before the size gate, so a
  rejected envelope stole the reminder from the next delivery. It is now
  noted only after the envelope passes every pre-write gate.

Regressions (each fails with its fix reverted): the worst-case envelope
for a body at the cap fits 16 KiB (128-char names, workspace label, full
reminder); an oversized spawn task is rejected before registration; a
rejected injection leaves the next delivery its full reminder (real
broker integration test); the CLI rejects a 16 KiB task naming the envelope.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Session-Id: f9b2ae4e-847e-47c7-9996-b6545ca4353c
@AgentRelayBot

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread crates/broker/src/runtime/delivery.rs Resolved
…before launch

Cursor review on #1893 (9dc1a75): the pre-launch check measured the raw
task, but spawn paths then append the exit-after-task contract, the relay
skill prefix and continuity context, so an accepted brief could still fail
at worker_ready, after launch.

validate_pty_initial_task_size measures the final task as it will be
injected and rejects it with spawn_task_too_large. It runs in
spawn_worker_from_request right after decoration (before any Relaycast
registration) and in WorkerRegistry::spawn_with_generation, the gate every
spawn path (HTTP, WS, fleet) funnels through, before anything is launched.
Muse takes its task in argv and non-PTY runtimes are not injected, so
neither is measured. One message builder (injection_wire::task_too_large_error)
backs every rejection.

Regressions: a fleet spawn whose raw task fits but whose exit-after-task
decoration overflows fails before RegisterAgent (fails with the new call
removed); the validator measures only injected PTY tasks.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Session-Id: f9b2ae4e-847e-47c7-9996-b6545ca4353c
@AgentRelayBot

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

…itial task completes

The resume scenario's `pool` harness runs the stub as `codex`, which sends
the initial task through the broker's chunked Codex path. That path confirms
delivery by watching the composer: each chunk rendered after the prompt, then
the composer cleared once Enter submits the turn. The stub only had the
kernel's cooked-mode echo and never cleared its composer, so after Enter the
task still looked parked; the broker retried the submit, exhausted its
retries and dead-lettered `initial_injection_incomplete`. On main that dead
letter was invisible because a verified spawn resolved at readiness. This
PR fails a spawn whose task was not delivered, so the scenario failed.

As `codex`, the stub now takes raw input, renders typed text after `›`, and
redraws an empty composer on Enter. Pre-ready input is still discarded and,
with raw mode, no longer echoed by the kernel either. Other stub uses are
unchanged. Verified locally against the CI-pinned engine: the resume
scenario now completes and resumes on its origin node.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Session-Id: f9b2ae4e-847e-47c7-9996-b6545ca4353c
@AgentRelayBot

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b8b6394. Configure here.

AgentRelayBot pushed a commit that referenced this pull request Oct 8, 2026
Move four #1893 entries that auto-merged under the released 13.1.1 into
[Unreleased - Minor] (released sections now match main) and split combined
bullets. Fix the Devin trust recovery advice, the local --task/--task-file
wording, pending-spawn README fields and the evidence doc's plan reference.
Decode stub-agent stdin as a UTF-8 stream and give the resumable-spawn e2e a
timeout that covers its own waits.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Session-Id: 36e2deb9-531e-419c-ab12-946ffb5d2dd5
AgentRelayBot pushed a commit that referenced this pull request Oct 10, 2026
Brings in #1945 (harness-acceptance PTY delivery, submit-key resubmits,
file attachments) and resolves its overlap with the bundle.

Delivery verification: #1945's acceptance model replaces #1893's echo
verdict ladder for message delivery in pty_worker and wrap. A body echoed
in the composer can still be a parked draft, so echo content no longer
confirms anything; EchoVerdict, verification_timeout, the head-missing
check and wrap's echo-timeout re-injection are dropped with their tests,
and the integrity test fixture modes that only exercised echo verdicts
(tail, middle_lost, paste_tail, silent) go with them. Bracketed paste,
the 16 KiB cap, the wrap pointer for oversized messages, --task-file and
the Devin trust gate are kept.

Verified fleet spawn confirmation (#1893) keeps its frame-order handling
and spawn_task_unconfirmed result, re-pointed at #1945's labels:
- verification_label_confirms_receipt accepts only "harness_acceptance".
  Legacy "echo"/"timeout_fallback", "completed_replay" and an unlabelled
  frame resolve the spawn as spawn_task_unconfirmed. The spawn verdict is
  recorded before the PTY gate that turns non-acceptance labels into
  delivery_unconfirmed, so the action still resolves.
- A delivery_failed with "harness acceptance could not be proven" (window
  closed, body neither accepted nor parked) is not evidence of loss, so the
  spawn resolves as spawn_task_unconfirmed and keeps the live worker,
  instead of releasing it as spawn_task_failed. Every other failure reason,
  including "body remained parked after bounded submit-key recovery",
  still releases the worker and fails with spawn_task_failed.
- The label and reason are shared constants (HARNESS_ACCEPTANCE,
  HARNESS_ACCEPTANCE_UNPROVEN) used by pty_worker and the runtime.

MCP: send_dm uses the shared idempotencyKeyInput and replayScopeOf with
#1945's upload_file attachment wording. AGENTS.md follows main (trunk
gating removed). CHANGELOG unions both Unreleased sections. Protocol docs
and docs/harnesses/injection.md describe the acceptance labels and reasons.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@khaliqgant
khaliqgant merged commit 9c42834 into main Oct 10, 2026
92 of 95 checks passed
khaliqgant added a commit that referenced this pull request Oct 10, 2026
…-1910-1900-1893

Bundle: Software Garden fleet/PTY/subscription fixes (#1913, #1910, #1900, #1893)
mperkins0155 pushed a commit to cobaltconsulting/relay that referenced this pull request Nov 24, 2026
…entWorkforce#1893's PendingVerifiedSpawn fields

AgentWorkforce#1893 added readiness_proven, task_event_id and task_verification to
PendingVerifiedSpawn; AgentWorkforce#1913's new test predates them, so the bundled
broker lib tests did not compile. The trust prompt blocks before
readiness, so the fixture is an unready spawn with no task.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Session-Id: 36e2deb9-531e-419c-ab12-946ffb5d2dd5
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.

Fleet spawn --task and relay messages injected into a PTY agent arrive truncated to their tail (silent), and spawn reports failure on success

2 participants