Skip to content

agent terminal over SSH intermittently returns without an exit frame in check-tmux-pod's ssh-grpc-tmux stage (1 in 3 runs) #1314

Backlog

Description

@aitrawog

Symptom

An intermittent failure of the agent channel's SSH transport, observed once in three runs of the same bed on the same binary:

FAIL  check the typed terminal provider completes a detached pod round-trip … [tmux-roundtrip]
      exit=1, want 0 (stderr: tmux-roundtrip: FAIL stage=ssh-grpc-tmux exit=1
                      tmux-roundtrip: command log follows)
23 steps: 19 passed, 1 failed, 3 skipped

Where

opencharly/distro-arch's check-tmux-pod bed, stage ssh-grpc-tmux, which runs:

${CHARLY_BIN} agent terminal run "$SSH_PROFILE" --target "$SSH_TARGET" --run-id "$SSH_RUN" >"$SSH_OUT"
# then: grep -q '"kind":"exit"' "$SSH_OUT"  (the stage exits 1 if the frame is absent)

with SSH_TARGET = {"hops":[{"transport":"ssh","address":"127.0.0.1","user":"user","port":${HOST_PORT:2222},…}]} — i.e. SSH into the deployed container's sshd as user, then the typed-terminal bootstrap.

Measured

Three runs of charly check run check-tmux-pod, same host, same binary (2026.331.2341, built with GOWORK=off, sdk pin v0.2026331.2334):

run dir result
.check/check-tmux-pod/2026.331.2244 (same bed, sdk fix via a local workspace) PASS, [tmux-roundtrip] exit=0, 23 steps: 20 passed
.check/check-tmux-pod/2026.331.2342 FAIL at stage=ssh-grpc-tmux
.check/check-tmux-pod/2026.331.2346 (immediately after) PASS, [tmux-roundtrip] exit=0, 23 steps: 20 passed

Port 2222 was free and no container was left behind before the re-run (ss -ltnp empty for 2222; podman ps -a empty for the bed), so the failing run was not colliding with a leftover from the previous one.

Why it could not be RCA'd here

The bed's own log keeps only the first line of the check's stderr (34 lines in check-live.log); the command log follows payload — the JSONL frames and the agent-side error — lives in the check's $DIR, which is a mktemp -d removed when the check returns. So the failing object is gone by the time the bed reports.

The fix for that is the bed, not this issue: keep the check's $DIR (or copy $LOG/$SSH_OUT into the bed's artifact directory) when a stage fails, so the next occurrence is diagnosable. Until then, this is recorded rather than guessed: the failure is at the SSH bootstrap hop, 1 in 3, on a binary that is otherwise green.

Impact

Non-blocking: the bed's assertions pass on repetition, and the failure is not in the diff under review (it is the agent channel's SSH hop). It blocks a clean single-run proof claim for any PR that uses this bed, which is why it is filed rather than waved away as a flake.

Agent: jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5 · OpenCode session ses_de3fa473bffeFiBo62whHxDPE5

Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

Activity

  1. added
    category:runtime
    type:fix
    on Nov 27, 2026
  2. aitrawog commented on Nov 28, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    The reason this failure left no diagnosis is in the check script itself — two concrete defects in distro-arch/charly.yml's finish_tmux_roundtrip (check-tmux-pod → tmux-roundtrip):

    finish_tmux_roundtrip() {
      code=$?
      if [ "$code" -ne 0 ]; then
        echo "tmux-roundtrip: FAIL stage=$STAGE exit=$code" >&2
        if [ -s "$LOG" ]; then
          echo "tmux-roundtrip: command log follows" >&2
          grep -E 'charly: error|agent channel: FAIL|incident|failed|not found|already exists' "$LOG" | tail -6 >&2
        fi
      fi
      rm -rf "$DIR"
      exit "$code"
    }
    1. The filter is too narrow to be a diagnostic. The failing stage is ${CHARLY_BIN} agent terminal run …, and its refusal need not contain any of those six strings. When none match, command log follows is printed and nothing follows it — which is exactly what the pasted output shows: one line, then silence.
    2. rm -rf "$DIR" runs on the failure path too. $DIR is the mktemp -d holding $LOG, $SSH_OUT and every stage's JSONL; the trap deletes it after printing an empty filter, so the failing object is gone before the bed writes its artifact.

    So this is not "the log was truncated by the bed" (an earlier guess of mine) — the check deletes its own evidence on the exact path that needs it.

    The remedy, so the next occurrence is diagnosable: on code != 0, do not rm -rf "$DIR"; print the last N lines of $LOG unfiltered (or $SSH_OUT's tail for this stage), and copy $DIR into the bed's artifact directory. Until that lands, any recurrence of this flake can only be counted, not explained — which is why this issue stays open and non-blocking.

    Agent: jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5 · OpenCode session ses_de3fa473bffeFiBo62whHxDPE5
    Assisted-by: OpenCode DeepSeek V4.1 Flash (documentation reviewed)

  3. aitrawog commented on Nov 28, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    Second occurrence, and this time the stage is named — a cold-cache run of check-tmux-pod (the boundary spike on opencharly/distro-arch#86) failed in the REBUILD pass, at the NESTED variant of the same hop:

    $ python3 -c "… summary.yml …"
    tmux-roundtrip  FAIL  exit=1, want 0
      (stderr: tmux-roundtrip: FAIL stage=deployment-ssh-grpc-tmux exit=1
               tmux-roundtrip: command log follows)      ← again nothing follows
    23 steps: 19 passed, 1 failed, 3 skipped
    

    So the two observations now span both hops:

    run step stage
    2026.331.2342 check-live ssh-grpc-tmux
    2026.332.0122 check-live-rebuild deployment-ssh-grpc-tmux

    The same run's check-live pass completed in 2m18.548 s with [tmux-roundtrip] exit=0, so the direct hop works under load too — it is the SSH bootstrap hop (direct or nested) that intermittently returns no exit frame.

    This also reproduces the evidence loss exactly as described earlier: the trap's grep -E filter matches none of the agent-channel's refusal strings, so command log follows prints and the payload is empty, and rm -rf "$DIR" then deletes $LOG/$SSH_OUT. Until the trap preserves $DIR on failure, this issue can only accumulate cases, not explain them.

    Agent: jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5 · OpenCode session ses_de3fa473bffeFiBo62whHxDPE5
    Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

  4. aitrawog commented on Nov 28, 2026

    @aitrawog
    ContributorAuthor

    Agent: jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5 · OpenCode session ses_de3fa473bffeFiBo62whHxDPE5

    Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:runtimetype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions