Skip to content

Add Heartbeat workflow for health checks and sync#33

Open
NicholaiMadias wants to merge 1 commit into
mainfrom
NicholaiMadias-patch-3
Open

Add Heartbeat workflow for health checks and sync#33
NicholaiMadias wants to merge 1 commit into
mainfrom
NicholaiMadias-patch-3

Conversation

@NicholaiMadias
Copy link
Copy Markdown
Owner

This workflow checks the health of specified domains and syncs agent instructions to the central dashboard.

This workflow checks the health of specified domains and syncs agent instructions to the central dashboard.
Copilot AI review requested due to automatic review settings April 13, 2026 12:33
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 13, 2026

Deploy Preview for nicholai failed.

Name Link
🔨 Latest commit f4e6d24
🔍 Latest deploy log https://app.netlify.com/projects/nicholai/deploys/69dce2957201fb00084f0d46

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a scheduled “Heartbeat” job intended to (1) sync agent instructions to a central dashboard and (2) perform periodic health checks against two domains, alerting an external service on failures.

Changes:

  • Introduces a new scheduled/manual workflow definition for instruction sync + dual-domain health checks.
  • Posts sync/alert requests to an external Railway-hosted service.
  • Fails the job when either monitored domain does not return HTTP 200.

Comment on lines +1 to +12
name: Dual-Domain Health & Agent Sync

on:
push:
branches: [ "main" ]
schedule:
- cron: '0 * * * *' # Automated health check every hour
workflow_dispatch: # Allows you to manually trigger a sync

jobs:
health-and-sync:
runs-on: ubuntu-latest
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

This file contains a GitHub Actions workflow, but it’s being added under .github/instructions/ with a .instructions.md extension. GitHub Actions will not load workflows from this path, so the health check/sync job will never run. Move this YAML to .github/workflows/ (e.g. heartbeat.yml) if the intent is to create an actual workflow.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +21
curl -X POST https://your-railway-app.up.railway.app/update-agent-logic \
-H "Authorization: Bearer ${{ secrets.GOVERNANCE_TOKEN }}" \
-F "instructions=@Agent.Instructions.pdf"
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

The sync step uploads Agent.Instructions.pdf, but that file doesn’t exist in this repository, so this step will fail every run. Either add the file to the repo/artifact, or update the step to point at the actual instructions source (and consider failing fast with a clear error if it’s missing).

Suggested change
curl -X POST https://your-railway-app.up.railway.app/update-agent-logic \
-H "Authorization: Bearer ${{ secrets.GOVERNANCE_TOKEN }}" \
-F "instructions=@Agent.Instructions.pdf"
INSTRUCTIONS_FILE=".github/instructions/Heartbeat.instructions.md"
if [ ! -f "$INSTRUCTIONS_FILE" ]; then
echo "Expected instructions file not found: $INSTRUCTIONS_FILE"
exit 1
fi
curl --fail -X POST https://your-railway-app.up.railway.app/update-agent-logic \
-H "Authorization: Bearer ${{ secrets.GOVERNANCE_TOKEN }}" \
-F "instructions=@${INSTRUCTIONS_FILE}"

Copilot uses AI. Check for mistakes.
Comment on lines +26 to +32
status_code=$(curl -o /dev/null -s -w "%{http_code}" https://nicholai.org)
if [ $status_code -ne 200 ]; then
echo "Arcade (nicholai.org) is down! Status: $status_code"
curl -X POST https://your-railway-app.up.railway.app/alert \
-d '{"domain": "nicholai.org", "status": "down", "contact": "nicholaimadias@gmail.com"}'
exit 1
fi
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

In GitHub Actions, run: steps execute with bash -e, so if curl fails due to DNS/timeout/etc, this step will exit immediately and skip the alert POST. To ensure alerts fire on network failures, capture the curl exit code (or default the status code to 000) and branch on that instead of letting set -e abort the script.

Copilot uses AI. Check for mistakes.
Comment on lines +37 to +43
status_code=$(curl -o /dev/null -s -w "%{http_code}" https://amazinggracehomeliving.com)
if [ $status_code -ne 200 ]; then
echo "Listings (Amazing Grace) is down! Status: $status_code"
curl -X POST https://your-railway-app.up.railway.app/alert \
-d '{"domain": "amazinggracehomeliving.com", "status": "down", "contact": "nicholaimadias@gmail.com"}'
exit 1
fi
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

Same issue as above: if curl fails, the step will terminate before reaching the alert POST due to bash -e. Handle curl failures explicitly so the workflow reliably sends an alert when the domain is unreachable.

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +31
curl -X POST https://your-railway-app.up.railway.app/alert \
-d '{"domain": "nicholai.org", "status": "down", "contact": "nicholaimadias@gmail.com"}'
exit 1
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

The alert payload includes a hard-coded personal email address and the workflow hard-codes the external alerting endpoint. If this repo is public, this leaks PII and makes it easy to accidentally notify the wrong contact. Prefer storing contact info and the alert base URL in repository/environment secrets or variables, and avoid committing personal contact details into the workflow.

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +30
curl -X POST https://your-railway-app.up.railway.app/alert \
-d '{"domain": "nicholai.org", "status": "down", "contact": "nicholaimadias@gmail.com"}'
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

The alert request sends a JSON string via curl -d but does not set Content-Type: application/json. Many endpoints will reject or mis-parse this. Add the appropriate Content-Type header (and consider -sS / timeouts) so failures are surfaced clearly and the payload is parsed as intended.

Copilot uses AI. Check for mistakes.
Comment on lines +40 to +41
curl -X POST https://your-railway-app.up.railway.app/alert \
-d '{"domain": "amazinggracehomeliving.com", "status": "down", "contact": "nicholaimadias@gmail.com"}'
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

Same JSON alert issue here: the request body is JSON, but the Content-Type: application/json header isn’t set, which can cause the alerting service to misinterpret the payload. Set the correct content type and add basic curl hardening (timeouts / -sS) to improve reliability.

Copilot uses AI. Check for mistakes.
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