Stop losing AI messages when a deploy interrupts them - #5069
Open
elias-ba wants to merge 1 commit into
Open
Conversation
Security Review ✅
|
elias-ba
force-pushed
the
timeout-oban-lifecycle
branch
2 times, most recently
from
August 15, 2026 23:39
f742165 to
4cff9e9
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5069 +/- ##
=======================================
- Coverage 90.6% 90.6% -0.0%
=======================================
Files 421 421
Lines 20012 20014 +2
=======================================
- Hits 18137 18134 -3
- Misses 1875 1880 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The handler for Oban's :stop event was written but never attached, so a job cancelled mid-flight told nobody. Its message stayed :processing forever, the panel stayed locked for everyone in that session, and no error was raised. Attaching it needed three other things to be true. It gets its own handler id rather than joining the exception one. :telemetry drops a handler from every event it registered for the first time it raises, so sharing an id would let one bad :stop take Oban exception reporting down with it until the next restart. The lookups become get rather than get!, because :stop fires for every successful job in every queue - the busiest path we have - and a message deleted while its job ran would raise there and trigger exactly that. Both paths are now covered by a test that deletes the message first, since returning at all is what proves the clause is there. The two :circuit events go: Oban has not emitted them since 2.6. The drain window moves from two minutes to six. It was shorter than an AI job's own ceiling, so a deploy landing on a running job killed it after Oban had already stopped the producer that would have reported it - no telemetry at all, which is the one case attaching :stop cannot rescue. Application start now warns if that inverts again. Two log lines drop to warning. Both sat next to a Sentry capture deliberately set to warning, so the error level was raising a second and louder event for something the code had already judged not to be a fault. The new test emits the event instead of calling the handler directly, the way the others do. That is why this was covered and still broken.
elias-ba
force-pushed
the
timeout-oban-lifecycle
branch
from
August 17, 2026 04:10
4cff9e9 to
fe286cd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Oban's
[:oban, :job, :stop]event had no handler attached, so a job that finished without raising was never seen byObanManager. An AI chat message whose job was killed mid-run stayed:processingforever, and the panel stayed spinning.Both events are now attached under their own handler ids. That separation matters:
:telemetrydetaches a handler from every event in anattach_manythe first time it raises, so sharing one id meant a single bad:exceptionpayload could silently take:stopdown with it.The Oban shutdown grace period also went up to 6 minutes, which is longer than the longest an AI job can now run. A deploy that lands mid-answer waits for the answer instead of severing it. There's a startup warning if the two ever drift back out of order.
Closes #__
Validation steps
Lightning.ObanManager.handle_event/4.mix test test/lightning/oban_manager_test.exsAI Usage
Pre-submission checklist