Possible post_edited Event Regression issue?

Discourse Bug Report: :post_edited Event Regression in latest-release

Affects: Discourse latest-release branch (release +122)
Status: Confirmed regression - reproducible
Date: January 15, 2026


Summary

The :post_edited DiscourseEvent stopped being published in recent latest-release builds. Post edits complete successfully and revisions are created, but the event that plugins depend on is never fired. This breaks all plugins using the post_created_edited automation trigger and any other plugins listening to :post_edited events.


Reproduction (Confirmed)

We confirmed this is a regression by testing on two identical Azure AKS environments:

Before Update (Working)

  • Version: v2026.1.0-latest (older build)
  • Behavior: :white_check_mark: :post_edited events fire correctly
  • Automation: :white_check_mark: Works automatically

After Update (Broken)

  • Version: latest-release +1221 hours ago, release +122
  • Behavior: :cross_mark: :post_edited events never fire
  • Automation: :cross_mark: Completely broken

Critical Finding: Both environments worked before update. Both broke after updating to latest-release +122. This definitively proves a regression was introduced.


Environment Details

  • Discourse Version: latest-release (release +122)
  • Rails Version: 8.0.4
  • Infrastructure: Azure Kubernetes Service (AKS)
  • Docker Image: discourse/base:2.0.20260109-0020
  • Deployment: Standard Discourse Docker installation

Test Procedure

Test 1: Event Listener (Proves Event Never Fires)

# In Rails console
File.open('/tmp/post_edited_test.log', 'w') { |f| f.write("Test started at #{Time.now}\n") }

DiscourseEvent.on(:post_edited) do |post, topic_changed, revisor|
  File.open('/tmp/post_edited_test.log', 'a') do |f|
    f.write("[#{Time.now}] :post_edited fired! Post #{post.id}\n")
  end
end

Then edit any post via web interface and check:

cat /tmp/post_edited_test.log

Result on latest-release +122: Only shows “Test started” - event never fires
Result on older build: Shows event entries with timestamps and post IDs

Test 2: Verify Revisions Are Created

post = Post.find(POST_ID)
puts "Post revisions: #{post.revisions.count}"
post.revisions.last(3).each { |rev| puts "  Revision #{rev.number}: #{rev.created_at}" }

Result: Revisions ARE created correctly with proper timestamps
Conclusion: Edits are processed successfully, but post_process_post isn’t being called or event isn’t being triggered

Test 3: Manual Event Trigger (Proves Event System Works)

post = Post.find(POST_ID)
DiscourseEvent.trigger(:post_edited, post, false, PostRevisor.new(post))

Result: Event handlers execute correctly
Conclusion: Event system works, but automatic triggering during edits is broken


Expected Behavior

When a post is edited via web interface:

  1. Edit saves successfully :white_check_mark:
  2. Post revision created :white_check_mark:
  3. PostRevisor#post_process_post is called :cross_mark:
  4. :post_edited event triggered :cross_mark:
  5. Event handlers execute :cross_mark:

Only steps 1-2 work. Steps 3-5 are broken.


Actual Behavior

Production logs show successful edit completion:

Started PUT "/posts/3631" for 88.97.179.124 at 2026-01-15 13:06:19 +0000
Processing by PostsController#update as JSON
Completed 200 OK in 676ms

No errors, no exceptions, but no :post_edited event published.

The event should be triggered in /var/www/discourse/lib/post_revisor.rb line 759:

def post_process_post
  @post.invalidate_oneboxes = true
  @post.trigger_post_process
  DiscourseEvent.trigger(:post_edited, @post, self.topic_changed?, self)
end

This method is called from line 341 but the event is not being fired.


Impact

Affected Official Features

  • Discourse Automation: post_created_edited trigger completely broken
  • Any automation workflows depending on post edits fail silently

Affected Plugins

All plugins listening to :post_edited events are broken:

  • discourse-automation - Official automation triggers
  • discourse-ai - AI moderation on edited posts
  • discourse-doc-categories - Documentation index updates
  • discourse-topic-voting - Vote reclaim workflows
  • Any custom plugins using post edit events

Regression Timeline

  1. Older build: v2026.1.0-latest - :post_edited events worked :white_check_mark:
  2. Updated to: latest-release (release +122) - :post_edited events broken :cross_mark:
  3. Confirmed on: Two separate production environments (both broke after update)

This definitively proves a regression was introduced in recent latest-release builds.


Workaround

Manual triggering via Rails console works:

automation = DiscourseAutomation::Automation.find(AUTOMATION_ID)
post = Post.find(POST_ID)
automation.trigger!({"post" => post})

This confirms the automation system itself works - only automatic event triggering is broken.


Configuration Notes

  • Settings verified: All editing-related settings are standard/default
  • Grace period: Tested with edits well outside grace period (no effect)
  • Plugins: 50 plugins installed (standard official plugins)
  • No core modifications: Clean Discourse installation
  • Environment: Both test environments are identical Azure AKS deployments

Key Evidence

Most Important Finding:

We had a working DEV environment on an older build. After updating to latest-release +122, the automation stopped working. This proves with certainty that a regression was introduced in recent releases.

Both environments now exhibit identical broken behavior after being on the same version.


Reproducibility

100% reproducible - tested on two independent environments:

  1. Install Discourse latest-release (release +122)
  2. Create automation with post_created_edited trigger
  3. Edit a post
  4. Observe automation never triggers
  5. Confirm :post_edited event never fires using test listener

Summary

This is a confirmed regression in latest-release (release +122). The :post_edited event worked in previous versions and stopped working after updating. Two independent environments confirmed the same behavior. This breaks core Discourse Automation functionality and all plugins depending on post edit events.

1 Like

That’s not how DiscourseEvent works - it’s not inter-process but intra-process. So the events are only captured by listeners in the same process as the one that triggered it.

In the case of the discourse automation, I just tested it locally with the following settings

and edited a post and it successfully sent the chat message

Thanks! I will revisit this as clearly I have misunderstood. Hopefully I can get my plugin working with this information. Much appreciated,

Thanks @zogstrip - we also tested by watching production logs while editing via the web interface:

Test procedure:

  1. Cleared automation cooldown via console
  2. Watched logs: tail -f /var/www/discourse/log/production.log | grep "PDF Automation"
  3. Edited a post via web browser (same process as automation)
  4. Result: Edit completes successfully (200 OK), but automation never triggers

We have two identical environments (DEV and PROD on Azure AKS):

  • Before update: DEV automation worked perfectly (log file entries appear)
  • After updating to latest-release (+122): Both DEV and PROD automations stopped working
  • Tested via web interface: Still no automation triggers

Our automation configuration:

  • Trigger: post_created_edited
  • Script: Custom scriptable (run_pdf_generation)
  • Filter: Category ID 34, tag “hd96-24”

Could there be something specific about custom scriptables or our environment that’s preventing the automation from triggering? The fact it worked before the update suggests something changed in how post_created_edited triggers fire.

Could you try with a “simpler” automation that uses the same trigger? Anything potentially related in /logs?

1 Like

Good idea - I’ll create a bare bones example to reproduce the problem and send it I over on Monday. Have a good weekend :slight_smile:

You were absolutely right about the inter-process issue with DiscourseEvent - thank you for that clarification!

After your feedback, we tested properly with a simple send_chat_message automation using the same post_created_edited trigger. When we edited a post, the automation DID trigger (we saw it processing in the logs and got a 500 error due to misconfiguration of the chat settings, not the trigger itself).

This confirms: The post_created_edited trigger works correctly.

Our confusion came from:

  1. Testing with a Rails console listener (wrong - inter-process)
  2. Our custom PDF scriptable was lost during a rebuild and we were having trouble re-registering it persistently

The trigger mechanism itself is functioning as expected. Sorry for the confusion and thank you for the help!

Glad everything’s working as expected :+1:

Now the hard part, root causing why your custom run_pdf_generation script isn’t working anymore :sweat_smile:

1 Like