This commit is contained in:
Evan 2026-08-15 09:12:17 +08:00 committed by GitHub
commit f6fb598668
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 8 deletions

View File

@ -812,10 +812,13 @@ class AdvancedChatAppGenerateTaskPipeline(GraphRuntimeStateSupport):
reason=QueueMessageReplaceEvent.MessageReplaceReason.OUTPUT_MODERATION,
)
# Save message unless it has already been persisted on pause.
if not self._message_saved_on_pause:
with self._database_session() as session:
self._save_message(session=session, graph_runtime_state=resolved_state)
# Always save the final message state, even if it was already persisted on pause.
# The message may have been saved with PAUSED status and empty answer during a
# previous pause event — on completion, _save_message transitions PAUSED→NORMAL
# and writes the final answer. _save_message is idempotent (SELECT + UPDATE by
# message_id), so calling it multiple times is safe.
with self._database_session() as session:
self._save_message(session=session, graph_runtime_state=resolved_state)
yield self._message_end_to_stream_response()

View File

@ -69,7 +69,6 @@ from graphon.nodes.llm.exc import (
InvalidContextStructureError,
LLMNodeError,
NoPromptFoundError,
VariableNotFoundError,
)
from graphon.nodes.llm.file_saver import LLMFileSaver
from graphon.nodes.llm.node import (
@ -922,7 +921,7 @@ def test_fetch_jinja_inputs_serializes_supported_segment_types(llm_node):
}
def test_fetch_jinja_inputs_raises_for_missing_variable(llm_node):
def test_fetch_jinja_inputs_skips_missing_variable(llm_node):
node_data = llm_node.node_data.model_copy(
update={
"prompt_config": PromptConfig(
@ -931,8 +930,8 @@ def test_fetch_jinja_inputs_raises_for_missing_variable(llm_node):
}
)
with pytest.raises(VariableNotFoundError, match="Variable missing not found"):
llm_node._fetch_jinja_inputs(node_data)
result = llm_node._fetch_jinja_inputs(node_data)
assert result == {}
def test_fetch_inputs_collects_prompt_and_memory_variables(llm_node):