phoenix.new not cloning down new commits after reset

I had two different chats going in phoenix.new, as I didn’t like my first approach. But somehow, the second chat saw code from the first one. I assumed they would operate on independent repos. I agreed to have it _reset and start over_.

I have since burned through $60 within about 24 hours and am getting tired to keep paying $20 every few hours, as it starts to really add up fast.

I tried cloning down the repos from both chats into new directories, and I do see some git commits. But they are all old, from last night, and don’t include any of the about 20 commits since then, that AI has since created.

After going back and forth with support many times and not really getting anywhere, I was finally able to troubleshoot and fix the issue myself, based on: Phoenix.new - Local git clone doesn't include changes after starting app generation over - #19 by chrislaskey

My Problem

I created a new chat in phoenix.new, but the AI agent got confused when it saw an existing phoenix web server already running with a different app title. The AI prompted me to start over again (I don’t remember the exact wording, but it basically deleted everything and started from scratch again.). I agreed (as I was new to phoenix.new, and was just vibe coding, and was very unfamiliar with the architectural setup of phoenix.new, if and how different threads would interfere with each other or not, etc. (As I later found out by digging around, each chat creates a new directory with it’s own git repo once the AI agent starts building the app. But the phoenix server always runs on the same port, and when switching from one chat to another, it doesn’t shut down the old server.))

When cloning the repo to a new directory on my local computer and then switching into it, I only saw the old git commits from before the AI agent had started over again. But none of the new ones!

Problem Verified

The agent terminal app directory has a git repo with a remote to a bare git repo, which is used as an intermediate to sync the code to your local computer. You can see it with from the agent terminal with:

git remote -v

Looking at the age of the bare repo for this broken agent terminal directory confirmed that it’s old:

ls -l /root/git/watch_watch.git/objects/ | head -n 2

I then noticed that there was no git commit hook for my broken agent repo:

ls -l .git/hooks/ | grep -v sample

But looking at some of my other workspace directories with git repos shows that they do have a “post-commit” hook!

Fix 1

Copy the missing post-commit hook over from another chat (in this example, it’s called “foo”):

cp ../foo/.git/hooks/post-commit .git/hooks/

Verify

I then made a change to a file, saved it, and committed it in git:

git commit -am "test"

and received following error:

Auto-pushingaftercommit...
To/root/git/watch_watch.git
 ! [rejected]        HEAD -> main (fetch first)
error: failed to push some refs to '/root/git/watch_watch.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
[main 123abcd] update number of commits
 1 file changed, 1 insertion(+), 1 deletion(-)

Fix 2

I then force pushed to that bare repo:

git push --force fly main

Successful Cloning

I was now able to successfully clone the repo to my local computer, although the token had expired, which forced me to start over with a new directory, although I assume I could have updated the remote URL:

git remote set-url fly URL_from_clone_command