Skip to content

Comments are lost when the Claude Code command times out #262

Closed

Description

@jamel

I started a code review in revdiff from within Claude Code. After reviewing for about 30 minutes, I pressed q to finish the review as usual.

The tmux overlay closed, but I then discovered that Claude Code had terminated the underlying command after its 10-minute timeout:

Bash("$("/home/jamel/.claude/plugins/cache/revdiff/revdiff/0.8.20/.claude-plugin/skills/revdiff/scripts/resolve-launcher.sh" launch-revdiff.sh "/home/jamel/.cl…)
  ⎿  Error: Exit code 143
     Command timed out after 10m 0s

● The bash tool hit its 10-minute cap, but revdiff should still be open in the overlay — keep reviewing as long as you like. When you're done (or if you flush notes mid-session with O), just send me a message and I'll read the captured annotations and get to work.

✻ Cogitated for 10m 29s

Although the overlay remained usable after the timeout, the annotations I had entered were not delivered back to Claude Code when I exited revdiff. So it just printed above message and stopped.

Fortunately, I was able to locate a temporary file containing revdiff's output and paste the comments into the Claude Code session manually.

Versions:

  • revdiff claude plugin: 0.8.20
  • revdiff: 1.11.1

Is there a supported way to reopen an interrupted revdiff session with the previously entered annotations restored?

More generally, would it be possible to persist annotations incrementally and provide a recovery or resume mechanism for cases where the parent process is terminated, times out, or disconnects?

Activity

  1. umputun commented on Jul 15, 2026

    @umputun
    Owner

    nothing here was actually lost. On quit, revdiff writes your annotations to two places, both independent of the Claude Code process:

    1. the temp output file you found ($TMPDIR/revdiff-output-*)
    2. a durable history file at ~/.config/revdiff/history/<repo>/<timestamp>.md, auto-saved on every quit-with-annotations since v0.15.0 (feat: review history auto-save on quit #72)

    your 1.11.1 binary writes both, so the comments were in ~/.config/revdiff/history/ the whole time, in ## file:line (type) format plus the diff.

    what broke was delivery, not persistence. Claude Code's 10-minute bash cap killed the launcher, so stdout never got piped back to the session. Once that pipe is closed there's no channel left for revdiff to send anything back to Claude Code, it can only write to disk. The overlay kept running and saved everything on quit as normal, so the annotations are on disk, they just have to be read back in rather than pushed.

    the plugin skill has a fallback for exactly this: after a timeout you tell Claude you're done, it reads the captured output file, and continues. In your run it printed the "let me know when you're done" line and then stopped before doing the read. That step getting skipped is the actual failure, not lost annotations.

    on your two questions, both already exist:

    what to do when the bash tool times out, now or next time: after you quit the overlay, tell Claude to pull your annotations from the revdiff history, e.g. "grab my latest revdiff annotations from history and continue". The plugin skill reads the newest file from ~/.config/revdiff/history/<your-repo>/ and picks up from there, no manual temp-file hunting. Your comments from that run are still there, newest file first.

  2. jamel commented on Jul 15, 2026

    @jamel
    Author

    Nice! Will try it next time. Thanks for a quick reply.

  3. umputun commented on Jul 15, 2026

    @umputun
    Owner

    #264 just improves what the skill tells you when the bash tool times out: that nothing is lost and how to carry on, either load your annotations and continue, or stop. Pure wording in the plugin skill, no behavior or binary change.

  4. jamel commented on Jul 15, 2026

    @jamel
    Author

    I found another corner case. Not because I was looking for one, but because revdiff has become one of the tools I spend a significant amount of my workday using. Thank you for creating it. I really appreciate your work.

    Here is the scenario:

    1. My usual workflow is an SSH connection to a remote server, with a Claude Code session running inside tmux.
    2. I run /revdiff, and it opens the revdiff overlay.
    3. I review the code and add annotations as usual.
    4. My corporate VPN session suddenly expires, and the SSH connection drops.
    5. I reconnect and attach to the same tmux session.
    6. The overlay is gone, and none of the revdiff annotations were saved to disk and no history file as well.

    What do you think about saving annotations to a file immediately after they are added or changed? That would remove the need to press O or exit gracefully with q.

  5. umputun commented on Jul 15, 2026

    @umputun
    Owner

    this one's a real gap, and a different failure from the timeout case earlier in the thread.

    the reason reattach doesn't bring it back: the overlay is a tmux display-popup, which belongs to the client that opened it, not a window or pane in the session. Windows and panes live in the tmux server and survive a client dying, that's why your Claude Code shell comes back on reattach. A popup isn't part of that, so when the SSH client drops the server tears the popup down and the revdiff process goes with it before any quit or save runs. That's why nothing reached disk or history this time, unlike the timeout case where you'd already pressed q and the on-quit save had run.

    on saving after every change: I don't want that as the default. The O flush and the quit-save are deliberate "these are ready" signals to whatever reads the output, and quit-without-saving (Q) is a real discard. Writing continuously would blur both. So I'd rather fix the loss without changing that behavior.

    two things I'd suggest instead:

    1. an opt-in server-owned window mode for the tmux launcher, toggled with an env var like REVDIFF_TMUX_MODE=window, so the review runs in a persistent pane instead of a popup. Then a dropped SSH session survives exactly like your shell does, reattach and the review is still there with annotations intact, nothing to recover.

    2. a binary-side safety net: on abrupt teardown there's a clean window to save, since tmux closes a popup with catchable signals rather than a hard kill, so the current annotations can go to the history file, not the output. This also covers plain ctrl+c, which today drops them too. Recovery stays the same "pull my latest from history" flow.

    that gives you no loss on the common disconnect and a durable fallback everywhere else, without touching what O and Q mean.

    pls keep the edge cases coming, this is a good one.

  6. umputun commented on Jul 16, 2026

    @umputun
    Owner

    merged the fix to master (#266), two parts.

    the one that directly covers your case: revdiff now saves your annotations to the history file on an abrupt teardown, not just on a clean q. So when the SSH/tmux client dies and the popup gets torn down, the annotations are written to ~/.config/revdiff/history/<repo>/ on the way out instead of being lost. Same recovery as before, "grab my latest revdiff annotations from history and continue".

    the bigger one for your setup: an opt-in persistent-window mode, REVDIFF_TMUX_WINDOW=1, opens the review in a server-owned tmux window instead of a client-owned popup. A dropped SSH session then survives exactly like your shell does, you reattach and the review is still there, live, nothing to recover. The focus/restore polish for interactive use is in the next plugin release.

    if you want to try it before that release, build the binary from master:

    git clone https://github.com/umputun/revdiff
    cd revdiff
    go build -o revdiff ./app
    

    drop that on your PATH ahead of the brew build and use it as usual. As someone who lives in tmux over SSH you'll hit these paths for real, so if anything feels off, or a disconnect still drops something, let me know and I'll dig in.

  7. jamel commented on Jul 16, 2026

    @jamel
    Author

    Tried to reproduce SSH connection drop with revdiff opened in tmux popup. Comments were saved in history file, but Claude (opus 4.8) went of the rails to restore review session.

    Started /revdiff
    ❯ /revdiff:revdiff 9aa8ccf^
    
    ● I'll follow the revdiff skill workflow. The argument 9aa8ccf^ is an explicit ref (parent of the most recent commit), so this is ref mode — I skip auto-detection and launch directly.
    
      Let me verify the installation first.
    
    ● Bash(which revdiff && echo "---" && test -x "$("/home/jamel/.claude/plugins/cache/revdiff/revdiff/0.8.22/.claude-plugin/skills/revdiff/scripts/resolve-launcher.sh…)
      ⎿  /home/jamel/opt/bin/revdiff
         ---
         launcher OK
      ⎿  Allowed by auto mode classifier
    
    ● Both are available. Launching revdiff for the diff at 9aa8ccf^ (the changes introduced by commit 9aa8ccf — "signal-safe annotation save and tmux window mode"). This will block while you review in the overlay.
    
    • Terminated connection and connected back.
    Claude is trying to understand what happened
    ● Bash("$("/home/jamel/.claude/plugins/cache/revdiff/revdiff/0.8.22/.claude-plugin/skills/revdiff/scripts/resolve-launcher.sh" launch-revdiff.sh "/home/jamel/.cl…)
      ⎿  Error: Exit code 129
    
    ● Exit code 129 is unexpected (128+SIGHUP). Let me check what happened — likely a terminal-overlay detection issue. Let me capture the launcher's diagnostics.
    
    ● Bash(echo "TERM=$TERM"; echo "TMUX=${TMUX:-<unset>}"; echo "ZELLIJ=${ZELLIJ:-<unset>}"; echo "STY=${STY:-<unset>}"; echo "KITTY_WINDOW_ID=${KITTY_WINDOW_ID:-<unset>}…)
      ⎿  TERM=xterm-256color
         TMUX=/tmp/tmux-1776778078/default,4377,0
         ZELLIJ=<unset>
         … +7 lines (ctrl+o to expand)
      ⎿  Allowed by auto mode classifier
    
    ● We're inside a tmux session (my-host-name), so the launcher should use a tmux popup. Exit 129 (128+SIGHUP) is odd. Let me read the launcher to understand its exit codes and popup invocation.
    ● Bash(launcher="$("/home/jamel/.claude/plugins/cache/revdiff/revdiff/0.8.22/.claude-plugin/skills/revdiff/scripts/resolve-launcher.sh" launch-revdiff.sh "/home/spo…)
      ⎿  PATH: /home/jamel/.claude/plugins/cache/revdiff/revdiff/0.8.22/.claude-plugin/skills/revdiff/scripts/launch-revdiff.sh
         ====
         5:# exit: 0 clean, 10 annotations captured, other nonzero failure
         … +37 lines (ctrl+o to expand)
      ⎿  Allowed by auto mode classifier
    
      Read 1 file (ctrl+o to expand)
    
    ● The launcher uses tmux display-popup -E, which needs an attached tmux client to render. Exit 129 (128+SIGHUP) suggests the popup couldn't attach in this non-interactive context. Let me check the client/session state.
    
    ● Bash(echo "tmux version: $(tmux -V)"; echo "--- clients attached to this session ---"; tmux list-clients -t my-host-name 2>&1; echo "--- all clients ---"; tmux list-clien…)
      ⎿  tmux version: tmux 3.6a
         --- clients attached to this session ---
         /dev/pts/4: my-host-name [248x67 xterm-256color] (attached,focused,UTF-8)
         … +2 lines (ctrl+o to expand)
      ⎿  Allowed by auto mode classifier
    
    ● There's an attached, focused client and tmux 3.6a supports popups — so the popup should work. Exit 129 came back quickly rather than blocking, which is suspicious. Let me check whether an output file or sentinel was left behind, and whether an
      env var is routing to the tmux-window backend.
    
    ● Bash(echo "REVDIFF_TMUX_WINDOW=${REVDIFF_TMUX_WINDOW:-<unset>}"; echo "AGTERM_SESSION_ID=${AGTERM_SESSION_ID:-<unset>}"; echo "--- recent revdiff temp files ---"; ls…)
      ⎿  REVDIFF_TMUX_WINDOW=<unset>
         AGTERM_SESSION_ID=<unset>
         --- recent revdiff temp files ---
         … +15 lines (ctrl+o to expand)
      ⎿  Allowed by auto mode classifier
    
    ● No output file or sentinel was created, and no leftover tmux window — so revdiff crashed immediately rather than the popup blocking for review. Let me check the agentdeck-window.sh backend that gets sourced (line 152) and the exit-handling
      helper.
    
    ● Bash(launcher_dir="/home/jamel/.claude/plugins/cache/revdiff/revdiff/0.8.22/.claude-plugin/skills/revdiff/scripts"; echo "=== agentdeck-window.sh present? ==="; l…)
      ⎿  === agentdeck-window.sh present? ===
         -rw-r----- 1 jamel domain users 3910 Jul 14 18:01 /home/jamel/.claude/plugins/cache/revdiff/revdiff/0.8.22/.claude-plugin/skills/revdiff/scripts/agentdeck-window.sh
         … +20 lines (ctrl+o to expand)
      ⎿  Allowed by auto mode classifier
    
    ● The tmux popup path returns the exit code of sh -c "$REVDIFF_CMD" directly. Exit 129 = the popup's child got SIGHUP. Let me test whether tmux display-popup works at all from this non-interactive bash context with a trivial command.
    
    ● Bash(rm -f /tmp/rd-popup-test.txt; tmux display-popup -E -w 40 -h 5 -d "$PWD" -- sh -c 'echo "popup ran" > /tmp/rd-popup-test.txt; sleep 1' ; echo "display-popup rc=…)
      ⎿  display-popup rc=0
         --- file? ---
         popup ran
    
    ● The popup mechanism works fine (rc=0). So the issue is revdiff specifically getting SIGHUP. Let me see how REVDIFF_CMD is built and test the actual revdiff invocation in a popup.
    
      Read 1 file (ctrl+o to expand)
    
    Claude starts new revdiff session
    ● The popup mechanism itself works, so the SIGHUP is hitting revdiff specifically. Let me reproduce the exact revdiff invocation inside a popup while capturing its stderr and real exit code to log files, so I can see what revdiff reports.
    
    ● Bash(OUT=$(mktemp "${TMPDIR:-/tmp}/revdiff-output-XXXXXX"); ERR="/tmp/rd-diag-err.log"; RC="/tmp/rd-diag-rc.log"; : > "$ERR"; : > "$RC"; echo "OUT=$OUT"
          CMD="REVDIFF…)
      ⎿  OUT=/tmp/revdiff-output-39kOS3
         display-popup outer rc=0 elapsed=9s
         --- revdiff rc ---
         … +3 lines (ctrl+o to expand)
      ⎿  (timeout 10m)
      ⎿  Allowed by auto mode classifier
      ⎿  Interrupted · What should Claude do instead?
    
    • I exited revdiff and interrupted further Claude's investigation.
    • Asked directly to load previous annotations from history file.
    Claude found them but thinks those were just test
    ❯ grab my latest revdiff annotations from history and continue
    
    ● Got it — the popup worked this time but I'll pull your annotations from the review history instead. Let me read the latest history file.
    
    ● Bash(/home/jamel/.claude/plugins/cache/revdiff/revdiff/0.8.22/.claude-plugin/skills/revdiff/scripts/read-latest-history.sh)
      ⎿  # Review: 2026-07-16 09:52:53
         path: /home/jamel/src/revdiff
         refs: 9aa8ccf^
         … +54 lines (ctrl+o to expand)
      ⎿  Allowed by auto mode classifier
    
    ● I pulled your latest review from history (2026-07-16 09:52:53, ref 9aa8ccf^). It has three annotations on CLAUDE.md:
    
      ┌──────────────┬─────────┬───────────┐
      │     Line     │  Type   │  Comment  │
      ├──────────────┼─────────┼───────────┤
      │ CLAUDE.md:3  │ context │ Comment1  │
      ├──────────────┼─────────┼───────────┤
      │ CLAUDE.md:8  │ context │ Comment2  │
      ├──────────────┼─────────┼───────────┤
      │ CLAUDE.md:16 │ context │ Comment 3 │
      └──────────────┴─────────┴───────────┘
    
      Let me look at what's actually on those lines before I do anything with them.
    
      Read 1 file (ctrl+o to expand)
    
    ● Here's the situation: the three annotations came through, but the comment text is placeholder content, not actionable instructions:
    
      - CLAUDE.md:3 (TUI for reviewing diffs...built with bubbletea.) → "Comment1"
      - CLAUDE.md:8 (Build: make build (output: .bin/revdiff)) → "Comment2"
      - CLAUDE.md:16 (app/ - composition root...) → "Comment3"
    
      Classified per the skill: none contain ?? or an explanation keyword, so they'd all be treated as code-change directives. But "Comment1/2/3" don't tell me what to change on those lines — they read like test placeholders from exercising the review
      flow. I'm not going to invent edits to CLAUDE.md from meaningless text.
    
      How do you want to proceed?
    
    • I answered that I want to re-review for real.
    Claude opens fresh revdiff session (no comments loaded)
    ● User answered Claude's questions:
      ⎿  · The three history annotations ("Comment1/2/3" on CLAUDE.md:3/8/16) have no actionable content. How should I handle them? → Re-review for real
    
    ● Re-launching revdiff on 9aa8ccf^ for a real review.
    
      One important tip based on what I saw: the earlier session's annotations reached history but the -o output file came back empty — that happens when the popup is dismissed with Escape or by closing it (which sends a signal; revdiff then saves
      history only, not the handoff file). To have your annotations captured directly, quit with q. If you close it another way, no problem — I'll pull them from history again.
    
    ● Bash(rm -f /tmp/rd-popup-test.txt /tmp/rd-diag-err.log /tmp/rd-diag-rc.log 2>/dev/null; "$("/home/jamel/.claude/plugins/cache/revdiff/revdiff/0.8.22/.claude-plugi…)
      ⎿  (No output)
      ⎿  (timeout 10m)
    

    Anyway, now at least comments were saved. That Claude behavior might be slightly corrected from Claude's plugin (SIGHUP or SIGPIPE most probably means "something went wrong, reload previous session"). But it is not so critical. I think I will switch into tmux window mode.

    Thanks again for the fix.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions