Spaces:
Sleeping
Sleeping
Commit History
-
Make Monday cron reliable + wake HF Space after sending
Piers Lyon +1: Claude Opus 4.7 (1M context)User noticed the Monday 18 May cron never fired — GitHub Actions silently dropped it. Two fixes in one commit. (1) Cron unreliability: GH Actions docs explicitly warn that "scheduled workflows may be delayed during periods of high load" — and the worst slot is anything on the exact top of an hour at peak European load (07:00 UTC). The old '0 7 * * 1' was sitting right in that hole. Replaced with two schedule entries: - Primary: '17 7 * * 1' (Monday 07:17 UTC / 08:17 BST) - Safety: '45 11 * * 1' (Monday 11:45 UTC / 12:45 BST) Minute-17 dramatically reduces the drop rate. If both fire, the orchestrator's hunt-cooldown guard makes the second a cheap no-op (state pull + early exit). If the primary drops, the safety net catches it within hours rather than us realising on Tuesday. (2) Wake the HF Space after sending: Even though the digest workflow is independent of the Space, the Space is what team members visit when they click the link in the digest. If it's asleep on Mond…11992e6
-
Add diagnose-state workflow — verify HF Dataset health before Monday cron
Piers Lyon +1: Claude Opus 4.7 (1M context)Read-only health check on the dataset's leads.db. Reports: - Top-level row counts (companies, signals_*, signal_facts, macro_pulse, weekly_themes, feedback_*) - Per-colleague network_graph counts (the critical table — empty network_graph = empty digests on Monday morning) - Recent activity counts (last 7d / 30d at score>=50) - Warm-route lead candidates (the colleague x company x recent signal intersection that drives the digest) Built specifically because we had to fix a stale Space HF_TOKEN and want to confirm the underlying data is intact, not just that the auth path works again. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>bb49bbf -
Fix Space CONFIG_ERROR: don't add HF_STATE_REPO as both variable AND secret
Piers Lyon +1: Claude Opus 4.7 (1M context)The first run of sync-space-secrets pushed HF_STATE_REPO into the Space as a *secret*, but the Space already had it set as a *variable* (public env var). HF Spaces require unique keys across the variable/secret namespace, so the Space went CONFIG_ERROR with "Collision on variables and secrets names". Fix: - Delete any stale HF_STATE_REPO *secret* we may have created. - Set/refresh HF_STATE_REPO as a Space *variable* (the right place for a non-sensitive dataset path). - HF_TOKEN remains a secret (correctly). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>c9e8a05 -
Add sync-space-secrets workflow — fix the Space's 401 auth drift
Piers Lyon +1: Claude Opus 4.7 (1M context)The live Space's container log just showed the precise cause of the zero-data symptom: httpx.HTTPStatusError: Client error '401 Unauthorized' for url 'https://huggingface.co/datasets/mipwr-admin/curium-intel-state/ resolve/main/leads.db' The dataset URL is correct. The Space's own HF_TOKEN secret has gone stale (it's been there since 2026-04-30 per `gh secret list`'s GitHub counterpart, and the HF Space copy probably hasn't been touched since the Space was created). The GitHub Actions HF_TOKEN still works — last week's cron pulled the dataset successfully — so the two have drifted. Rather than push the rotation to the user (require them to find a working token, paste it into the Space settings UI, restart), this workflow programmatically copies the proven-working GH-side token onto the Space via huggingface_hub.add_space_secret() and restarts the Space. Safety: - Manual trigger only (workflow_dispatch). Doesn't fire on push. - Self-tests the GH-side token by calling dataset_i…035ffeb -
Add deploy-to-Space workflow — manual trigger, no auto-deploy
Piers Lyon +1: Claude Opus 4.7 (1M context)Diagnosis: the live HF Space (mipwr-admin/curium-intel) hasn't rebuilt since 2026-05-05. None of the Phase 1-4 work, feedback loop, or hardening landed on the Space because there was no GitHub→Space sync configured. The Monday cron runs in GitHub Actions so emails are unaffected, but the dashboard the team visits has been frozen for almost a week. This workflow uses huggingface_hub.upload_folder() to push the repo to the Space when manually triggered. Manual-only on purpose — a "git push to main" never silently deploys to production. Flip to `on: push: branches: [main]` once we trust the pipeline. Safety guards in the workflow: - Refuses to deploy if a .env file is in the checkout. - Greps tracked files for committed API key literals and aborts on a hit. - Excludes: leads.db, sales_signals.db, venv/, __pycache__/, logs/, data/, .env*, .claude/, memory/, *.xlsx, *.csv, .git/, .github/, .vscode/, .idea/, .DS_Store, deploy docs. - Concurrency group ensures only one deploy runs at …482374c
-
mailer: add Microsoft Graph API transport for M365 service accounts
Piers Lyon +1: Claude Opus 4.7 (1M context)User is M365 admin and prefers to keep email sending inside the tenant (data security) rather than using a third-party transactional service. SMTP AUTH is being deprecated by Microsoft and requires a paid mailbox license; Graph API with an Azure AD App Registration is the Microsoft- recommended path: - No SMTP AUTH, no basic auth deprecation risk - Works with a free shared mailbox (no license required) - Application Access Policy can scope the app to one mailbox only mailer.py now auto-picks transport: - 'graph' when MS_GRAPH_TENANT_ID + MS_GRAPH_CLIENT_ID + MS_GRAPH_CLIENT_SECRET + MS_GRAPH_FROM_EMAIL are all set - 'smtp' fallback when SMTP_USERNAME + SMTP_PASSWORD are set - 'none' when neither — send() returns a clear error Graph path uses msal client credentials flow → bearer token → POST /users/{mailbox}/sendMail. Common Graph errors (403 missing Mail.Send / Application Access Policy, 404 mailbox not found, 401 token issues) are surfaced to the caller in the messa…48cb4ed -
mailer: separate SMTP_FROM_EMAIL from SMTP_USERNAME
Piers Lyon +1: Claude Opus 4.7 (1M context)Previously the From-header address came from SMTP_USERNAME, which forced the auth user to also be the visible sender. That breaks for transactional relays (e.g. Resend) where SMTP_USERNAME='resend' but the team wants emails to come from intelligence@curium.co.uk. New SMTP_FROM_EMAIL env var separates the two; falls back to SMTP_USERNAME for the M365 / Gmail case where they're identical. Workflow + setup_gh_secrets.sh updated to handle the new variable. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>37eb301 -
Weekly Monday hunt + per-colleague email digest (Henriette as test recipient)
Piers Lyon +1: Claude Opus 4.7 (1M context)End-to-end pipeline: GitHub Actions cron → pull state → run hunt → push state → compose per-colleague emails via Claude → send via SMTP. Configured for ONE recipient initially (Henriette) so the team can validate wording and routing before broadcasting. Adding more recipients is purely a config.yaml + Space-secret edit later. config.yaml — new top-level `team_emails` block. Each entry maps a colleague name (must match the LinkedIn export's `Owner` column) to an email. The `ENV:HENRIETTE_EMAIL` syntax keeps the actual address out of git — resolved at send time from the GH Actions secret. weekly_digest.py — new module: - get_team_emails(): reads config + resolves ENV: indirection - fetch_warm_leads_for_colleague(): joins network_graph (filtered to THIS colleague's connections) with recent signals_jobs / signals_news / signals_tenders, ranks by overall_score + signal density, returns top 12. Each lead carries the colleague's specific contact at that company, p…aea8ae2