Keep repair context across agent retries
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-08-27 20:02:47 +02:00
parent e90db58194
commit dd86d8cd2d
3 changed files with 64 additions and 4 deletions

View File

@@ -54,12 +54,53 @@ def test_redact_removes_extended_credentials() -> None:
def test_retry_task_contains_failure_without_secrets() -> None:
task = build_retry_task(RuntimeError("Missing import; token=secret-value"))
report = FailureReport(
id=8,
chat_message_id=1,
source="user_feedback",
category="incorrect_answer",
user_feedback="Wrong result",
feedback_type="wrong_result",
expected_behavior="Use a weighted average",
prompt="Average sale price",
response="Zero",
sql_query="SELECT AVG(list_price)",
error_message=None,
context={"database_type": "erp"},
)
task = build_retry_task(report, RuntimeError("Missing import; token=secret-value"))
assert "Missing import" in task
assert "secret-value" not in task
assert "Do not remove or weaken tests" in task
assert "unrelated production routing" in task
assert "Use a weighted average" in task
assert "SELECT AVG(list_price)" in task
def test_incorrect_answer_task_guides_semantics_level_repair() -> None:
report = FailureReport(
id=42,
chat_message_id=1,
source="user_feedback",
category="incorrect_answer",
user_feedback="Wrong result",
feedback_type="wrong_result",
expected_behavior="Sum net values and divide by quantity",
prompt="Average sale price for article 9031",
response="0.00",
sql_query="SELECT AVG(Vk_preis) FROM FK_Artikel",
error_message=None,
context={"database_type": "erp"},
)
task = build_task(report)
assert "config/*_semantics.php" in task
assert "Do not hardcode" in task
assert "protected schema/business-" in task
assert "context builder" in task
assert "known-bad SQL" in task
def test_customer_database_task_explains_tenant_scope() -> None: