Szymon Wilczek sent a patch for write_index_as_tree(), which locks the index with LOCK_DIE_ON_ERROR although the lock is needed only for the optional write-back of the updated cache-tree. A comment next to write_locked_index() already says failing to write the index there is acceptable.

He traces the problem to 356ee4659b (2017), after which try_to_commit() in the sequencer calls write_index_as_tree() in-process. Before that, the die() happened in a git commit child process and the sequencer stopped cleanly with its state saved.

Now, if a background process such as git status holds index.lock when a rebase picks a commit, the rebase dies after the pick has updated the index and written CHERRY_PICK_HEAD, but before it writes rebase-merge/message. git rebase --continue then refuses to run, with the error "you have staged changes in your working tree".

Patrick Steinhardt replied on the thread. The excerpts do not show his position, and the patch is at v1.