Bug: Workbench component reordering is UI-only, does not affect actual LLM prompts #16
Labels
No labels
audit-2025-12-03
component/api
component/commands
component/llm
component/memory
component/tick-loop
component/tools
priority
high
priority
low
status
in-progress
status
needs-info
status
needs-triage
status
on-hold
type
bug
type
documentation
type
enhancement
type
feature
type
refactor
type
test
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
blightbow/evennia_ai#16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The workbench UI allows drag-and-drop reordering of prompt components, but this has no effect on actual LLM prompt assembly. The reordering is cosmetic only.
What Exists
script.db.context_configs[context_type]["component_order"]stores user-defined orderapi/views/mixins/workbench.py:workbench_reorder()saves this orderapi/serializers/workbench.pyuses it to sort components for displaystatic/ai/component_tree.jsenables drag-and-drop reorderingWhat Does NOT Exist
llm_interaction.py:build_llm_messages()ignorescomponent_orderExpected Behavior
When a user reorders components in the workbench UI, the actual LLM prompt should reflect that order.
Actual Behavior
Reordering only affects workbench display. The LLM receives components in a fixed hardcoded order regardless of user settings.
Files Involved
evennia/contrib/base_systems/ai/llm_interaction.py:build_llm_messages()- needs to read and applycomponent_orderevennia/contrib/base_systems/ai/api/views/mixins/workbench.py- already saves order correctlyevennia/contrib/base_systems/ai/api/serializers/workbench.py- already reads order for displaySuggested Fix
Refactor
build_llm_messages()to:component_orderfromscript.db.context_configsFix Implemented
Refactored
build_llm_messages()inllm_interaction.pyto respect user-definedcomponent_orderfrom context configs.Changes
Core fix: Components are now built into a dict by ID, then assembled according to the user-defined
component_orderfromscript.db.context_configs[context_type]["component_order"]Fallback behavior: When no custom order is defined (or the list is empty), components are rendered in default ascending ID order (0, 1000, 1500, 2000, 3000, 4000, 5000)
New tests: Added
test_component_reordering.pywith 9 tests covering:Documentation: Updated context-examples README and coverage_matrix to document component ordering feature
Files Modified
evennia/contrib/base_systems/ai/llm_interaction.py- Refactoredbuild_llm_messages()evennia/contrib/base_systems/ai/tests/test_component_reordering.py- New test fileevennia/contrib/base_systems/ai/docs/context-examples/README.md- Added ordering docsevennia/contrib/base_systems/ai/docs/context-examples/coverage_matrix.md- Added ordering sectionTest Results