Skip to content

Conversation

@themuffinator
Copy link
Owner

Motivation

  • Reproduce HLIL-observed resource teardown ordering so character profiles are freed only after dependent resources are released.
  • Ensure shutdown diagnostics and bridge cache handling match expected behavior when BotShutdownClient is called for inactive slots.
  • Improve code consistency by adding commented function headers and consistent tab indentation.
  • Prevent stale bridge snapshots from persisting after client shutdown by clearing cached updates for the client slot.

Description

  • Reordered client resource teardown in BotState_FreeResources to free chat state, weapon weights, then item weights before freeing the character via AI_FreeCharacter and updated bookkeeping slots accordingly.
  • Changed BotShutdownClient to emit a clearer warning message and call Bridge_ClearClientSlot for already-shutdown clients, preserving the BLERR_AICLIENTALREADYSHUTDOWN return value.
  • Added commented header blocks above functions (e.g. BotState_ResetCombat, BotState_FreeResources, BotState_AttachCharacter, etc.) and normalized indentation to tabs in src/botlib/interface/bot_state.c.
  • Left bridge cache clearing behavior intact following normal shutdown by ensuring Bridge_SetClientActive and Bridge_ClearClientSlot are invoked in BotShutdownClient.

Testing

  • No automated tests were executed for this change (no test run requested).

Codex Task

@themuffinator themuffinator merged commit d0c46f7 into main Dec 30, 2025
2 of 6 checks passed
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.

2 participants