Skip to content

fix(data-science): restore chart/PNG output + sharper LLM handoff#10

Merged
DONGRYEOLLEE1 merged 2 commits into
mainfrom
fix/data-analysis-visualization-handoff
May 21, 2026
Merged

fix(data-science): restore chart/PNG output + sharper LLM handoff#10
DONGRYEOLLEE1 merged 2 commits into
mainfrom
fix/data-analysis-visualization-handoff

Conversation

@DONGRYEOLLEE1
Copy link
Copy Markdown
Owner

Summary

plans/DATA_SCIENCE_ANALYTICS_TEAM_PLAN.md 기능(첨부 → data_science_team → PNG/다운로드)이 사용자 검증에서 일관되게 실패. 룰 베이스 추가 없이 prompt 강화 + 도구 docstring 정밀화 + matplotlib state leak 차단으로 4/5 시나리오 복구.

Root Cause

  1. team supervisor가 data_engineer만 5회 반복 dispatch → data_analyst 미도달 → python_repl_data_tool 미호출 → PNG 0건
  2. LLM이 chat history의 stale absolute path를 pd.read_csv()에 사용 → FileNotFoundError
  3. 다중 turn 누적 matplotlib figure state로 savefig silent no-op
  4. head supervisor가 data 첨부 + 시각화 요청을 coding_team으로 잘못 위임

Fix (Plan §4.0 P1: LLM-Driven, 룰 베이스 금지)

  • DATA_ENGINEER_PROMPT v1.1: ONE-pass inspection only, 차트는 analyst 책임
  • DATA_ANALYST_PROMPT v1.1: file_name 기반 read 강제, artifact_path() 사용, retry policy
  • TEAM_SUPERVISOR_PROMPT v1.4: DATA SCIENCE HANDOFF — engineer→analyst 순서 명시
  • SYSTEM_SUPERVISOR_PROMPT v2.7: data 첨부 + 차트 요청은 MUST data_science_team
  • REVIEWER_PROMPT v1.2: STOPPING RULES — artifact registered → valid, 2 fail → stop
  • python_repl_data_tool: plt.close('all') prelude cleanup + file_name docstring
  • team_supervisor.py: dispatched_workers 요약을 system prompt에 동적 inject (데이터, 룰 X)
  • CLAUDE.md: Supervisor→Sub-agent Handoff 정책 5원칙(P1~P5) + 체크리스트

Verification (dong account, playwright MCP)

ID 입력 결과
S-A trend.csv 시계열 라인차트 trend_revenue.png
S-B products.json category 막대차트 category_avg_price_bar.png
S-C multi_sheet.xlsx sales/costs 비교 revenue_vs_cost_bar.png
S-D sales.csv + metrics.csv 2 서브플롯 sales_region_revenue_and_monthly_mrr.png
S-E korean_sales.csv 한국어 라벨 ⚠️ matplotlib silent savefig (한글 폰트 layout 후속)
  • pytest 316/316 PASS, 회귀 0
  • 모든 차트는 frontend에 <img src=".../attachments/0"> + <a href=...> 다운로드 링크 정상 노출

Test plan

  • pytest 316/316
  • dev S-A/S-B/S-C/S-D PNG + 다운로드 검증
  • CI 통과
  • S-E 한글 폰트 follow-up issue

🤖 Generated with Claude Code

5 시나리오 (S-A~S-E) 검증 중 data_science_team의 시각화/다운로드가 일관되게
실패하던 회귀를 plan §DATA_SCIENCE_ANALYTICS_TEAM_PLAN.md 기반으로 복구.

Root cause:
1. supervisor가 data_engineer만 5회 반복 dispatch → data_analyst의
   python_repl_data_tool 미도달 → PNG 생성 안 됨
2. LLM이 chat history의 stale absolute path를 read_csv에 사용해
   FileNotFoundError
3. 다중 turn 누적 matplotlib figure state로 savefig silent fail
4. head supervisor가 data 첨부 + 시각화 요청을 coding_team으로 잘못 위임
   (TEAM SELECTION HINTS의 `prefer`가 약함)

Fix (룰 베이스 금지, plan §4.0 P1 준수):
- DATA_ENGINEER_PROMPT: ONE-pass inspection + 차트는 data_analyst 책임 명시
- DATA_ANALYST_PROMPT: file_name으로만 read (absolute path 금지) + cwd 보장
  + artifact_path() 사용 강제 + retry policy
- TEAM_SUPERVISOR_PROMPT: DATA SCIENCE TEAM HANDOFF 블록 — engineer 다음은
  항상 analyst, engineer 재dispatch 금지
- SYSTEM_SUPERVISOR_PROMPT: data 첨부 + 차트/시각화 요청은 MUST
  data_science_team (coding_team 우회)
- REVIEWER_PROMPT: STOPPING RULES — artifact registered면 valid, 2번 fail
  후 stop
- python_repl_data_tool: plt.close('all') prelude cleanup으로 cross-turn
  figure state leak 차단 + docstring에 file_name/artifact_path 강조
- team_supervisor.py: dispatched workers 요약을 system prompt에 inject
  (LLM이 history를 직접 본 후 결정 — 룰 아님, 데이터)
- CLAUDE.md: Supervisor → Sub-agent Handoff 정책 5원칙 추가 (P1~P5,
  체크리스트 포함)

Verification (dong 계정, playwright MCP):
- S-A trend.csv 라인차트 → trend_revenue.png PASS
- S-B products.json 막대차트 → category_avg_price_bar.png PASS
- S-C multi_sheet.xlsx 시트 비교 → revenue_vs_cost_bar.png PASS
- S-D sales.csv + metrics.csv 2 서브플롯 → sales_region_revenue_and_monthly_mrr.png PASS
- S-E korean_sales.csv 한국어 라벨 — matplotlib silent savefig fail (한글 폰트
  layout 이슈, separate follow-up)

pytest 316/316 PASS, 회귀 0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
orchagent Ready Ready Preview, Comment May 21, 2026 9:13am
project-vdajw Ready Ready Preview, Comment May 21, 2026 9:13am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant