From 9d01f004d454ae51fdcfcbea94ec66bb9caf8d3e Mon Sep 17 00:00:00 2001 From: Jeason <1710884619@qq.com> Date: Sun, 19 Apr 2026 16:31:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8kiro=E8=B5=8B=E8=83=BD?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=EF=BC=8C=E4=BC=98=E5=8C=96=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E5=BE=AE=E8=B0=83=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=B9=B6=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E6=95=B0=E6=8D=AE=E8=84=B1=E6=95=8F=E6=9E=B6=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agent-robustness-optimization/tasks.md | 18 +++++++++--------- utils/data_privacy.py | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.kiro/specs/agent-robustness-optimization/tasks.md b/.kiro/specs/agent-robustness-optimization/tasks.md index 141633e..e1c7097 100644 --- a/.kiro/specs/agent-robustness-optimization/tasks.md +++ b/.kiro/specs/agent-robustness-optimization/tasks.md @@ -2,20 +2,20 @@ ## Priority 1: Configuration Foundation -- [ ] 1. Add new config fields to AppConfig - - [-] 1.1 Add `max_data_context_retries` field (default=2) with `APP_MAX_DATA_CONTEXT_RETRIES` env override to `config/app_config.py` - - [-] 1.2 Add `conversation_window_size` field (default=10) with `APP_CONVERSATION_WINDOW_SIZE` env override to `config/app_config.py` - - [-] 1.3 Add `max_parallel_profiles` field (default=4) with `APP_MAX_PARALLEL_PROFILES` env override to `config/app_config.py` +- [x] 1. Add new config fields to AppConfig + - [x] 1.1 Add `max_data_context_retries` field (default=2) with `APP_MAX_DATA_CONTEXT_RETRIES` env override to `config/app_config.py` + - [x] 1.2 Add `conversation_window_size` field (default=10) with `APP_CONVERSATION_WINDOW_SIZE` env override to `config/app_config.py` + - [x] 1.3 Add `max_parallel_profiles` field (default=4) with `APP_MAX_PARALLEL_PROFILES` env override to `config/app_config.py` ## Priority 2: Data Privacy Fallback (R1–R3) - [ ] 2. Implement error classification - - [~] 2.1 Add `_classify_error(error_message: str) -> str` method to `DataAnalysisAgent` in `data_analysis_agent.py` with regex patterns for KeyError, ValueError, NameError, empty DataFrame - - [~] 2.2 Add `_extract_column_from_error(error_message: str) -> Optional[str]` function to `utils/data_privacy.py` - - [~] 2.3 Add `_lookup_column_in_profile(column_name, safe_profile) -> Optional[dict]` function to `utils/data_privacy.py` + - [-] 2.1 Add `_classify_error(error_message: str) -> str` method to `DataAnalysisAgent` in `data_analysis_agent.py` with regex patterns for KeyError, ValueError, NameError, empty DataFrame + - [-] 2.2 Add `_extract_column_from_error(error_message: str) -> Optional[str]` function to `utils/data_privacy.py` + - [-] 2.3 Add `_lookup_column_in_profile(column_name, safe_profile) -> Optional[dict]` function to `utils/data_privacy.py` - [ ] 3. Implement enriched hint generation - - [~] 3.1 Add `generate_enriched_hint(error_message: str, safe_profile: str) -> str` function to `utils/data_privacy.py` - - [~] 3.2 Integrate retry logic into the `analyze()` loop in `data_analysis_agent.py`: add per-round retry counter, call `_classify_error` on failures, generate enriched hint when below retry limit, fall back to normal error handling at limit + - [-] 3.1 Add `generate_enriched_hint(error_message: str, safe_profile: str) -> str` function to `utils/data_privacy.py` + - [-] 3.2 Integrate retry logic into the `analyze()` loop in `data_analysis_agent.py`: add per-round retry counter, call `_classify_error` on failures, generate enriched hint when below retry limit, fall back to normal error handling at limit ## Priority 3: Conversation History Trimming (R4–R5) diff --git a/utils/data_privacy.py b/utils/data_privacy.py index 9c3d921..258016a 100644 --- a/utils/data_privacy.py +++ b/utils/data_privacy.py @@ -12,7 +12,7 @@ import re import pandas as pd -from typing import List +from typing import List, Optional def build_safe_profile(file_paths: list) -> str: