Repository navigation
fix(server): end every remote run, and make TUI modes and writes explicit - #205
Merged
Merged
Conversation
…icit - A remote run whose runner panicked stayed Running for good: it blocked its user with job-running, counted toward the job cap and kept the CLI polling. The run's outcome is now recorded on every exit, a panic included, and its end time is part of the terminal state. - Writing updates stages every file beside the original before renaming any into place. A staging failure writes nothing; a failed rename names the files already written. The TUI no longer says "Nothing was written" after a partial write, and refreshes its working-tree view. - The TUI's search, help, apply and copier prompts are one Mode, and an update's selected/applied flags are one Pick, so no two can overlap. - A failed token probe after the cron sweep was queued no longer queues the sweep again a minute later.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
count-patchula | 6384610 | Commit Preview URL Branch Preview URL |
Nov 08 2026, 09:41 PM |
This was referenced Nov 8, 2026
… place Review findings on #205: - A start request dropped between recording its job and spawning its task left the job Running for good. The task lock is now taken first, so the record and the spawn happen with no await between them. - A runner that panicked while building its future escaped catch_unwind; it is now called inside the caught future. - An engine whose run panicked was reused by later batches and runs; its slot is now emptied so the next run builds a fresh one. - Staging files beside their originals and renaming them changed owners, ACLs and hard links, made read-only files writable, failed in read-only directories, could leave or clobber temporary files, and collided when two paths named one file. Files are now opened for writing first (any refusal writes nothing, a second path to the same file is refused) and written in place; a failure while writing names the written and partly written files. - A key pressed while a confirmed copier run waits no longer cancels it.
…s one file Second-pass review findings on #205: - Plan::write held every file open until all were written, so a plan touching more files than the open-file limit (256 by default on macOS) could never be written. Files are now checked by opening and closing each, then written one at a time. - Two hard links to one file were both written, the second erasing the first; on Unix the device and inode now decide what is the same file. - A remote run started as shutdown began could spawn after drain took the tasks and escape it; accepting is checked again under the tasks lock.
The write phase reopened each file by path, so a file replaced between the check and the write (renamed away, swapped for a symlink, a pipe or another file) was written instead. Each file must be a regular file, and the reopened file's device and inode must match what was checked, or the write stops before touching it.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second PR that replaces implicit state machines with explicit ones (after #204).
Changes
runner.run(...).awaitreturned, so a panic left the jobRunningforever. That blocked the user withjob-running, counted towardMAX_JOBS, and kept the CLI polling with no deadline. The run is now wrapped incatch_unwind, a panic becomesFailed, andfinished: Option<i64>is folded into the terminal states, so the two can no longer disagree.Plan::writewrites every new file beside its original, copying permissions and resolving symlinks, before renaming any of them into place. A staging failure leaves the tree untouched. A rename that fails partway returns aWriteErrornaming the files already written. The TUI used to say "Nothing was written" after a partial write; it now says what happened and refreshes its working-tree view.Mode(Browse,Searching,Help,ConfirmApply,ConfirmCopier(i),Copier(i)) replacessearching,confirming,confirming_template,copierandhelp.Pick(Open,Selected,Applied) replacesselected+applied./readyznow has a comment explaining why webhooks and remote runs check onlyaccepting: deliveries are queued while the server is unready, because rejecting them would lose them.Tests
New tests cover a panicking runner (the run fails and the user can start another) and a staged write that can't stage every file (nothing written, no temporary files left behind). The
patchula-serverandpatchula-clisuites pass, and Clippy is clean.