summaryrefslogtreecommitdiff
path: root/dev/Inbox.zig
Commit message (Collapse)AuthorAge
* 9P: a request that changes the core waits for the output already read out of ↵Gabriel Schneider5 days
| | | | | | | the ptys before it, as a terminal shows a program's output before what it led to: `cmd | pardes -` typed in a pane writes its pager over 9P after the shell echoed the line and started the command, and the session, which feeds its queue a read a step (dev/tui/tui.zig `takeQueue`), could still hold that echo when the write was served at its next rest (runtime/9p_io.zig `onServe`); the pager's layout then gave the shell's pane its rows as the stale emulator had its cursor (one short), and the emulator's resize cleared the command line as a prompt the shell would draw again (ghostty's Screen.clearPromptForRedraw: the cursor still after `133;B`, the `133;C` not yet fed), which bash, running the command, never did; process-test's `pagercolor` failed so as a pair 7 of 20 pinned to one CPU (a client's keys reach the shell a step each, so its echo comes a key a read: 55 reads queued in a failing run, the write served with seven still to feed) and on the own path 1 of 20 (its keys a burst a step: a read or two); now core/Turn.zig counts the reads (`reads`, by each pty reader as it reads, dev/Inbox.zig `readPty`, beside `unapplied`) and those applied or dropped (`applied`, `outputApplied` from `Inbox.applied`), and `awaitOutput` waits, the turn given up, until every read made before the request is applied, only while the editor waits in its loop (`listening`, set by the new `listen` in the tui's `waitOnce` and the window's `waitInput`, cleared by `wake`): resting in a call of its own (a save through its own mount, core/fs.zig `writeOut`) it applies nothing and the request goes first as before; `onServe` waits so for every request that `needsQuiet` and asks `quiet` after; a user could hit it typing or pasting `cmd | pardes -` in a pane of a session with a client attached, or under load on the own path (the pager open, the command line wiped from the shell's screen); pagercolor pinned to CPU 5 after: as a pair 20 of 20 first time, own path 20 of 20 (before: 13 of 20, 19 of 20); a core test of the rule (`Turn` now in core's test imports); core-test 918/1075 (157 skipped), shell-test 1116/1119 (3 skipped) Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* dev: a command's exit is told only once every read its reader took out of ↵Gabriel Schneider7 days
| | | | | | | the pty is applied: the queue counts each pane's reads read and not yet applied (Inbox.unapplied, raised by the reader the moment a read returns, lowered by Ptys.output once applied, by the reader when its dupe or push fails and by cancelReader for each read it drops), and host_io.takeExits passes over a command whose pty has not ended while its host has such a read (Ptys.unapplied); with it the terminal's guard (takeExits only once the reads taken off the queue were all applied) is deleted, the count holding those too; the test first: Ptys's "a command's exit is told after its output a reader read, however long that waits in the queue" (a reaped command, its pty held open, its last output read and queued) failed on the base, the exit told at once (CommandWatch.due polls the kernel, where the read output no longer is); the run first: process-test's cmdexit alone, 300 times under 16 busy loops, all niced 15 (load 25-33): 3 of 300 drew `exit 0` above BGSTARTED before, 1 of 300 after: what is left is the few instructions between the read's return and the count's raise (a reader preempted on its way back from the syscall), which std.Io gives no way to close (a readiness wait before the read would, and 0.17's Io has none: a raw poll is no cancel point); the exit cannot instead be ordered after the pty's end of file: in the one case that races, what the command left running holds the pty open and the end of file comes only when that ends (cmdexit's `sleep 30`); a user could have hit it: a command that ends leaving a background job on its terminal, its last line drawn below its exit; tui core-test 858/1009 (151 skipped), shell-test 1050/1053, term 17/17, pane 183/184, kitty 45/45; behaviour-test and --replay 275/275 (in the gate, at load 37-50, two addon-test scripts failed and the monkey replay hung a step: both re-run 275/275 and 275/275 at load 25, the two scripts pass alone; addon_test runs no line of this change); process-test whole 1 of 144 failed (pagercolor, on the known list; load 25), in a rerun 2 (pty/run and a control byte through pty/data, both pass alone); soak --clients 5 diverged 0, unequal 0, checked/wrong 1874/0 1937/0 1831/0, quiet checks 597/0 673/0 779/0, unlisted 0, corpus 22 of 22, no leak; --bytes --clients 5 diverged 0, unequal 0, quiet checks 693/0 586/0 802/0, corpus 22 of 22, no leak, its unlisted stop at `now` the base's; gui unit-test 1647/1651 with only BaselineHarnessMismatch; daemon.py plain, --far, --games, --window-clients, --upgrade both ways pass (upgrade failed once at its last Adopt as upgrade-back did in change 1's gate, then 3 of 3) (load 20-50) Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* runtime, dev: the daemon's notes are the session loop's own, so `note` ↵Gabriel Schneider8 days
| | | | | | | leaves the frontend calls (nine to eight: options, open, close, start, sent, upgradeAsked, restoring, restored): the loop's note puts an adopted shell on its queue (both frontends take it in their wait), hands a client's connection to Peers (joined at the next step boundary, its post the wake, as the window did) and wakes the queue for a new daemon's hello; the terminal's deliverNote, its adopted and replica messages and arms (in apply and in Own.close's drain) and the window's deliverNote and both Own.note are deleted, the terminal's Shell names its session loop (`session`) so that a quit before the first frame starts the daemon's reader through the loop's watch; and the test first: an Adopt's shells arriving while output fills the queue were dropped by Inbox.push, their masters closed and the shells lost with them (448 outputs in, the shell and the end of the list pushed, 448 taken), in the window today, and in the terminal once its notes came through this queue (vaxis's queue had made the daemon's thread wait); the queue now keeps room for one Adopt's shells beyond the output's (adopt_capacity, the ring 64 + 1 longer, the output's bound unchanged) and each pane's end of file beyond those; a user could have hit it: Adopt in a window while another pane floods; tui core-test 858/1009 (151 skipped), shell-test 1049/1052, term 17/17, pane 183/184, kitty 45/45, behaviour-test and --replay 275/275, process-test 0 of 144 failed (msg, pagercolor and exec-bigdrag failed once in the run, passed on their retries), soak --clients 5 diverged 0, unequal 0, checked/wrong 1874/0 1937/0 1831/0, quiet checks 597/0 673/0 779/0, unlisted 0, corpus 22 of 22, no leak; --bytes --clients 5 diverged 0, unequal 0, quiet checks 693/0 586/0 802/0, corpus 22 of 22, no leak, its one unlisted stop at `now` the base's; gui unit-test 1646/1650 with only BaselineHarnessMismatch; daemon.py plain, --far, --games (keys stopped 0 and 0), --window-clients, --upgrade both ways pass (load 8-22) Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* dev, runtime: the addons' jobs and draws, the pipes and a search answer ↵Gabriel Schneider8 days
| | | | | | | through the session's one queue in both frontends, and their workers are the queue's: the terminal's own posts to vaxis's queue are deleted (its pipe_done, search_rows and kind_job messages and their arms in apply and in Own.close's drain, deliverSearch, deliverPipe, the two inline deliver functions), its pipe, search, job and draw post with Inbox.pushPipe, pushSearch and pushJob as the window's did and takeQueue lands them; Inbox.land (landLsp grown to every worker's answer: a pipe's, a search's rows, a job's or a draw's, a handover's end) replaces the two frontends' copies of those arms; pipe_tasks and job_tasks leave both Shells and the window's Own for the Inbox beside lsp_task, ended in Inbox.deinit (and so a client's draws in both clients, which the terminal's client never canceled), the pipes canceled by the session loop's Restore and the search's worker by the loop's end, not by each frontend's close and restoring; a terminal client's queue wakes its loop (wakeForQueue) now that its draws come through it; the test first: on the base a search worker's post into vaxis's full queue waited for the loop to take one and a cancel did end it (vaxis's Queue.push waits on a cancelable condition), so no worker could have hung, but the terminal's keys waited behind up to 512 queued batches of rows in that one queue (the input thread's post waits in it too); now rows wait in the session's queue and keys never behind them, pinned by host_io's test of pushSearch into a full queue (a take lets it in, a cancel ends the wait and frees the rows); tui core-test 857/1008 (151 skipped), shell-test 1048/1051, term 17/17, pane 183/184, kitty 45/45, behaviour-test and --replay 275/275, process-test 0 of 144 failed (wheeldrift and exec failed once in the run, passed on their retries), soak --clients 5 diverged 0, unequal 0, checked/wrong 1874/0 1937/0 1831/0, quiet checks 597/0 673/0 779/0, unlisted 0, corpus 22 of 22, no leak; --bytes --clients 5 diverged 0, unequal 0, quiet checks 693/0 586/0 802/0, corpus 22 of 22, no leak, one unlisted stop at `now` at 30 ms (the base's, known); gui unit-test 1645/1649 with only the perf check's BaselineHarnessMismatch; daemon.py plain, --far, --games, --window-clients, --upgrade both ways pass (upgrade-back failed once at its Adopt into the old build's fresh session, then passed 3 of 3) (load 11-22) Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* integration: a session's file watches and its language servers' client once, ↵Gabriel Schneider8 days
|\ | | | | | | | | | | | | on the attach that is always a client: pardes-services-2b (file_watch.Watches owned by the session loop, both frontends' readers deleted; the language client through the session's one queue, the terminal's own copy and its blocking post deleted) and pardes-merge29; one conflict, a doc comment in runtime/session.zig where both sides rewrote the frontend calls' list (the attach's words for note kept, the watched() line dropped: the watches' change deleted that call); tui core-test 856/1007 (151 skipped), shell-test 1047/1050, the window builds; the coordinator's gate in the ledger (reorg/merge30) Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
| * dev, runtime: the language servers' client once, through the session's one ↵Gabriel Schneider8 days
| | | | | | | | | | | | | | queue: both frontends start a query with Inbox.startLsp (its task and its id in the Inbox, an older answer turned away at the push and an older one still queued discarded) and land an answer or a status line with Inbox.landLsp; the session loop sets the language client's status sink on its queue from before the first effects and unsets it before the queue goes, a Restore turns the old core's answer away (discardCompletions, the window's way) and the queue's end cancels the query in flight; the terminal's own copy is deleted (its lsp_task, deliverLspRows posting lsp_done to vaxis's queue, a post that BLOCKED the language worker while that queue was full, lspStatusSink, the lsp_done and lsp_status messages and arms, the cancels in close and restoring) and with it its test of a stale answer at apply (the Inbox's rejection is pinned by gui.zig's worker-setup test); what a user sees: a window now shows an LSP status said during the session's first effects (its sink was set only after them), nothing else; the loop's frontend calls stay nine (close and restoring shrank); tui core-test 857/1007 (150 skipped), shell-test 1046/1049 (-1, the deleted test), term 17/17, pane 183/184, kitty 45/45, behaviour-test and --replay 275/275, process-test 0 of 144 failed (hscroll once in the run, passed on its retry), soaks --clients 5 and --bytes --clients 5 diverged 0, unequal 0, quiet checks 651/0 673/0 779/0 and 920/0 723/0 755/0, unlisted 0, corpus scene 22 of 22, no leak; gui unit-test 1643/1647 with only the perf check's BaselineHarnessMismatch; daemon.py plain, --far, --games, --window-clients, --upgrade both ways pass (load 11-16) Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* | attach: `pardes attach [NAME]` is a client always, from a terminal a ↵Gabriel Schneider8 days
|/ | | | | | | terminal's and from `pardes-gui` a window's, whatever the session was born with (the ruling of 2026-11-17: a session's own frontend is only the one it was born with), and the in-place attach deleted with what only it used (305 lines deleted, 94 added): the daemon's `attach` request and its `find` that chose (runtime/daemon.zig), `daemon.attach` and its `Answer`, `Note.attach`, the stub's second use (`stubWait`'s `child` and its `r`/`x` words, `tellStubExit`), `attachTo`'s two hand-offs and `crossAttach` (runtime/main.zig: a named attach goes straight to the replica socket, where the daemon refuses a name nobody has; a bare one takes the one detached session, else the one session, from the daemon's `list`, else names them: `bareAttach`, with a test), the terminal handed to a session (`attachTerminal`, `refuse`, the `.attach` message and its three arms: dev/tui/tui.zig), the window opened again in place (`openTheWindow`, `Shell.detached`, the queue's `.window` and its arms: dev/gui/gui.zig, dev/Inbox.zig, runtime/macos.zig), and `setState(false)`, which nothing says now (`setDetached`); test/daemon.py's attach cases expect a client (a Detach in its own terminal once, then each attach a client in `--ps`, the session detached still, its Detach exit 1 "let this client go"; the window cycles as window clients, offscreen); tui shell-test 1046/1049 (3 skipped, as the base), core-test 855/1005 (the base's less the deleted `find` test), daemon.py plain passing (gated with the next change) Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* core, dev: what carries a slot across the core's edge carries its type (P21, ↵Gabriel Schneider8 days
| | | | | | | pardes-ids change 3): `Pane.Id` in Event's six variants that carry a pane (output, eof, exited, file_changed, addon, job), in the fourteen effects that do (spawn, write, resize_pty, signal_pty, close_pty, start, save_file, save_text, lsp, watch, dump_themes, detach, addon, job), in the fourteen Host functions that take one (dev/Host.zig: adopt, upgrade, spawn, pty_write, pty_resize, pty_signal, close_pty, tty_taken, fg_name, kill_job, write_file, watch_file, dump_themes, job; tape.zig's Wrap follows with no edit), in the device messages that carry one into the core (the inbox's output and eof and the five reader functions that make them, dev/Lsp.zig's Request, host_io's Adoption and Adoptions.take, which hold what adoptShell answered); `View.Id` in abi/wire.zig's welcome.view (its bytes on the wire unchanged: one byte, hand-encoded, `.at(takeByte())`/`writeByte(view.index())`); every producer converts at its own line (`.pane = .at(id)`, a script that refuses any path outside the workspace, `fields.py`), every consumer where it indexes or compares (`o.pane.index()`), every Host implementer at its own first line (`fn spawn(ctx, id: pardes.Pane.Id, ..) { const pane = id.index(); ..}`: the terminal's 14, the window's 14, the Mac's 10, and the tests' hosts), and an id that went integer and back is passed through whole (`s.core.readerFailed(e.pane, err)`); the compiler caught no pane's slot passed as a view's or the reverse, only integers meeting the type; kept integers on purpose: KindJob.pane (core/Kind.zig, another agent's, reads it four times; converted at KindJob's and Effect's lines), the Watch table (file_watch: its last slot is the theme's, no pane), the hello's view and the replica's Peer/Joined/Replica views (core/replica.zig, another agent's), the C ABI's `pardes_watch_changed(uint8_t pane)` (abi/pardes.h unchanged; runtime/macos.zig converts at its Host functions); in files another agent is in, each conversion on the line that was there: core/Kind.zig 2 lines, core/Addon.zig 4, core/replica.zig 31 (the welcome's view, 3 test hosts, test literals), test/replicas.zig 12 (4 host functions with their first lines, 1 signature, the welcome's view, 5 literals); the tape's shape moves (Event is update's input), so the semantics word moves, c47ecf638b3f4b9f -> 38b5ae573b965550; test/perf.zig follows on 6 lines its Event and effect literals forced, so its harness id moves, be7cc504010471bc -> 1ed95030eb768eae (unit-test's perf check was BaselineHarnessMismatch already); 607 lines added, 562 deleted in 48 files. Gate (load 4 to 8): tui core-test 841/984 (143 skipped), shell-test 1020/1023, term-test 15/15, pane-test 183/184, kitty-test 45/45, behaviour-test 275/275 and --replay 20 seeds of 70 steps, 0 failures, process-test lspcomplete and lspcompletemoved (the base's; hscroll failed once and passed on the runner's retry), gui unit-test 1618/1622 (BaselineHarnessMismatch, the base's); replicas --clients 5 (TMPDIR /tmp/claude-1000/ids): diverged 0, unequal 0 at rtt 30, 80, 207, deltas checked/wrong 1811/0, 1838/0, 1660/0, quiet checks 567/0, 650/0, 655/0, stops not on may_wait 0 (corpus through a client fails at step 21 as on the base with that TMPDIR); daemon.py plain, --far, --games, --window-clients, --upgrade both ways against pardes-tree's base prefix pass (the semantics words differ: the upgrade carries the session by its dump); test/cross_replay.py (tui records, gui replays): 27 digests agree in each of three replicas; rollback-bench runs; the macOS library for Linux and aarch64-macos and the FreeBSD cross-build build; frames (gpu/ids-3 against tree1) 77/77 byte-identical in Debug, unit-test 1618/1622 there, perfab corpus2x -0.021% (session noise 0.036%, threshold 0.4%), pictures identical in all 10 runs, perfops 97 counts within 0.1% (largest image-frame on longline +0.0231%), key-down on medium 10,040,108 -> 10,039,990 an operation (-0.0012%), render on medium 11,455,765 -> 11,455,683 (-0.0007%), terminal on all +0.0030% Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* dev: host_io.zig into its type files (the reorganisation's tree, step 2e): ↵Gabriel Schneider9 days
Host, KindJob, Inbox, Lsp and Shell each a file of its own beside it, their declarations moved as they were (a struct's body is the file's, one indent less), each file importing what it names and host_io.zig naming each (`pub const Shell = @import("Shell.zig")`), so every caller reads as before; Shell's `setenv` is pub, host_io.zig's own code calling it; the tests inside the structs move with them (host_io.Shell.test.* now Shell.test.*); nothing else changes: the ledger, frames byte-identical, replicas and process-test the base's Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T