diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-18 14:06:46 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-18 14:06:46 -0500 |
| commit | eeafb35ff25a8fe060fd1f98b51a758bf88e2aa1 (patch) | |
| tree | f403d84ea5e90998dcda199c9f806d6cedd690bc /tests/test-ai-term--quit.el | |
| parent | b426cd089503053fd203a034f3cbbe173252d5c3 (diff) | |
| download | dotemacs-eeafb35ff25a8fe060fd1f98b51a758bf88e2aa1.tar.gz dotemacs-eeafb35ff25a8fe060fd1f98b51a758bf88e2aa1.zip | |
fix(ai-term): key teardown session names off the buffer name
ghostel retargets default-directory via OSC 7 on every cd in the agent shell, so close (and quit with no project argument) computed the wrong aiv- session name after a cd. The kill then missed the real session and orphaned the agent, or hit a different project's session. The buffer name ("agent [basename]") never changes, so teardown now derives the basename from it.
Diffstat (limited to 'tests/test-ai-term--quit.el')
| -rw-r--r-- | tests/test-ai-term--quit.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test-ai-term--quit.el b/tests/test-ai-term--quit.el index 55ace81d..64b8a5d4 100644 --- a/tests/test-ai-term--quit.el +++ b/tests/test-ai-term--quit.el @@ -43,6 +43,22 @@ (should-not (buffer-live-p buf))) (when (buffer-live-p buf) (kill-buffer buf))))) +(ert-deftest test-ai-term-quit-nil-project-from-drifted-agent-buffer () + "Regression: nil PROJECT inside an agent buffer keys off the buffer name. +After a cd in the agent shell, ghostel's OSC 7 tracking moves the buffer's +`default-directory' away from the project, so keying off it would kill the +wrong session and miss the buffer." + (let ((buf (get-buffer-create "agent [realproj]")) + (calls nil)) + (unwind-protect + (test-ai-term-quit--with-tmux calls + (with-current-buffer buf + (setq-local default-directory "/tmp/elsewhere/") + (cj/ai-term-quit)) + (should (member '("kill-session" "-t" "aiv-realproj") calls)) + (should-not (buffer-live-p buf))) + (when (buffer-live-p buf) (kill-buffer buf))))) + (ert-deftest test-ai-term-quit-idempotent-when-gone () "Error/Boundary: a second quit (session + buffer already gone) does not error." (let ((calls nil)) |
