Skip to content

feat: Slack alerts, Moodle check and Gemini summary for the daemon - #9

Merged
CsPS0 merged 5 commits into
mainfrom
feat/slack-moodle-gemini
Nov 9, 2026
Merged

CsPS0 merged 5 commits into
mainfrom
feat/slack-moodle-gemini

Conversation

@CsPS0

@CsPS0 CsPS0 commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

pala --daemon already runs one check and exits. This PR makes that run useful from a scheduled job (GitHub Actions every 2 hours):

  • Slack: all alerts of one run go out as a single message through an Incoming Webhook (PALA_SLACK_WEBHOOK or ~/.config/pala/slack_webhook). Only https://hooks.slack.com/services/... is accepted, and Kréta text is escaped so it cannot ping @channel or fake links. A failed Kréta login posts an error and exits with code 1.
  • Better alerts: grade alerts list the new grades. Each exam is announced once when it appears and once the day before; the first run records existing exams without posting them.
  • Moodle (optional, PALA_MOODLE_URL): logs in once through the mobile web service, with the password only in the POST body of login/token.php, and keeps only the token. Alerts on new unread notifications and on deadlines in the next 14 days.
  • Gemini (optional, PALA_GEMINI_API_KEY or ~/.config/pala/gemini_key): a short Hungarian summary is added to the Slack message, only when there is at least one alert. The key goes in the x-goog-api-key header and the model name is validated.
  • Privacy: teacher names and Moodle notification text go only to Slack, never into the Gemini prompt. 2.5 Flash requests set thinkingBudget: 0, so thinking tokens cannot use up the output cap.
  • docs/USER.md describes the new settings.

Testing

  • dart analyze --fatal-infos: no issues
  • dart test: 123 passed (new: test/slack_notifier_test.dart, test/gemini_moodle_test.dart)

Not yet verified against the real services:

  • Moodle token login with a real school account (run locally, not in CI)
  • One real Gemini call with the default model, to confirm the summary is not empty
  • One manual run of the runner workflow (Kréta may refuse GitHub's datacenter IPs)

🤖 Generated with Claude Code

CsPS0 and others added 5 commits November 9, 2026 17:27
pala --daemon collects the alerts of one run and posts them as a single
Slack message through an Incoming Webhook (PALA_SLACK_WEBHOOK or
~/.config/pala/slack_webhook). Grade alerts list the new grades, exams are
announced once when they appear and once the day before, and a failed
Kréta login posts an error and exits non-zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When PALA_MOODLE_URL is set, pala --daemon logs in once through the Moodle
mobile web service (password only in the POST body of login/token.php),
keeps just the token in the auth data, and alerts on new unread
notifications and on deadlines in the next 14 days.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With PALA_GEMINI_API_KEY (or ~/.config/pala/gemini_key) set, a run that
has new alerts appends a short Hungarian summary from Gemini. The key goes
in the x-goog-api-key header, the model name is validated, and a run
without alerts makes no API call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The substitute-teacher name and Moodle notification subjects now go only
to Slack; Gemini gets a version of those alerts without them. On
gemini-2.5-flash models the request sets thinkingBudget 0, because
thinking tokens count against maxOutputTokens and could leave the summary
empty. Other models get no budget and no output cap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
pala Ready Ready Preview Nov 9, 2026 4:39pm UTC

@CsPS0
CsPS0 force-pushed the feat/slack-moodle-gemini branch from a09cfdd to 04c6b88 Compare November 9, 2026 16:39
@CsPS0
CsPS0 merged commit cd6ffc6 into main Nov 9, 2026
6 checks passed
@CsPS0
CsPS0 deleted the feat/slack-moodle-gemini branch November 18, 2026 20:05
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