feat(plugin): render session impact report in stop hook#1071
Merged
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
JeremyDev87
commented
Mar 28, 2026
JeremyDev87
left a comment
Owner
Author
There was a problem hiding this comment.
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: passwraps entire impact report block (never blocks stop hook) - ✅ Inner error handling —
json.JSONDecodeError/KeyErrorcaught per-line in JSONL parsing - ✅ No unused imports —
jsonandosalready 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 서버 종료 중에도 작동하는 올바른 설계 선택. 머지 준비 완료.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_render_impact_report(session_id, project_dir)to stop hook that readsimpact-events.jsonldirectly (MCP server may already be stopping)Test plan
Closes #1064