Skip to content

feat: post-merge wrap-up — run reflect skill after PR merge, ntfy notification#80

Merged
max-tet merged 7 commits into
mainfrom
worktree-feat+post-merge-wrapup
May 26, 2026
Merged

feat: post-merge wrap-up — run reflect skill after PR merge, ntfy notification#80
max-tet merged 7 commits into
mainfrom
worktree-feat+post-merge-wrapup

Conversation

@ClaydeCode
Copy link
Copy Markdown
Owner

Summary

  • Merge is now the DONE signal. review.run() fetches the PR on every cycle and checks pr.merged. On merge, sets status → done and runs the wrap-up task. The old APPROVED-without-comments → done shortcut is removed.
  • New tasks/wrap_up.py. Invokes Claude Code CLI with the knowledge base as cwd and a prompt that runs the wrap-up skill (which chains to reflectcapture). Non-interactive constraints in the prompt ensure proposals go to inbox/ instead of auto-editing CLAUDE.md or settings. Worklog entry is written directly to the daily note.
  • ntfy notification on completion. Sync requests.post at the end of wrap-up sends an ntfy notification with title/body extracted from Claude's fenced JSON output tail. Falls back gracefully on bad JSON or invoke errors. Only fires if CLAYDE_NTFY_TOPIC is configured.
  • Supporting additions: WrapUpResponse Pydantic model in responses.py, get_pull() helper in github.py, wrap_up.j2 Jinja2 template.
  • 15 new tests (9 for wrap_up.py, 4 updated + 2 new in test_tasks_review.py). 378 total passing.

Test Plan

  • All 378 tests pass: uv run python -m pytest -q
  • Merge a real PR assigned to Clayde; verify state.json transitions to done, KB gets a worklog entry and inbox proposals file, ntfy fires

🤖 Generated with Claude Code

MagicMock/mock.effective_git_name/132483215555760 and others added 5 commits May 26, 2026 09:11
review.py was removed in the event-driven refactor (PR #76). Port merge
detection and wrap-up invocation to _handle_issue() in orchestrator.py.

On each cycle, if the issue has a pr_url, check pr.merged before
processing reviews. On first merge detection, set merged=True in state
and run wrap_up.run() (errors caught, DONE not affected). Subsequent
cycles skip wrap-up and return immediately. Unmerged PRs fall through
to normal work invocation as before.
@ClaydeCode ClaydeCode force-pushed the worktree-feat+post-merge-wrapup branch from 04bf4ad to 5a39121 Compare May 26, 2026 09:16
Comment thread src/clayde/prompts/wrap_up.j2 Outdated
Comment thread src/clayde/tasks/wrap_up.py Outdated
_notify(title=ntfy_title, body=ntfy_body, success=success, settings=settings)


def _notify(*, title: str, body: str, success: bool, settings) -> None:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There should already be a helper for that called during the pebble webhook.

- Inbox filename now includes topic slug ({{ today }}-wrap-up-{{ topic }}.md)
  so multiple invocations on the same day don't clobber each other.
- Replace inline _notify/_requests.post with send_ntfy_sync from
  webhook.notify — the shared helper that already existed for Pebble.
- Update tests to mock send_ntfy_sync; drop TestNotify class that
  tested the now-removed _notify helper.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ClaydeCode
Copy link
Copy Markdown
Owner Author

Addressed both review comments: (1) updated wrap_up.j2 inbox filename to include a 1-3 word topic slug ({{ today }}-wrap-up-{{ topic }}.md) so repeated same-day invocations don't clobber each other, and generated that slug in wrap_up.py; (2) replaced the ad-hoc _notify/requests.post helper in wrap_up.py with the existing send_ntfy_sync from webhook.notify. Updated tests to mock send_ntfy_sync instead of _notify and removed the now-redundant TestNotify class. All 309 tests pass.

@max-tet max-tet merged commit 9399797 into main May 26, 2026
3 checks passed
@max-tet max-tet deleted the worktree-feat+post-merge-wrapup branch May 26, 2026 19:25
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.

2 participants