Review follow-up on the follow-typing attach.
- Redraw (and every forced resize at an unchanged size) handed the window
back to the terminal: an unchanged pty sends tmux no SIGWINCH, so the
terminal stayed the latest client and the after-resize-window hook undid
the resize-window. Session.resize() now nudges the pty one row first
(FORCED_RESIZE_NUDGE_MS), then applies the size, so tmux counts the tab
as the client used last; the second move bumps the guarded geometry
revision too. Under manual with no attach the agent sees no change.
- With the nudge, client-active[91] alone covers every case, so the
after-resize-window hook is gone. It kept latest through every browser
resize and cost the agent three height changes per resize; now the first
resize after the terminal was used costs two and later ones one. The
cost is stated next to the hook.
- The leak sweep matched owners by tty, and Linux hands the next terminal
the pty that just closed, so the common leak was never swept. The arm
now records the TUI's pid (@codeman-tui-follow-pid), and the sweep keeps
only sessions this process armed (a Set filled before the first write)
or whose pid is another live process. One list-sessions call reads every
owner. It also runs before each attach dresses its sessions, so
`codeman tui <n>` gets it and a leaked hook cannot undo presizeWindow().
- `set-hook -u` on our index left an empty session-level array, which
hides the user's global hook on that event. Disarm unsets the whole
event when ours is its only entry, and arm refuses while the user has a
global client-active hook.
- Arm and disarm are one tmux call to read and one to write (`;` lists).
- Docs: the "forced resize when a browser opens a session" wording was
wrong (selectSession sends no force; only Redraw, a closing pop-out and
the split pane do), fixed in tui-client.ts, docs/tui.md and the
invariants, whose paragraph now stands on its own.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up on the tmux 3.8 dead-pane fix.
- parsePaneRows() skipped a row with a blank pid and pane_dead 0. tmux
blanks the pid when the pty closes, and pane_dead turns 1 only once
the exit status is collected (seconds for some exits on tmux 3.4), so
a restart in that window dropped the session. Only a row with neither
a pid nor a dead flag is skipped now.
- Before tmux 3.7 pane_dead means only that the pty is closed. The kill
read now also reads #{pane_dead_time}, and counts a pane as dead only
with a blank pid or a set exit time, so a program that closed its tty
and ignores SIGHUP is still killed on tmux 3.3a to 3.6.
- Tests pin the last two pane format fields and add a live-pane
counterpart to the dead-pane kill test.
- Changeset notes that finished sessions piled up on 3.8 are relaunched
once at the first start after the update.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After App Settings or Session Options was opened with a mouse click and
closed, nothing typed reached the terminal until it was clicked again.
FocusTrap saved document.activeElement when the dialog opened, and by then
the press had already moved focus: onto the pressed control in Chromium and
Firefox, onto <body> in WebKit on macOS, where a button takes no focus from
the mouse.
FocusTrap.focusToReturn() is what a dialog saves now. A pointerdown listener
records the typing field that had focus when a mouse press began (pointerdown
comes before mousedown, whose default action moves focus), and that field is
the answer when focus sits on the pressed control or on <body> as the dialog
opens. Any key forgets the press, so a control reached with the keyboard gets
focus back as before. Only a typing field is remembered, for one press (a
press on a menu item inherits it from the press that opened the menu) and
only for a mouse, so touch is unchanged. Asking spends the press, so nothing
pressed inside the opening dialog can hand the keyboard to a field behind it.
The command palette and the Session Manager save the same answer.
Measured in Chromium against a running server: App Settings and Session
Options opened by mouse ended on the clicked gear before and in the terminal
after, also with the press clearing focus as WebKit on macOS does, with the
tile grid and the split open (the keyboard returns to the pane it was in),
and through a tile's menu. Not run in WebKit on macOS itself.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A browser that opens a session sends a forced resize at its current size.
Its pty does not change, so tmux keeps the TUI's client as the latest one
and `client-active` never fires again, while Codeman's `resize-window`
still pins the window to `manual` at the browser's size. Typing in the
terminal then did nothing, which is the bug this branch fixes.
An `after-resize-window[91]` hook now puts `latest` back after Codeman's
resize, so tmux keeps deciding by the client used last; `client-active[91]`
stays for Codeman's own attach (`setManualWindowSize()`), which sets
`manual` without a resize.
The owner's tty moves into the session option `@codeman-tui-follow`, and
both hook commands are constants that read it, so no tty is interpolated
into a hook and hooks whose owner is gone do nothing. restore() and the
startup sweep drop the owner first, then our hooks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`codeman tui` sets `window-size latest` for an attach, but a browser tab
that opens or resizes the same session mid-attach makes Codeman run
`resize-window`, which puts the window back on `manual` at the browser's
size. The terminal then showed a phone-sized pane, and typing or pasting
changed nothing until a detach and a fresh attach.
The attach now sets a per-session `client-active[91]` hook on every
session it dresses. It runs `set-window-option window-size latest` only
for the TUI's own client (`#{client_tty}`), so typing, pasting or
resizing the terminal hands the window back to it, the way plain tmux
follows whoever used it last. `restore()` removes the hooks before the
window sizes are put back, and only while they still name this tty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-ups on #840: `#{pane_dead_time}` is stamped in whole seconds,
so two same-status exits in one second read as one; and the changeset tells
users how to remove a dead codeman-* session orphaned before this fix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
killSession() read `#{pane_pid}` and fell back to the recorded pid when
tmux printed none, which tmux 3.8 does for every dead pane. That pid
belongs to the program that exited; the OS may have reused it, and the
kill path walked its process tree and SIGKILLed it. It now reads
`#{pane_dead}` with the pid (parsePaneKillRead) and, for a dead pane,
only runs kill-session. Survivors of an exited program were already out
of reach (reparented, and the group kill only ran for a live leader),
so nothing a live pane gets is lost. Strategies 1 and 2 move into
killPaneProcessTree() unchanged.
Docs: the architecture-invariants paragraph says a kept dead pane is
respawned by the restore at the next server start (measured on tmux
3.8; tmux 3.7 and older always did this), and describes the kill rule.
CLAUDE.md's paneExit rule gains the no-pid warning. The
PaneExitObservation comment no longer claims tmux before 3.4 lacks
`#{pane_dead_time}`, which was never measured.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ledger layout hid every .tab-status to swap the dot for its coloured
bar. The bar is green for idle and working alike, and the spinner is the
dot's own .tab-status.busy::after ring, so a working session showed no
mark at all. A busy cell now keeps the dot and its ring, idle cells stay
bar-only, and an exited agent's cell still hides it like the classic strip.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- _onSessionNeedsRefresh adds the session to _historyReloadDismissed when
the full capture would shrink the buffer and it falls back to ?tail=,
past the ownership guard, so a no-history pane is not re-captured by
the next tap.
- Changeset: scope the note to agent sessions (seen with OMP).
- CLAUDE.md: one warning sentence on the Reload history rules.
- terminal-resilience test reads each whole method instead of a
4,000-character window.
- _historyReloadActionEligible() also requires no terminal load state:
selectSession sets it before switching activeSessionId, so the sync
right after the switch no longer offers Reload for the loading tab.
- _clearTerminalLoadState() re-syncs the action, so a marked tab offers
Reload once its load ends.
- Changeset: note the reading-position fix for live flushes at the
scrollback cap.
- Scrolling pulls tmux history only at the top of the buffer again (#205);
the automatic pull on any upward scroll is removed.
- Reload history lives in the existing #historyTruncationBar on desktop and
touch, shown for a marked non-shell session scrolled away from live output.
It never duplicates Load full history; one × dismisses what the bar carried.
- New per-device setting historyReloadAction (Terminal & Input > Scrolling &
rendering), default on, kept out of SettingsUpdateSchema.
- Eligibility sync is transition-only and onScroll is coalesced per frame.
- Remove the floating #historyReloadBtn and its z-index 20 layer.
- Deferred dropped-output recovery resumes at its saved attempt.
- zh-CN entries for the new strings; docs and changeset updated.
Review follow-up on #815, and the phone case from #814: the gap opens
below a reader who stays scrolled up while output arrives, and the
bottom-only trigger never fired there.
- Open the buffer load before the capture fetch so output arriving during
the download is queued and replayed, not wiped by the reset. Every
non-replay exit flushes the queue. A drop at the 128 KiB cap during an
open load is deferred and resumed when the load ends instead of
spending its retries against it.
- Clear the live-output mark only when the response is
source 'mux-full-history', on the scroll and tab-switch paths.
- Repair on any upward scroll in a marked non-shell session, not only
from the bottom. A content anchor (3-row signature, searched at most
2000 rows either side) keeps the row being read in place; no match
falls back to distance from the bottom.
- Tie replay travel to its session so a tab switch does not swallow
moves on the new tab.
- Reveal the partial-history notice when the initiating gesture
reached the top, even if the anchor moved the viewport off row 0.
- Touch-only Reload history button (#historyReloadBtn), styled in
styles.css so wide touch viewports get it too. Non-touch pages skip
its work entirely.
- Docs, JSDoc and a changeset. Unit tests, and a Playwright browser test
with trusted touch events and real xterm.
Fixes#814
Toolbar Enter spends one-shot Ctrl; Backspace finds the last grapheme with Segments.containing(); accessory Shift+Tab keeps the draft like a typed one.
Pass the captured session to Compose uploads, voice compose and held CJK drafts; clear Ctrl on deletion-only native edits; path picker clears predictions.
Clear xterm dead-key state on native commits; restore a borrowed clipboard field before classifying a key; overlay removeChar spans the pending/flushed boundary.
Place the trackpad caret from the overlay layout (getInputAnchor, committedText) or validated xterm cells, hiding when unproven; no end-minus-width arithmetic.
Grapheme-aware replay Backspace; docs, README rows, changeset and comment updates.
The keyCode-229 recovery diff counts grapheme clusters, matching the overlay and the iOS owner, so one Backspace on a multi-code-point emoji is one DEL.
List xterm-zerolag-input in the changeset; document getInputEndAnchor(), onLayout() and the grapheme unit of removeChar().
The pipeline list said it "runs in this order" but put the no-header
challenge before the HTTP Basic check, while single-user auth.ts checks
the correct password first. Swap steps 3 and 4. Note in the README and
the Security / Remote-Access wiki pages that a request with no
credentials is never counted, and add the patch changeset.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One changeset for everything since 1.51.0: the eleven PRs merged on this
branch, #803's MLX row and #812 already on master, the dead-code cleanup and
the fixes applied while landing. It replaces the eight PR changesets. Patch
until the owner says otherwise.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The DeepSeek Harness web tab trades the dsh web launch token for its session cookie, a relative <base href> resolves against the document's own directory, and root-absolute import("/...") inside scripts is rewritten onto the proxy prefix.
# Conflicts:
# src/web/routes/webview-routes.ts
# test/routes/webview-routes.test.ts
tmux 3.8 prints #{pane_pid} blank once a pane's program has exited.
parsePaneRows() skipped any row without a numeric pid, so the watcher
never saw an exited agent: the session stayed idle with no paneExit and
the clean-exit sweep (#446) never closed it. reconcileSessions() read the
same rows, so at server start such a session's record was dropped while
its tmux session stayed on the socket.
Keep a dead row with no pid (a live one is still a bad read), tell one
exit from the next by #{pane_dead_time} next to the pid, and keep a
tracked session with a dead pane alive with its last known pid. An
untracked one is still not rediscovered: a made-up pid would reach
killSession()'s process-tree walk.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
codeman tui <session> takes a list number or a session name. Digits only
stay a number; anything else matches the session name exactly
(case-sensitive, never a prefix, folder or prompt). Names are not unique,
so two live matches refuse and print their numbers; a name only a RECENT
row carries says the session has finished. The target is resolved before
the TTY check, so scripts get these answers without a terminal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found on a real Android phone (Chrome) and iPhone (Safari) with Send on Enter:
- A swipe that started on the live screen closed the keyboard: the content
touchstart blurred the focused input before the gesture was known to be a
tap or a scroll. It now skips the visible #cjkInput
(_contentTouchStartBlurs()); a real tap still closes it (inert content, a
link, a long press).
- Focusing the field scrolled the terminal off screen: KeyboardHandler's
focusin scrollIntoView({ block: 'center' }) centred the fixed field in its
ancestors. isInputElement() skips #cjkInput like xterm's inputs.
- Android pans the visual viewport to reveal the field (offsetTop 285 in a
458/744 viewport), leaving only the terminal's last line visible. On phones
.app now follows visualViewport.offsetTop while the keyboard is up, and the
fixed bars inside .app are lifted from .app's bottom, so a partial pan does
not lift them twice. Non-phone branches and resetLayout() clear the shift.
- On iOS the first keyboard open reported innerHeight as the visual height
(323 vs 640), zeroing the bars' lift; the layout height is now the larger of
innerHeight and documentElement.clientHeight.
Tests in test/keyboard-handler-pinned-field.test.ts and
test/terminal-touch-tap.test.ts; docs in architecture-invariants and
src/web/CLAUDE.md; changeset sentence.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- selectSession restores the CJK draft after _activateFileBrowserSession,
which test/file-browser-search.test.ts pins right after the
activeSessionId assignment.
- A lone digit while the session has a pending permission_prompt or
elicitation_dialog goes out without the delayed Enter: the dialog acts
on the digit, and the Enter would confirm whatever comes next. Same
rule as the Approvals Inbox and the Discord bridge.
- Changeset mentions the toolbar Enter sending the CJK field.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The WebSocket leg sent the browser's whole Cookie header to a trusted dashboard, including Codeman's own codeman_session, which the dashboard could then replay against the API. Filter it through filterCookieHeader like the HTTP leg, and omit the header when nothing remains.
The HTTP leg puts the server-held dsh credential in front of the browser's own
cookies; the upgrade leg replaced them with it. A managed dsh tab is trusted, so
its other cookies must survive there too. Filter the request the way the HTTP
leg does and merge the credential in front.
Order is the point: a `Cookie` header can name the same cookie twice, and the
first value is the one parsers keep, so appending the credential let a stale
browser copy of the same dsh cookie shadow the one the running process minted -
the tab would come back to the 401 this path exists to prevent. Both legs now
lead with it, and a route-level test asserts the bytes the upstream sees on the
upgrade, not only on the HTTP request.
The root-absolute import("/...") rewrite ran over the whole document, so
visible text such as <pre>import("/x")</pre> was rewritten too. Run the
specifier rewrite per <script> body and leave markup text untouched.
rebaseRelativeBase resolved a relative <base> against the proxy root, so
a document served from a subdirectory of its dashboard (for example
/webview/<cap>/app/page.html with <base href="./">) pointed at
/webview/<cap>/ and loaded its assets one level too high. Pass the
request's wildcard path into rewriteHtml and resolve the base against
the document URL, which keeps the proxy root for the landing page.
The managed DeepSeek tab is trusted, so the browser's own cookies for the
dashboard are forwarded. The injected dsh credential replaced that header
instead of joining it, dropping any other cookie dsh had set. Append the
pair to the filtered browser cookies and leave the rest untouched.
The launch URL comes from the child's output but fetching it is a request
made by the Codeman server, so a banner naming another host or another
local service could aim it. Require 127.0.0.1 and the port just spawned
before the exchange runs, and mark the server as unusable for reuse if
the check fails.
Reuse returned the running server whenever it answered HTTP and matched
the authority, including one whose launch token could not be exchanged
for a cookie. That server answered 401 forever, so the restart the
warning asks for could never happen. Track the failed exchange and skip
reuse, which makes the next start request stop and respawn it.
The banner parser and the boot wait each took the FIRST `dsh web:` match,
so a diagnostic such as `dsh web: loading profiles` printed before the
banner made parsing return null on every poll and boot gave up after four
seconds. Scan every line and take the first payload that parses as an
http(s) URL, and only scan complete lines in the wait loop so a banner
split across two output chunks is waited for instead of being parsed
truncated.