summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-21 05:26:38 -0300
committerGabriel Schneider <[email protected]>2026-11-21 05:30:39 -0300
commite29ff73bbb2c198afbb894ee98854da2d9a7be7d (patch)
tree17cf56b16272f43fdb789174350681641876e170 /runtime
parent63538d28cee238ff53c731f965c22e615d43bec1 (diff)
parentfe0aa07c18a9fd5ca6bdcb78e9354a2745e32298 (diff)
downloadpardes-e29ff73bbb2c198afbb894ee98854da2d9a7be7d.tar.gz
pardes-e29ff73bbb2c198afbb894ee98854da2d9a7be7d.zip
integration: the pair's finished steps on the gathered line: pardes-pair-4 (`rustnvoo`: an attach handed to a session as it upgrades is told so and joins the new process; the fast start, the boot as input zero: the wire at 27; a window client exec'd at an Upgrade comes back the size it was) and pardes-merge47 (`rprvwpnv`: the terminals' line at 26 and the library for a browser reader); three textual conflicts: abi/wire.zig's history says 27 and 26 each in its own words and the version is 27, test/daemon.py's WIRE is 27, core/replica.zig's Link keeps both lines' fields (the lag bound's `behind`, `least`, `fresh`, `lagged`; the pair's `held`); core-test 885/1045 (160 skipped), shell-test 1087/1090; its gate: .scratch/sketch/reorg/merge48, the numbers in PARDES.md (2026-11-21)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'runtime')
-rw-r--r--runtime/client.zig33
-rw-r--r--runtime/main.zig4
2 files changed, 34 insertions, 3 deletions
diff --git a/runtime/client.zig b/runtime/client.zig
index 55171af2..d4b76a1b 100644
--- a/runtime/client.zig
+++ b/runtime/client.zig
@@ -125,11 +125,14 @@ pub const Ended = union(enum) { done, gone, failed, left, ended: u8, upgrade: u8
/// process's child still), joining for `view` (PARDES_JOIN_VIEW; far,
/// PARDES_REPLICA_FAR). The terminal's blink: no record crosses the exec.
/// Returns only when the exec failed: why.
-pub fn execAgain(s: *Start, view: u8) []const u8 {
+pub fn execAgain(s: *Start, view: u8, size: ?[2]c_int) []const u8 {
const path = upgrade.exe() orelse return "Upgrade: this client does not know the path it was started from";
var at_buf: [4200]u8 = undefined;
const at = std.fmt.bufPrintSentinel(&at_buf, "--attach={s}:{s}", .{ s.dial.path, s.dial.session }, 0) catch return "Upgrade: the session's socket's path is too long to attach again by";
- const argv = [_:null]?[*:0]const u8{ path, at };
+ // A window's new window the size it had (`--geometry`), not the default.
+ var size_buf: [48]u8 = undefined;
+ const geometry: ?[*:0]const u8 = if (size) |wh| (std.fmt.bufPrintSentinel(&size_buf, "--geometry={d}x{d}", .{ wh[0], wh[1] }, 0) catch unreachable).ptr else null; // two c_ints fit 48
+ const argv = [_:null]?[*:0]const u8{ path, at, geometry };
var view_buf: [32]u8 = undefined;
const joining = std.fmt.bufPrintSentinel(&view_buf, "PARDES_JOIN_VIEW={d}", .{view}, 0) catch unreachable; // a u8 fits 32
var n: usize = 0;
@@ -191,7 +194,9 @@ pub fn Loop(comptime Frontend: type) type {
upgrade.locate();
while (true) {
link.reset(s.r, &s.joined);
- l.fe.start(l);
+ if (s.joined.booted) {
+ if (!l.confirm(s)) return .failed;
+ } else l.fe.start(l);
var done: std.atomic.Value(bool) = .init(false);
const reader = try std.Thread.spawn(.{}, read, .{ l, s, &done });
while (!link.quit) {
@@ -232,6 +237,28 @@ pub fn Loop(comptime Frontend: type) type {
}
}
+ /// A pair's first join, its replica its own boot (replica.ownBoot): its
+ /// start's inputs held and its first pass drawn, then the session's
+ /// welcome read: the same core, what was held is sent; another (the
+ /// dump came), the dump's replica in place of the boot's, started
+ /// again. False, and why in `s.why`: no session to go on with.
+ fn confirm(l: *L, s: *Start) bool {
+ const link = &l.link;
+ link.held = .empty;
+ l.fe.start(l);
+ _ = l.before();
+ const r = replica.confirmBoot(s.gpa, &s.joined, s.r, s.o, &s.why) orelse {
+ link.release(s.gpa, false);
+ return false;
+ };
+ link.release(s.gpa, r == s.r);
+ if (r == s.r) return true;
+ s.r = r;
+ link.reset(r, &s.joined);
+ l.fe.start(l);
+ return true;
+ }
+
/// The session's stream, onto the frontend's queue: its messages,
/// and its end.
fn read(l: *L, s: *Start, done: *std.atomic.Value(bool)) void {
diff --git a/runtime/main.zig b/runtime/main.zig
index 0751f6b0..b0338831 100644
--- a/runtime/main.zig
+++ b/runtime/main.zig
@@ -1812,6 +1812,10 @@ fn pair(init: std.process.Init, opts: *pardes.Options, args: []const [:0]const u
var sock_buf: [ninep_io.sun_path_len:0]u8 = undefined;
var o = opts.*;
o.pair = fds[1];
+ // The client makes its core from its session's options (replica.ownBoot):
+ // a window's session is the terminal binary it execs, whose views are
+ // not windowed until a window says so (its first input).
+ o.windowed = false;
clientOf(init, o, daemon.replicaSocket(&sock_buf) orelse "", name, false) catch |err| die(init.io, "{t}", .{err});
std.process.exit(0);
}