Repository navigation
fix(ui): keep the files of an edit in a directory removed on exit - #216
Merged
Merged
Conversation
ingvarch
enabled auto-merge (rebase)
November 9, 2026 22:21
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.
What changes
The file urga opens in the editor can hold a job spec, node meta, a namespace or a variable's values. Before, it stayed in the system temp directory when urga exited with the editor open. Now each run of urga makes its own directory,
urga-<number>in the temp directory (mode 0700). Every edit file goes there, and urga removes the directory with everything in it on exit.cmd/urgamakes the directory before the program starts and removes it afterRunreturns, also when it returns an error (inEditDir). It passes the directory inui.Options.EditDir.cmd/urganow ends the program on SIGHUP throughtea.WithContext.Runreturns, the session is saved, and the directory is removed. The error printed isurga: hangup signal received.startEditreturns), not when the resource is read. An edit dropped on its way, for example when the screen changed or urga quit before the read came back, now writes no file, soeditFileMsg.release()is gone.keepLate), not left in the edit directory.What I saw against the dev agent (
TMPDIRset to a test directory,EDITOR=vim,eon jobweb):tmux kill-sessionwith the editor open (SIGHUP) killed urga and vim and lefturga-3510826525.hclin the temp directory.kill -TERMwith the editor open does nothing until the editor closes. Bubble Tea ignores signals while another program has the terminal. After:q!the file is removed as usual, andqexits.tmux kill-sessionwith the editor open leaves nothing namedurga-*. Neither doeskill -HUPsent only to urga: urga ends once the editor closes. vim's swap file went into the run directory and was removed with it.Not as the issue planned: it said
writeTemphas one caller.keepTextcalls it too, for text that must survive the exit. So that text stays in the system temp directory, and only edit files go to the run directory.Issues
Closes #200
Checklist
make checkis greendocs/is updated if users see a differencefeat(ui): ...,fix(nomad): ...