Skip to content

feat(plugin): render session impact report in stop hook#1071

Merged
JeremyDev87 merged 1 commit into
masterfrom
feat/1064-stop-hook-impact-report
Mar 28, 2026
Merged

feat(plugin): render session impact report in stop hook#1071
JeremyDev87 merged 1 commit into
masterfrom
feat/1064-stop-hook-impact-report

Conversation

@JeremyDev87

Copy link
Copy Markdown
Owner

Summary

  • Add _render_impact_report(session_id, project_dir) to stop hook that reads impact-events.jsonl directly (MCP server may already be stopping)
  • Aggregates events and renders box-formatted report: issues prevented (by domain), agents dispatched, checklists applied, mode transitions
  • Only shown for sessions >= 30s with at least 1 impact event; all errors wrapped in try-except

Test plan

  • Unit test: function returns correct box with sample JSONL events
  • Unit test: returns empty string when no matching session
  • Unit test: returns empty string when JSONL file missing
  • typecheck passes
  • 5326/5329 tests pass (1 pre-existing TUI test failure unrelated to this change)

Closes #1064

Add _render_impact_report() that reads impact-events.jsonl directly
(MCP server may already be stopping) and renders a box-formatted
summary of issues prevented, agents dispatched, checklists applied,
and mode transitions. Only shown for sessions >= 30s with at least
one impact event. All errors wrapped in try-except to never block
session stop.

Closes #1064
@vercel

vercel Bot commented Mar 28, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
codingbuddy-landing Ready Ready Preview, Comment Mar 28, 2026 8:30am

@JeremyDev87 JeremyDev87 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: APPROVE

CI Status

  • ALL 27/27 checks PASS — including e2e-plugin-hooks (3.11, 3.12), e2e-plugin-docker, unit-test-check

Code Quality

  • Error handling — outer try/except Exception: pass wraps entire impact report block (never blocks stop hook)
  • Inner error handlingjson.JSONDecodeError/KeyError caught per-line in JSONL parsing
  • No unused importsjson and os already imported in stop.py
  • No blocking operations — synchronous JSONL file read is appropriate for stop hook (small file, local I/O)
  • Clean function separation_render_impact_report() is a pure function (reads file, returns string)

Spec Compliance (#1064)

Requirement Status
Read events from impact-events.jsonl os.path.join(project_dir, "docs", "codingbuddy", "impact-events.jsonl")
Filter by session_id evt.get("sessionId") == session_id
Session < 30s guard if duration_secs >= 30
Events >= 1 only ✅ Returns "" if no events or no rows
JSONL file missing = no error if not os.path.isfile(jsonl_path): return ""
Append after summary summary += "\n\n" + report
Box rendering format ✅ Matches spec (╭─╮, │...│, ├─┤, ╰─╯)
All errors caught ✅ Outer try/except + inner per-line try/except

Event Aggregation

  • issue_found / issue_prevented → issues_prevented count + by domain
  • agent_dispatched → count
  • checklist_generated → count + domains
  • mode_activated → mode transitions chain

Issues Found: 0

Recommendation

APPROVE — 깔끔한 구현. 방어적 에러 처리가 철저하고, stop hook 중단 가능성 없음. JSONL 직접 읽기는 MCP 서버 종료 중에도 작동하는 올바른 설계 선택. 머지 준비 완료.

@JeremyDev87 JeremyDev87 self-assigned this Mar 28, 2026
@JeremyDev87 JeremyDev87 merged commit 06d3447 into master Mar 28, 2026
28 checks passed
@JeremyDev87 JeremyDev87 deleted the feat/1064-stop-hook-impact-report branch March 28, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(plugin): render session impact report in stop hook

1 participant