BUG: Duplicate record_action() call in autonomous.py double-counts actions #35

Open
opened 2026-02-20 14:46:05 +02:00 by Koko210 · 0 comments
Owner

Problem

In bot/utils/autonomous.py, the autonomous_engine.record_action() function is called TWICE for every autonomous action:

  1. Once inside the action execution block (within the if/elif branches)
  2. Once again after the action execution completes (at the end of the function)

This double-records every autonomous action, which:

  • Inflates the rate-limiting cooldown timer (actions appear twice as frequent)
  • Skews the context signals that the autonomous engine uses for decision-making
  • Makes the action history inaccurate for debugging/logging

Expected Behavior

record_action() should be called exactly once per action execution.

Proposed Fix

Remove the duplicate record_action() call. Keep only the one inside the action execution block (which has more specific context about what action was taken), or keep only the one at the end (as a catch-all). Do not call it in both places.

Impact

  • Risk: None — purely a bug fix
  • Effort: Trivial (remove one line)
  • Benefit: Correct rate-limiting and accurate action tracking

Files Affected

  • bot/utils/autonomous.py
## Problem In bot/utils/autonomous.py, the autonomous_engine.record_action() function is called TWICE for every autonomous action: 1. Once inside the action execution block (within the if/elif branches) 2. Once again after the action execution completes (at the end of the function) This double-records every autonomous action, which: - Inflates the rate-limiting cooldown timer (actions appear twice as frequent) - Skews the context signals that the autonomous engine uses for decision-making - Makes the action history inaccurate for debugging/logging ## Expected Behavior record_action() should be called exactly once per action execution. ## Proposed Fix Remove the duplicate record_action() call. Keep only the one inside the action execution block (which has more specific context about what action was taken), or keep only the one at the end (as a catch-all). Do not call it in both places. ## Impact - Risk: None — purely a bug fix - Effort: Trivial (remove one line) - Benefit: Correct rate-limiting and accurate action tracking ## Files Affected - bot/utils/autonomous.py
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Koko210/miku-discord#35