Repository navigation
Conversation
imbajin
left a comment
There was a problem hiding this comment.
Score: 7.5/10 · Confidence: high
Blocking: yes
Summary
Reloading an empty prompt file can retain stale graph settings and prompts instead of built-in defaults.
Evidence
The UI reloads the shared prompt instance; the empty branch resets only five language-dependent fields, leaving prior overrides in instance attributes.
Validation notes
Source-path analysis only; no live UI or external-service test was run.
|
|
||
| if data is None: | ||
| self._set_language_defaults() | ||
| log.info("Prompt file %s is empty; using built-in defaults without writing", yaml_file_path) |
There was a problem hiding this comment.
Reset all prompt overrides on an empty-file reload
When a previously loaded configuration is truncated while the process is running, opening the UI calls this method again on the shared prompt instance. _set_language_defaults() resets only five language-dependent fields, so earlier overrides such as graph_schema, review_graph_prompt, and repair_graph_prompt remain active despite the message that built-in defaults are in use; a subsequent save can write them back. Please reset the persisted fields to their built-in defaults before returning, and cover the populated-to-empty reload.
Problem
This is a bug of empty configure file (corner case).
An empty or comment-only config_prompt.yaml prevents HugeGraph LLM from starting. PyYAML returns None for a file with no YAML data, and the prompt loader raises AttributeError when it tries to read the overrides with .items().
Fix
Use the built-in prompts for the configured language when PyYAML returns
None. Load the defaults in memory and preserve the file contents.Verification
test_resource_mounts.pyandtest_prompt_config.py.Refs #166