mirror of
https://github.com/langgenius/dify.git
synced 2026-10-04 13:47:55 +08:00
fix(dify-builder): refuse to apply a repair that stages no intents
handle_await_repair offered "Apply the fix" unconditionally, so an empty
staged_repair produced approve -> apply nothing -> retest -> same failure
-> offer again, with no LLM in the loop. ESQ1-291's trace shows five such
approvals, every change set {count: 0, changes: []}.
Adds repair_attempts / last_repair_error to the context (both defaulted,
so persisted contexts deserialize unchanged) and _repair_is_repeating for
the follow-on gate. An empty staged repair is now declined with a decision
the user can act on instead of a run that cannot help.
_repair_is_repeating is also wired in at the point a repair is OFFERED
(the config-failure path in handle_test_and_repair, right after
diagnose()): a third identical failure clears staged_repair and surfaces
a "Repeated failure" card instead of proposing a fourth repair
(ESQ1-285/290 burned nine and six approvals this way).
Also catalogs the two new user-facing literals in core/dify_builder/
strings.py so test_catalog_covers_handler_literals keeps passing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
1b9d301faf
commit
38ef6178a6
4 files changed
+97
No files matched your search
@@ -251,6 +251,11 @@ class DifyBuilderContext:
|
||||
failed_run_id: str = ""
|
||||
diagnosis: Diagnosis | None = None
|
||||
staged_repair: list[MutationIntent] = field(default_factory=list)
|
||||
# Repair-loop convergence. Nothing tracked attempts before, so a repair
|
||||
# that changed nothing could be approved forever (ESQ1-291) and a repair
|
||||
# aimed at the wrong field could thrash indefinitely (ESQ1-285/290).
|
||||
repair_attempts: int = 0
|
||||
last_repair_error: str = ""
|
||||
risk: Risk | None = None
|
||||
change_set: ChangeSet | None = None
|
||||
checkpoint_id: str = ""
|
||||
|
||||
Reference in new issue
Block a user