Skip to content

Instantly share code, notes, and snippets.

@dmitriid
Last active June 29, 2025 19:15
Show Gist options
  • Save dmitriid/6e7aa6efd35c1516bb42bf10430fe6c7 to your computer and use it in GitHub Desktop.
Save dmitriid/6e7aa6efd35c1516bb42bf10430fe6c7 to your computer and use it in GitHub Desktop.
phoenix.new "death loop"

I have both handle_event and handle_info handlers which pattern match on certain payloads

The problem mostly manifests in handle_info where (for better or for worse) I end up matching more deeply

Below are diffs directly from phoenix.new (note: phoenix.new tends to "spam" commits which makes the problem slightly worse: you end up with a lot of commits that may contain wildly invalid code)

-  def handle_info(%{event: "play_now", payload: %{song: song}}, socket) do
+  def handle_info(%{event: "play_now", payload: %{}, socket) do

-  def handle_info(%{event: "song_updated", payload: song}, socket) do
+  def handle_info(%{event: "song_updated", payload: %{

# it's possible that I pushed invalid code, but it never got fixed
-  def handle_info(%{event: "song_added", payload: %}}, socket) do
+  def handle_info(%{event: "song_adde}, socket) do

I think there several issues at play (pure speculation on my part):

  • the agent doesn't really understand mix compile errors, or from whichever tool provides info on syntax errors, and cannot pinpoint the source
  • the agent has the disadvantage of working with an already established codebase and loses/cannot figure out context
  • like any opther agent it optimises random local changes instead of stepping back and re-analyzing. E.g. stopping the death loop and writing this prompt fixed the code:
stop random changes. analyze thoroughly and fix once and for all. you're not allowed to edit a file more than once 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment