summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 06:56:46 -0300
committerGabriel Schneider <[email protected]>2026-11-20 06:56:46 -0300
commit2c2800c93e5417297dd06d3e52d5d336d975560c (patch)
treea028181f6c0fa1115df2f4862622fefb954a62d5
parentffe05cceb897b3ae6a6d36491f9318a8aa3426e7 (diff)
parent0165bc532446e61a74af604c493d6b354abf798a (diff)
downloadpardes-2c2800c93e5417297dd06d3e52d5d336d975560c.tar.gz
pardes-2c2800c93e5417297dd06d3e52d5d336d975560c.zip
integration: a client that joins during a 9P pty/run replays it as its session does, and a far client's Del question is instant, on the build's second pass: pardes-faults-3 (a 9P open's handle is the session's recorded answer; a run reads its terminal's prompt marks through the tape's prompt site; a rejoin that lands as the session ends says so; Del sets question_asked and the host's pump gives it its time: the step reads no clock, so the bytes soak's one stop off may_wait, now, is gone) and pardes-merge32, merged without a textual conflict; the coordinator's gate in the ledger (reorg/merge33)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
-rw-r--r--core/Core.zig6
-rw-r--r--core/builtins.zig2
-rw-r--r--core/exec.zig2
-rw-r--r--core/keys.zig3
-rw-r--r--core/ninep/pty.zig14
-rw-r--r--core/ninep/tree.zig15
-rw-r--r--core/panes.zig14
-rw-r--r--core/replica.zig223
-rw-r--r--core/tape.zig2
-rw-r--r--runtime/client.zig3
10 files changed, 269 insertions, 15 deletions
diff --git a/core/Core.zig b/core/Core.zig
index a18e891c..da1dc4b8 100644
--- a/core/Core.zig
+++ b/core/Core.zig
@@ -2075,7 +2075,7 @@ pub fn nextWake(p: *const Pardes) ?u64 {
};
// Del's question goes up at the end of its delay: a frame then, and
// none after (stepped time has reached it).
- for (p.panes) |slot| if (slot) |pane| if (pane.prompt == .del_side and pane.question_due_ns > p.clock.stepped_ns) {
+ for (p.panes) |slot| if (slot) |pane| if (pane.prompt == .del_side and pane.question_due_ns > p.clock.stepped_ns and pane.question_due_ns != Pane.question_asked) {
const wait = @max(1, (pane.question_due_ns - p.clock.stepped_ns + frame_ns - 1) / frame_ns);
frames = if (frames) |soonest| @min(soonest, wait) else wait;
};
@@ -2116,6 +2116,10 @@ fn advanceInner(p: *Pardes, now_ns: u64) void {
p.clock.started = true;
p.clock.now_ns = now_ns;
if (!started) p.clock.stepped_ns = now_ns;
+ // Del's question asked since the last advance: its delay from now.
+ for (p.panes) |slot| if (slot) |pane| if (pane.question_due_ns == Pane.question_asked) {
+ pane.question_due_ns = now_ns + config.del_question_delay_ns;
+ };
const frame = frame_ns;
var moving: u32 = 0;
// The session's ticks are the recording session's: a picture still
diff --git a/core/builtins.zig b/core/builtins.zig
index 991f8a76..894478fd 100644
--- a/core/builtins.zig
+++ b/core/builtins.zig
@@ -1040,7 +1040,7 @@ pub const Del = struct {
!c.pane.collapsed and c.pane.prompt == .none)
{
c.pane.prompt = .del_side;
- c.pane.question_due_ns = exec.clockNow(c.p) + config.del_question_delay_ns;
+ c.pane.question_due_ns = Pane.question_asked;
c.p.view().active = c.id;
var rec: [32]u8 = undefined;
pardes.ctlfs.events.notePath(c.p, "ask", std.fmt.bufPrint(&rec, "{d} del k j", .{c.pane.serial}) catch unreachable); // a u32 fits 32
diff --git a/core/exec.zig b/core/exec.zig
index 74037db0..18b519ff 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;
diff --git a/core/keys.zig b/core/keys.zig
index 72e3bb3b..8bfe8315 100644
--- a/core/keys.zig
+++ b/core/keys.zig
@@ -717,6 +717,9 @@ test "the Del question shows only once its delay is up: a quick SPC d j never se
p.update(.{ .key = .{ .cp = 'd' } });
const pane = p.panes[mid].?;
try std.testing.expectEqual(Pane.Prompt.del_side, pane.prompt);
+ // Its time is the next advance's (the host's clock, in its pump).
+ try std.testing.expectEqual(Pane.question_asked, pane.question_due_ns);
+ p.advance(asked_at);
try std.testing.expectEqual(asked_at + config.del_question_delay_ns, pane.question_due_ns);
// Asked, and nothing on the band yet.
_ = try p.render(frame.allocator());
diff --git a/core/ninep/pty.zig b/core/ninep/pty.zig
index 938f3366..4b0cee66 100644
--- a/core/ninep/pty.zig
+++ b/core/ninep/pty.zig
@@ -220,7 +220,7 @@ pub fn writeRun(p: *Pardes, req: Req, id: usize, pane: *Pane) Reply {
for (line) |c| if (c < ' ' and c != '\t') return tree.failText(req.tag, E.INVAL, e_bad_line);
const pf = &pane.fs;
if (pane.terminal == null) return tree.failText(req.tag, E.INVAL, e_bad_line);
- const marks = pardes.Term.prompt(pane.terminal);
+ const marks = marksOf(pane);
if (pane.shell_failed) {
// Its shell never started: no prompt is coming to wait for.
answer(p, slot, "error shell gone", .{});
@@ -288,7 +288,7 @@ pub fn noteMarks(p: *Pardes, id: usize, pane: *Pane) void {
if (pane.terminal == null) return;
const pf = &pane.fs;
const slot = waitingRun(p, pane) orelse return;
- const marks = pardes.Term.prompt(pane.terminal);
+ const marks = marksOf(pane);
if (slot.phase == .waiting) {
if (pf.unmarked) {
answer(p, slot, "error no prompt marks", .{});
@@ -305,7 +305,7 @@ pub fn noteMarks(p: *Pardes, id: usize, pane: *Pane) void {
if (pardes.Term.modes(pane.terminal).alternate) pane.feedOutput(p, "\x1b[?1049l");
p.emitWrite(id, slot.line);
p.emitWrite(id, "\r");
- pane.noteCommand(slot.line);
+ pane.noteCommand(slot.line, marks.started);
// The run is the shell's first command: a greeting `ls` typed at the
// same prompt would run after it, and its C would be taken for ours.
pane.greet = false;
@@ -360,6 +360,14 @@ pub fn noteMarks(p: *Pardes, id: usize, pane: *Pane) void {
finish(p, slot, pane, done.status);
}
+/// The shell's marks as the session's emulator has them (taped), as a
+/// run's step reads them: a screen-state replica's emulator is the last
+/// delta's, which comes at a frame and can be a unit behind the one it
+/// replays.
+fn marksOf(pane: *const Pane) pardes.Term.Prompt {
+ return pardes.tape.value(.prompt, pardes.Term.prompt, .{pane.terminal});
+}
+
/// Answers a run whose command ended with `status`: the header and the
/// output it printed.
fn finish(p: *Pardes, slot: *Run, pane: *Pane, status_code: ?i32) void {
diff --git a/core/ninep/tree.zig b/core/ninep/tree.zig
index 46a4e3d2..1eaaa8cb 100644
--- a/core/ninep/tree.zig
+++ b/core/ninep/tree.zig
@@ -928,9 +928,11 @@ fn open(p: *Pardes, req: Req, target: Target) Reply {
};
},
};
- const i = for (p.fs.opens, 0..) |o, i| {
- if (o.node == 0) break i;
- } else return Reply.fail(req.tag, E.NFILE);
+ // The handle every later request of this open names: the session's 9P
+ // server's, told to a replica as the answer it was. A client joined
+ // since holds none of the opens made before it, and its first free
+ // record would be another than the session's.
+ const i = p.tape.authority(freeOpen, .{p}) orelse return Reply.fail(req.tag, E.NFILE);
const o = &p.fs.opens[i];
o.* = .{ .node = req.node, .what = what };
if (resultsFile(target)) {
@@ -969,6 +971,13 @@ fn open(p: *Pardes, req: Req, target: Target) Reply {
return .{ .tag = req.tag, .handle = @intCast(i + 1) };
}
+/// The first open record free.
+fn freeOpen(p: *Pardes) ?u64 {
+ return for (p.fs.opens, 0..) |o, i| {
+ if (o.node == 0) break i;
+ } else null;
+}
+
/// Tremove closes a pane. Nothing else in the tree can be removed, and this
/// is also where an ORCLOSE open lands, so every node is checked here.
fn remove(p: *Pardes, req: Req) Reply {
diff --git a/core/panes.zig b/core/panes.zig
index 574c697e..1c103bd1 100644
--- a/core/panes.zig
+++ b/core/panes.zig
@@ -53,6 +53,10 @@ pub const Pane = struct {
return @backingInt(id);
}
};
+ /// Del's question asked, its time not had yet: the step that asks
+ /// reads no clock (a far client's would wait on the session's), and
+ /// core time is the last frame's, seconds old in an idle session.
+ pub const question_asked: u64 = std.math.maxInt(u64);
/// The words that throw unsaved text away (builtins.zig warnModified).
pub const Discarding = enum { Exit, Restore, get, Del, Delcol };
@@ -218,7 +222,9 @@ pub const Pane = struct {
repl_enter: u8 = 0,
repl_enter_due_ns: u64 = 0,
/// When Del's question (`del_side`) goes up on the notice band, on the
- /// shell's clock (config.del_question_delay_ns after it was asked).
+ /// shell's clock (config.del_question_delay_ns after it was asked):
+ /// `question_asked` until the next advance, which counts the delay
+ /// from its own time (Core.advance).
question_due_ns: u64 = 0,
/// A question with its answers in it (`repl_choice`).
question: [96]u8 = undefined,
@@ -1026,11 +1032,11 @@ pub const Pane = struct {
/// started, for Kill: it runs from the shell's next C mark to its D.
/// ponytail: of several lines queued for a shell not up yet, only the
/// last is remembered, as the first of them.
- pub fn noteCommand(pane: *Pane, line: []const u8) void {
- const state = pane.terminal orelse return;
+ pub fn noteCommand(pane: *Pane, line: []const u8, started: u32) void {
+ if (pane.terminal == null) return;
const said = std.mem.trim(u8, line, " \t");
const word = said[0 .. std.mem.indexOfAny(u8, said, " \t") orelse said.len];
- var sent: @typeInfo(@FieldType(Pane, "sent_command")).optional.child = .{ .seq = Term.prompt(state).started +% 1 };
+ var sent: @typeInfo(@FieldType(Pane, "sent_command")).optional.child = .{ .seq = started +% 1 };
sent.len = @intCast(@min(word.len, sent.word.len));
@memcpy(sent.word[0..sent.len], word[0..sent.len]);
pane.sent_command = sent;
diff --git a/core/replica.zig b/core/replica.zig
index 82aa5b32..3f92603c 100644
--- a/core/replica.zig
+++ b/core/replica.zig
@@ -2945,6 +2945,17 @@ pub fn readLink(gpa: Allocator, fd: c_int, rest: *Framer, ctx: anytype, comptime
if (!post(ctx, .{ .refused = words })) std.heap.c_allocator.free(words);
}
+/// A join's failure that is its session's end, whenever it came (the
+/// session or its daemon gone, or hung up before the dump was whole): a
+/// client joining again then goes as at a hang-up (`.gone`), in the same
+/// words, never as a join that failed.
+pub fn ended(why: []const u8) bool {
+ const words = std.mem.sliceTo(why, 0);
+ for ([_][]const u8{ "the session hung up", "nothing answers at ", "no session called " }) |w|
+ if (std.mem.startsWith(u8, words, w)) return true;
+ return false;
+}
+
/// The words a client goes with when its session runs another build now.
const upgrade_words = "session upgraded to a newer pardes: upgrade this client too";
@@ -2962,6 +2973,7 @@ pub fn join(gpa: Allocator, j: *Joined, path: []const u8, session: []const u8, o
const t0 = nowNs();
if (old) |prev| {
j.* = redial(gpa, path, session, why, have, prev.diverged == null, j.view) orelse {
+ if (ended(why)) return null;
var words: [600]u8 = undefined;
const said_ = std.mem.sliceTo(why, 0);
@memcpy(words[0..said_.len], said_);
@@ -3570,6 +3582,14 @@ test "a client joining again after a divergence is told at once that its session
const t0 = nowNs();
try std.testing.expect(redial(std.testing.allocator, "/nonexistent/pardes-replica.sock", "gone", &why, null, false, 1) == null);
try std.testing.expect(nowNs() - t0 < 100 * std.time.ns_per_ms);
+ try std.testing.expect(ended(&why));
+ // Its session ending as it joins: hung up before the dump was whole,
+ // its end too, said as the end it is.
+ var fds: [2]c_int = undefined;
+ try std.testing.expectEqual(0, libc.socketpair(libc.AF.UNIX, libc.SOCK.STREAM, 0, &fds));
+ _ = libc.close(fds[1]);
+ try std.testing.expect(joinOn(std.testing.allocator, fds[0], "gone", &why, null, 1) == null);
+ try std.testing.expect(ended(&why));
}
test "a replica's own keys apply at once, confirm on the fast path, and end at the authority's digest" {
@@ -6700,3 +6720,206 @@ test "a far client's replay of a message its session's host stamped takes the se
try agrees(a, r);
try std.testing.expect(try shows(r.core(), "--:--:-- yanked x"));
}
+
+// A script's `pty/run` in a shell (ninep/pty.zig): the open, the line, the
+// marks that end it, its answer read and the open released, each a step of
+// the session's, with a client that joined from a dump taking every unit.
+test "a client joined from a dump takes a 9P pty/run in a shell as the session does: the line sent at the prompt, its end answered" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
+ const gpa = std.testing.allocator;
+ const RunHost = struct {
+ fn taken(_: ?*anyopaque, _: pardes.Pane.Id) bool {
+ return false;
+ }
+ fn write(_: ?*anyopaque, _: pardes.Pane.Id, _: []const u8) void {}
+ const vtable: pardes.Host.VTable = .{ .watched = TestHost.watched, .tty_taken = taken, .pty_write = write };
+ };
+ const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .boot = .tty }, .{ .vtable = &RunHost.vtable }, false);
+ defer a.deinit();
+ const r = try Replica.init(gpa, 1, try a.unit(0, 0), false);
+ defer r.deinit();
+ const shell: u8 = for (a.core.panes, 0..) |slot, id| {
+ if (slot) |pane| if (pane.isTerminal()) break @intCast(id);
+ } else return error.NoShell;
+ const prompt = "\x1b]133;A;cl=line;aid=pardes\x07$ \x1b]133;B;aid=pardes\x07";
+ a.output(.{ .output = .{ .pane = .at(shell), .bytes = prompt ++ "ls\r\n\x1b]133;C;aid=pardes\x07a b\r\n\x1b]133;D;0;aid=pardes\x07" ++ prompt } });
+ r.confirm((try a.pending()).?);
+ r.settle();
+ // A script's listing open, held across the join (a reader of /index).
+ {
+ const was = Stepping.begin(&a.t, null);
+ _ = a.core.serveFs(.{ .tag = 9, .op = .open, .node = @backingInt(pardes.ctlfs.TopFile.index) });
+ was.end();
+ a.seq += 1;
+ r.confirm(try a.unit(0, a.seq));
+ r.settle();
+ }
+ const joined = (try a.join(2, null)).?;
+ defer gpa.free(joined.dump);
+ r.confirm(joined.unit);
+ const late = try Replica.initDump(gpa, 2, joined.view, joined.dump, .{ .cols = 80, .rows = 24 });
+ defer late.deinit();
+ late.t.screen_state = false;
+ late.core().echo = null;
+ try std.testing.expectEqual(joined.digest, late.digest());
+ const node = pardes.ctlfs.Node.of(a.core.panes[shell].?.serial, .pty_run);
+ const Serve = struct {
+ fn serve(s: *Authority, rs: []const *Replica, req: pardes.ctlfs.Req) !pardes.ctlfs.Reply {
+ const was = Stepping.begin(&s.t, null);
+ const reply = s.core.serveFs(req);
+ s.core.pump(s.host) catch {};
+ was.end();
+ s.seq += 1;
+ const u = try s.unit(0, s.seq);
+ for (rs) |x| {
+ x.confirm(u);
+ x.settle();
+ }
+ return reply;
+ }
+ fn output(s: *Authority, rs: []const *Replica, pane: u8, bytes: []const u8) !void {
+ s.output(.{ .output = .{ .pane = .at(pane), .bytes = bytes } });
+ const u = (try s.pending()).?;
+ for (rs) |x| {
+ x.confirm(u);
+ x.settle();
+ }
+ }
+ };
+ const both = [_]*Replica{ r, late };
+ const h = (try Serve.serve(a, &both, .{ .tag = 1, .op = .open, .node = node, .omode = 2 })).handle;
+ _ = try Serve.serve(a, &both, .{ .tag = 2, .op = .write, .node = node, .handle = h, .data = "true\n" });
+ try Serve.output(a, &both, shell, "true\r\n\x1b]133;C;aid=pardes\x07\x1b]133;D;0;aid=pardes\x07" ++ prompt);
+ const answer = try Serve.serve(a, &both, .{ .tag = 3, .op = .read, .node = node, .handle = h, .size = 64 });
+ try std.testing.expectEqualStrings("exit 0\n", a.core.fsPayload(answer));
+ _ = try Serve.serve(a, &both, .{ .tag = 4, .op = .release, .node = node, .handle = h, .opened = true });
+ try Serve.output(a, &both, shell, "\x1b]133;A;cl=line;aid=pardes\x07");
+ try agrees(a, r);
+ try agrees(a, late);
+}
+
+// The same run with the terminals crossing as screen state (a session's
+// clients', until the switch to bytes): a replica's emulator is the
+// deltas', its marks not the session's.
+test "a client of screen-state terminals takes a 9P pty/run in a shell as the session does" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell
+ const gpa = std.testing.allocator;
+ const RunHost = struct {
+ fn taken(_: ?*anyopaque, _: pardes.Pane.Id) bool {
+ return false;
+ }
+ fn write(_: ?*anyopaque, _: pardes.Pane.Id, _: []const u8) void {}
+ const vtable: pardes.Host.VTable = .{ .watched = TestHost.watched, .tty_taken = taken, .pty_write = write };
+ };
+ const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .boot = .tty }, .{ .vtable = &RunHost.vtable }, true);
+ defer a.deinit();
+ var screens: Screens = .init(gpa);
+ defer screens.deinit(a.core);
+ const peer = try screens.addPeer();
+ const r = try Replica.init(gpa, 1, try a.unit(0, 0), true);
+ defer r.deinit();
+ const shell: u8 = for (a.core.panes, 0..) |slot, id| {
+ if (slot) |pane| if (pane.isTerminal()) break @intCast(id);
+ } else return error.NoShell;
+ const Step = struct {
+ var second: ?*Replica = null;
+ fn take(s: *Authority, sc: *Screens, p: u16, x: *Replica, u: []const u8) !void {
+ const gpa_ = std.testing.allocator;
+ const kept = try gpa_.dupe(u8, u);
+ defer gpa_.free(kept);
+ // The unit first, its screens at the frame after (Peers).
+ x.confirm(kept);
+ x.settle();
+ if (second) |y| {
+ y.confirm(kept);
+ y.settle();
+ }
+ try deliver(s, sc, p, x, .flush);
+ if (second) |y| try deliver(s, sc, p + 1, y, .flush);
+ }
+ fn serve(s: *Authority, sc: *Screens, p: u16, x: *Replica, req: pardes.ctlfs.Req) !pardes.ctlfs.Reply {
+ const was = Stepping.begin(&s.t, null);
+ const reply = s.core.serveFs(req);
+ s.core.pump(s.host) catch {};
+ was.end();
+ s.seq += 1;
+ try take(s, sc, p, x, try s.unit(0, s.seq));
+ return reply;
+ }
+ fn output(s: *Authority, sc: *Screens, p: u16, x: *Replica, pane: u8, bytes: []const u8) !void {
+ s.output(.{ .output = .{ .pane = .at(pane), .bytes = bytes } });
+ try take(s, sc, p, x, (try s.pending()).?);
+ }
+ };
+ const prompt = "\x1b]133;A;cl=line;aid=pardes\x07$ \x1b]133;B;aid=pardes\x07";
+ try Step.output(a, &screens, peer, r, shell, prompt ++ "ls\r\n\x1b]133;C;aid=pardes\x07a b\r\n\x1b]133;D;0;aid=pardes\x07" ++ prompt);
+ // A second client joins now, from the session's dump.
+ const joined = (try a.join(2, null)).?;
+ defer gpa.free(joined.dump);
+ try Step.take(a, &screens, peer, r, joined.unit);
+ const late = try Replica.initDump(gpa, 2, joined.view, joined.dump, .{ .cols = 80, .rows = 24 });
+ defer late.deinit();
+ const peer2 = try screens.addPeer();
+ try deliver(a, &screens, peer2, late, .flush);
+ Step.second = late;
+ defer Step.second = null;
+ const node = pardes.ctlfs.Node.of(a.core.panes[shell].?.serial, .pty_run);
+ for (0..2) |_| {
+ const h = (try Step.serve(a, &screens, peer, r, .{ .tag = 1, .op = .open, .node = node, .omode = 2 })).handle;
+ _ = try Step.serve(a, &screens, peer, r, .{ .tag = 2, .op = .write, .node = node, .handle = h, .data = "true\n" });
+ try Step.output(a, &screens, peer, r, shell, "true\r\n\x1b]133;C;aid=pardes\x07\x1b]133;D;0;aid=pardes\x07" ++ prompt);
+ const answer = try Step.serve(a, &screens, peer, r, .{ .tag = 3, .op = .read, .node = node, .handle = h, .size = 64 });
+ try std.testing.expectEqualStrings("exit 0\n", a.core.fsPayload(answer));
+ _ = try Step.serve(a, &screens, peer, r, .{ .tag = 4, .op = .release, .node = node, .handle = h, .opened = true });
+ }
+ try agrees(a, r);
+ try agrees(a, late);
+}
+
+// Del with a pane above and below asks which way the space goes, its
+// question shown once a delay is up (builtins.zig): its time was the
+// host's clock read in the step, an answering entry a speculation stops at.
+test "a far client's Del with panes above and below is applied at once, and its question's time is the session's" {
+ const gpa = std.testing.allocator;
+ const Clocked = struct {
+ var now_ns: u64 = 7 * std.time.ns_per_s;
+ fn now(_: ?*anyopaque) u64 {
+ return now_ns;
+ }
+ const vtable: pardes.Host.VTable = .{ .watched = TestHost.watched, .now = now };
+ };
+ const a = try Authority.init(gpa, .{ .cols = 80, .rows = 30, .file = "mise.toml" }, .{ .vtable = &Clocked.vtable }, false);
+ defer a.deinit();
+ _ = try a.local(.{ .command = "New" });
+ const mid = a.core.view().active;
+ _ = try a.local(.{ .command = "New" });
+ {
+ const was = Stepping.begin(&a.t, null);
+ defer was.end();
+ a.core.view().active = mid;
+ }
+ const r = try joinedFresh(a);
+ defer r.deinit();
+ var sent: std.ArrayListUnmanaged([]u8) = .empty;
+ defer {
+ for (sent.items) |m| gpa.free(m);
+ sent.deinit(gpa);
+ }
+ Clocked.now_ns += std.time.ns_per_s;
+ try key(r, ' ', &sent);
+ try key(r, 'd', &sent);
+ try std.testing.expectEqual(@as(usize, 2), r.applied);
+ try std.testing.expect(r.core().panes[mid].?.prompt == .del_side);
+ for (sent.items) |m| {
+ r.confirm(try a.take(m));
+ r.settle();
+ }
+ try std.testing.expectEqual(@as(u32, 0), r.stats.mispredicted);
+ try agrees(a, r);
+ // The question shows a delay after it was asked, on the session's clock.
+ a.pump();
+ r.confirm((try a.pending()).?);
+ r.settle();
+ try agrees(a, r);
+ try std.testing.expectEqual(Clocked.now_ns + pardes.config.del_question_delay_ns, r.core().panes[mid].?.question_due_ns);
+}
diff --git a/core/tape.zig b/core/tape.zig
index f9303d67..7f28621e 100644
--- a/core/tape.zig
+++ b/core/tape.zig
@@ -161,7 +161,7 @@ pub const results = .{
// Recent's entry for a closed jump, the closed panes' names.
?@import("Store.zig").Record,
?@import("recent.zig").Entry, []const @import("Store.zig").Named,
- @import("Kind.zig").Outcome,
+ @import("Kind.zig").Outcome, pardes.Term.Prompt,
};
/// What a host reports to the core as failed (`shell_failed`, `save_failed`,
diff --git a/runtime/client.zig b/runtime/client.zig
index 544be588..75518552 100644
--- a/runtime/client.zig
+++ b/runtime/client.zig
@@ -174,7 +174,8 @@ pub fn Loop(comptime Frontend: type) type {
}
// The session again, the core it leaves held meanwhile: its
// blobs are not sent again.
- s.r = replica.join(s.gpa, &s.joined, s.dial.path, s.dial.session, s.o, s.have, &s.why, s.r) orelse return .failed;
+ s.r = replica.join(s.gpa, &s.joined, s.dial.path, s.dial.session, s.o, s.have, &s.why, s.r) orelse
+ return if (replica.ended(&s.why)) .gone else .failed;
}
}