Skip to content

feat(container): post session results to PR as GitHub comment - #20

Closed
mariuspruvot wants to merge 1 commit into
mainfrom
feat/post-results-to-pr
Closed

feat(container): post session results to PR as GitHub comment#20
mariuspruvot wants to merge 1 commit into
mainfrom
feat/post-results-to-pr

Conversation

@mariuspruvot

Copy link
Copy Markdown
Owner

Summary

  • After a challenge-me session completes, automatically post the score card as a PR comment via GitHub API
  • Opt-in per installation via post_results_to_pr boolean (default: false), toggled through PUT /installations/{id}/post-results
  • Score card extracted from the last result event in session_events table, formatted with a collapsible session link

Key changes

Area What changed
Migration Add post_results_to_pr boolean column to installations
Installation module New setting endpoint, schema, service function
Container module New pr_comment.py (extraction + formatting), _post_results_comment() wired after mark_completed()
Admin panel Column visible in InstallationAdmin

Design decisions

  • API-side posting (not container-side): keeps the entrypoint generic/skill-agnostic, reuses existing post_pr_comment_with_retry(), mints fresh installation token to handle sessions outliving the original token's 1-hour TTL
  • New comments (no dedup): multiple sessions = distinct quiz attempts; users see score progression
  • Best-effort: comment posting never blocks session completion or the SSE done event

Test plan

  • extract_score_card extracts from result event, returns None for missing/invalid data
  • format_pr_comment includes score card, session link, collapsible details
  • Stream posts comment when post_results_to_pr=True and skill is challenge-me
  • Stream skips comment when disabled, on failed sessions, and for non-challenge-me skills
  • Installation router returns post_results_to_pr in responses
  • PUT endpoint updates the flag (requires admin auth)
  • Ruff lint + format clean
  • 240 tests pass

After a challenge-me session completes successfully, extract the score
card from persisted session events and post it as a PR comment via the
GitHub API. Feature is opt-in per installation (post_results_to_pr
boolean, default false).

- Add post_results_to_pr column to installations table (migration)
- Add PUT /installations/{id}/post-results endpoint for toggling
- Add pr_comment module with score card extraction and formatting
- Wire up _post_results_comment() in SSE stream after mark_completed
- Expose setting in admin panel
@helprs-local-mariuspruvot

Copy link
Copy Markdown

helPRs session created for this PR.

Skill: challenge-me | Open session

@mariuspruvot

Copy link
Copy Markdown
Owner Author

Cherry-picked to main as 1b3566e

@mariuspruvot
mariuspruvot deleted the feat/post-results-to-pr branch April 18, 2026 21:53
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