Flow
The kinds of change my publisher meets
1Edited or new file
Read it and upload it, same as before.
2Deleted file
Look up its version, then delete it. This is the new part.
3Already gone
Count it as done and move on.
4Renamed file
Probably leaves the old copy behind. Not checked yet.
When the agent deleted a file, the pull request kept it.
A code review pass over one of my side projects caught this, along with a few small bugs that had nothing to do with it. It looks like the agent being careless. It wasn't. The bug was in my code that publishes the agent's work.
How the work leaves the sandbox
The agent works in a throwaway sandbox on its own copy of the repository. Code outside it asks git which files changed since a base commit, reads each one out of the sandbox, and uploads it to a branch. Then it opens a pull request. I still like that setup, because edits and new files come through fine.
Where the deleted path went
Git lists a deleted file as changed, which is correct. But the loop only knew how to read a file and upload it. As far as I can tell, reading a file that's gone failed, so the loop logged a warning and moved on. My guess is the branch started from the main branch, where the file would still have been sitting. So the pull request had all the edits and none of the deletions.
A second question for git
Now the code also asks git for deletions only and checks that list before reading anything. For a deleted file, it looks up the file's current version on the branch, because the host needs that version to delete it.
Deleted files get removed, and everything else is uploaded as before.
If the file is already gone, that counts as done, so running it twice is fine. Other lookup errors get logged and skipped.
The test I still owe
There's no test yet. I want a small one: the agent removes one of two files, and the branch should end up with one.
Skipping errors keeps things moving, but a clean run doesn't prove the branch matches the sandbox anymore.
Renames are what I'm least sure about. I think git lists a moved file only under its new name, which would leave the old copy sitting on the branch right beside the new one.