Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@terwey
Copy link
Collaborator

@terwey terwey commented Nov 6, 2025

Summary

  • propagate emission failures from the engine so queue workers see missing venue errors instead of silent warnings
  • cover the error propagation with a regression test that exercises a failing emitter implementation

Fixes #83


https://chatgpt.com/codex/tasks/task_e_690beedb3bc48326a7bf01b5ab2a91f9

@terwey terwey marked this pull request as ready for review November 6, 2025 00:52
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 286 to +289
work.BotEvent = *latestEvent
}
if err := e.emitter.Emit(ctx, work); err != nil {
e.logger.Warn("could not submit order", slog.Any("orderid", oid), slog.Any("action", action), slog.String("error", err.Error()))
return fmt.Errorf("emit order %s: %w", oid.Hex(), err)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Returning on emitter failure loses the order on retry

The new Emit error is returned so the work item gets requeued, but processDeal only populates the seen map for events that were newly inserted in this invocation. When the requeued call runs, RecordThreeCommasBotEvent hits the sql.ErrNoRows path and the previously failed order ID is not added to seen, so the loop at the end never calls the emitter again and the order is permanently dropped even if the underlying emitter issue is later resolved. Consider either adding the order to seen before recording it or ensuring requeued invocations re-run reduceOrderEvents for already-stored events so failed emissions can be retried.

Useful? React with 👍 / 👎.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex this is a potentially interesting problem, please investigate what reasons the emitter.Emit could have why it could return an error. My suspicion is that it got rejected, we should just simply handle the error then.
The event would replay anyway on next run, so would simply be throwing another error (as opposed to now logging another).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

  • Pre-populated the seen map with actionable bot events before persisting so that requeued work items re-run reduceOrderEvents after an emission failure. engine/engine.goL239-L256

Testing

  • ⚠️ go test ./engine (interrupted after hanging locally).

View task →

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug 83: Unvalidated Venue Emission Can Fail Silently

2 participants