fix(shell,term): surface PTY errors + guarantee keystroke ordering#938
Open
AgentY-asaf wants to merge 5 commits into
Open
fix(shell,term): surface PTY errors + guarantee keystroke ordering#938AgentY-asaf wants to merge 5 commits into
AgentY-asaf wants to merge 5 commits into
Conversation
Server sends {eventtype:"rpc", data:<RpcMessage>}. Responses use
rpcMsg.resid (not reqid) for correlation; events have rpcMsg.command
=== "eventrecv". Previous script parsed wrong fields so pane.open
never resolved. Also adds 10s RPC timeout to surface hangs.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When PTY open or shell spawn fails (e.g. under memory pressure), write an ANSI-colored error message directly to the blockfile stream so xterm.js renders it immediately. Previously the failure was logged at ERROR level but the user saw only a silent black pane with a cursor. Also adds SPEC_DEAD_TERMINAL_PANE_2026_05_20.md documenting both the PTY-spawn and RT-info-race failure modes with proposed fixes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
|
@codex review |
There was a problem hiding this comment.
ReAgent Diagnostics
| Field | Value |
|---|---|
| ReAgent Version | 5.12.53 |
| Trigger | PR opened |
| Project Context | CLAUDE.md loaded |
| Model | claude-opus-4-7 |
| Effort | high |
| Ref Repos | Enabled (dev-tools, shared-infrastructure) |
| Merge Analysis | 1 regression(s) detected |
| Review Time | 50.5s |
| Timestamp | 2026-05-20T10:34:15Z |
| Repository | agentmuxai/agentmux |
| PR | #938 |
LGTM
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Removes the is_dev gate so portable and installed builds also write authkey.dev to their data dir (~/.agentmux/versions/<v>/data/). bench-term-echo.mjs already searches ~/.agentmux/versions/ so it gains portable discovery with no further changes. Also updates the benchmark error message and adds a mode=dev|portable label to the "Using authkey.dev" output line, and adds SPEC_BENCHMARK_PORTABLE_DISCOVERY_2026_05_20.md documenting the long-session regression testing workflow. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
ReAgent Diagnostics
| Field | Value |
|---|---|
| ReAgent Version | 5.12.53 |
| Trigger | Re-review (new commits) |
| Project Context | CLAUDE.md loaded |
| Model | claude-opus-4-7 |
| Effort | high |
| Ref Repos | Enabled (dev-tools, shared-infrastructure) |
| Merge Analysis | 2 regression(s) detected |
| Review Time | 41.7s |
| Timestamp | 2026-05-20T17:55:41Z |
| Repository | agentmuxai/agentmux |
| PR | #938 |
Issues:
- [P2] tools/tests/bench-term-echo.mjs:110 - mode label conflates installed builds with portable; any path not under
.agentmux/devis labeled "portable" even though installed builds also live under.agentmux/versions/per the spec's portable/installed distinction
Add seq: Option<u64> to CommandBlockInputData. The frontend attaches a monotonically increasing per-TermViewModel counter on every sendDataToController() call. The backend ShellController buffers early-arriving inputs in a BTreeMap reorder buffer and drains in-order, eliminating transposed characters caused by Tokio work-stealing scheduling independent tasks spawned in engine.handle_message(). Spec: docs/specs/SPEC_KEYSTROKE_ORDER_GUARANTEE_2026_05_20.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
ReAgent Diagnostics
| Field | Value |
|---|---|
| ReAgent Version | 5.12.53 |
| Trigger | Re-review (new commits) |
| Project Context | CLAUDE.md loaded |
| Model | claude-opus-4-7 |
| Effort | high |
| Ref Repos | Enabled (dev-tools, shared-infrastructure) |
| Merge Analysis | 3 regression(s) detected |
| Review Time | 56.4s |
| Timestamp | 2026-05-20T18:43:47Z |
| Repository | agentmuxai/agentmux |
| PR | #938 |
Issues:
- [P1] agentmux-srv/src/backend/blockcontroller/shell.rs:1003 - if
try_sendfails on an in-order input,input_seq_nextis not incremented and the input is lost; all subsequent inputs will haves > nextand accumulate in the reorder buffer until it fills, permanently breaking PTY input for that block - [P1] agentmux-srv/src/backend/blockcontroller/shell.rs:1011 - drain loop removes a buffered entry via
remove(&expected)then propagatestry_senderrors with?; on failure the buffered input is consumed/dropped andinput_seq_nextstays at the dropped seq, leaving a permanent hole that wedges sequence ordering - [P2] tools/tests/bench-term-echo.mjs:110 - mode label conflates installed builds with portable; any path not under
.agentmux/devis labeled "portable" even though installed builds also live under.agentmux/versions/per SPEC_BENCHMARK_PORTABLE_DISCOVERY_2026_05_20.md (unaddressed from prior review)
There was a problem hiding this comment.
ReAgent Diagnostics
| Field | Value |
|---|---|
| ReAgent Version | 5.12.53 |
| Trigger | PR edited |
| Project Context | CLAUDE.md loaded |
| Model | claude-opus-4-7 |
| Effort | high |
| Ref Repos | Enabled (dev-tools, shared-infrastructure) |
| Merge Analysis | 3 regression(s) detected |
| Review Time | 91.7s |
| Timestamp | 2026-05-20T18:45:02Z |
| Repository | agentmuxai/agentmux |
| PR | #938 |
Issues:
- [P1] agentmux-srv/src/backend/blockcontroller/shell.rs:177 -
input_seq_nextandinput_seq_bufare only initialized in the constructor and never reset instart(); if the frontend'sTermViewModel.inputSeqresets (page reload, WS reconnect, or new pane mounted to existing block) while the backend controller persists withinput_seq_next > 0, frontend-sent seq values will hit thes < nextbranch and be silently discarded as "duplicates", making the terminal unresponsive - [P2] tools/tests/bench-term-echo.mjs:110 - mode label still conflates installed builds with portable (any path not under
.agentmux/devis labeled "portable" even though installed builds also live under.agentmux/versions/); previously flagged and not addressed
14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three fixes for terminal reliability under load and long sessions:
1. PTY/spawn error propagation (original fix)
2. Portable benchmark discovery
3. Keystroke ordering guarantee (new)
Remaining work
🤖 Generated with Claude Code