Skip to content

Add comment-triggered activity collection to payjoin-bot#1503

Merged
DanGould merged 4 commits intopayjoin:masterfrom
DanGould:feat/standup-comment-trigger
Apr 27, 2026
Merged

Add comment-triggered activity collection to payjoin-bot#1503
DanGould merged 4 commits intopayjoin:masterfrom
DanGould:feat/standup-comment-trigger

Conversation

@DanGould
Copy link
Copy Markdown
Contributor

@DanGould DanGould commented Apr 25, 2026

Closes the asymmetry where only a pre-defined list of contributors get a pre-made activity thread on
Monday but newcomers and async-only contributors had to self-post
manually with no auto-gathered activity.

Tested in a discussion on my branch with this discussion comment.

Very much completely claude coded.

This is what the robots ran to verify:

  • python -m py_compile on the three Python files
  • YAML safe-load on the new workflow
  • Behavioral parity check on format_contributor_comment between
    the pre-refactor baseline and the new lib — Monday default path
    is byte-identical (via dry-run)
  • Trigger regex (?im)(^|\s)/check-in\b accepts standalone /
    line-anchored / case variants; rejects foo/check-in/bar and
    not-a/check-in
  • Manual dry-trace for: valid /check-in; bot self-comment; wrong
    category; same user after prior success (cap consumed); same
    user after prior failure (### Shipped absent → retry allowed)

Post-merge acceptance:

  • Comment /check-in from a non-listed account in the next
    Weekly Check-in Discussion → bot replies within ~2 min,
    threaded under the trigger
  • Comment /check-in again from same account → no response
  • Comment /check-in from a different account → response
  • Comment /check-in in a non-Check-in Discussion → workflow
    does not run
  • Force a gather failure → bot posts the error template and the
    job is red; re-comment /check-in → bot retries successfully
Pull Request Checklist

Please confirm the following before requesting review:

Move shared GitHub API helpers and activity-gathering functions
into a new .github/scripts/standup_lib.py so the upcoming
on-comment trigger can reuse them without duplicating logic.

Behavior of the weekly Monday post is unchanged: format_contributor
_comment defaults to include_last_week=True, preserving the user
header, @-mention, and "Last Week" link block. The new
include_last_week=False path is reserved for the on-demand
/check-in reply added in a follow-up commit.
New .github/scripts/respond_to_standup_comment.py replies to a
contributor's `/check-in` comment in a Weekly Check-in Discussion
with the same auto-gathered activity summary used by the Monday
post.

Behavior:

* Confirms the precise `(?im)(^|\s)/check-in\b` match on the
  comment body, exits silently otherwise.
* Loop guard: skips comments authored by payjoin-bot.
* Per-week cap: queries existing comments + replies and exits
  silently if payjoin-bot already posted a body starting with
  `### Shipped` in reply to a comment by this author. Error
  replies do not count, so a failed first attempt allows retry.
* Activity window is `discussion.createdAt - 7 days`, matching
  the Monday window for that Discussion regardless of when the
  /check-in comment was made.
* Posts via `addDiscussionComment` with `replyToId=COMMENT_ID`
  so the reply nests under the trigger.
* On failure, best-effort posts a short error reply (not the
  success marker) and re-raises so CI shows red.
Trigger respond_to_standup_comment.py whenever a discussion comment
is created in the Check-ins category under a `Weekly Check-in:`
Discussion, the comment is not authored by payjoin-bot, and the
body contains `/check-in`. The script applies the precise regex,
loop guard, and per-week cap.

Uses the existing STANDUP_BOT_TOKEN (with fallback to
STANDUP_TOKEN) — no new secrets or scopes required.
Discussion replies are one level deep — `addDiscussionComment`'s
`replyToId` only accepts a top-level comment ID, so a `/check-in`
posted as a reply (nested) would either fail at the API or post in
an unexpected place. Guard at the workflow `if:` so the job never
starts: nested comments carry a non-null `parent_id` in the
payload. The script's per-week cap and post logic stay simple and
only ever see top-level triggers.
@coveralls
Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 24925352513

Coverage remained the same at 84.953%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 13371
Covered Lines: 11359
Line Coverage: 84.95%
Coverage Strength: 400.75 hits per line

💛 - Coveralls

Copy link
Copy Markdown
Contributor

@caarloshenriq caarloshenriq left a comment

Choose a reason for hiding this comment

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

tACK

ran the /check-in command in your fork's discussion and it correctly listed all my contributions from this week

@DanGould DanGould requested a review from arminsabouri April 27, 2026 09:51
Copy link
Copy Markdown
Collaborator

@arminsabouri arminsabouri left a comment

Choose a reason for hiding this comment

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

ConceptAck

@DanGould DanGould merged commit b3d12da into payjoin:master Apr 27, 2026
14 checks passed
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.

4 participants