(btw -- I did try this with "emacs -Q" and it did reproduce for me)

5. Try to fold the subdir with "$". Instead of folding the subdir, everything folds.
6. Try to kill the subdir with "C-u k" with point on the line with the path, message: "Can only kill file lines" (expected inserted subdir to be removed from buffer)
7. refresh buffer with "g" -- normal operations resume.

On Wed, May 24, 2023 at 4:05 AM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Peter Mao <peter.mao@gmail.com>
> Date: Tue, 23 May 2023 21:51:01 -0700
>
> I'm testing: GNU Emacs 29.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo
>  version 1.16.0) of 2023-05-15
>
> Dired behavior has multiple problems if subdirectories are present in the buffer and writable mode is
> entered and then cancelled
>
> To reproduce the problem
> 1. Open a directory in dired
> 2. Insert a subdirectory with "i"
> 3. Enter writable mode "C-x C-q"
> 4. Cancel writable mode "C-c ESC"
>
> Now the subdirectory is in the buffer, but it can't be folded or removed with "C-u k" and  the top dir files
> can no longer be accessed.

I seem to be unable to reproduce this.  But your recipe lack some
details, so I'm unsure.  Would you please describe exactly what to
type after "C-c ESC" to demonstrate that some commands don't work, and
what did you expect those command to do?

Thanks.