From e1a47cef599070e3ea268255ef4c1164e4a3169b Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 20 Nov 2026 04:21:37 -0300 Subject: ninep: a client attached while a script's pty/run runs in a shell replays it as its session does: the open's handle is the session's 9P server's answer (tape.authority), not the client's first free open record, which a client joined since (holding none of the opens made before its join) chose otherwise, so its write named no record and its run never went (the base, the attach agent's probe: 6 of 6 runs a client diverged, "the core called prompt where the tape has a done"); and a run's step reads the shell's marks through the tape's prompt site (pty.marksOf, as the greeting and the run's answer did), not the emulator here, which on a client of screen-state terminals is the last delta's and comes a frame after the unit that replays the output (with the handle alone 3 of 6 still diverged: sent_command's count and the busy check read marks behind the session's); Pane.noteCommand takes the count from its caller; a client whose rejoin lands as its session ends goes as at a hang-up, in the same words ("let this client go"), never "could not join again: the session hung up before the dump was whole" (replica.ended: hung up, nothing answers, no such session); tests: a client joined from a dump with a listing open held across the join takes a run as the session does (failed on the base: its digest), the same with screen-state terminals and their deltas after each unit (failed with the handle fix alone: "the core did not make the host call the tape has, in output"), and the rejoin test says a session gone and one hung up mid-dump are its end; the tape's results list Term.Prompt, so the semantics word moves: 7a610621b2f37456 -> 92963bab2e4436fb; probe (exitclient.py, 6 runs): 0 of 6 diverge, 0 of 3 with a digest every unit (PARDES_REPLICA_TRACE); a pty/data-only variant diverged 0 of 2 on this build too; tui core-test 856/1009 (153 skipped: the two new tests need a shell), shell-test 1049/1052 (load 15-20) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/exec.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/exec.zig') diff --git a/core/exec.zig b/core/exec.zig index 1ec47eb3..d077789b 100644 --- a/core/exec.zig +++ b/core/exec.zig @@ -708,7 +708,7 @@ pub fn executeFrom(p: *Pardes, id: usize, txt: []const u8, from_body: bool) ?usi const pad = std.math.clamp(max_row - cursor_abs, 0, @as(i32, pane.rows)); for (0..@intCast(pad)) |_| p.emitWrite(id, "\r"); }; - pane.noteCommand(cmd); + pane.noteCommand(cmd, panes.Term.prompt(pane.terminal).started); if (pane.queuePendingCommand(cmd) catch |err| { p.reportError(.at(id), "queue command", err); return id; -- cgit v1.3