pwc-cron-health
Thoroughly audit the health of every Papers With Code production CRON job shown on the admin dashboard, including scheduler execution, logs, locks, durable data freshness, backlog completeness, semantic correctness, and bounded comparisons with upstream sources. Use this whenever a user asks whether PwC CRONs, scheduled imports, citations, GitHub stars, trending scores, leaderboard syncs, embeddings, thumbnails, daily paper enrichment, taxonomy linkers, or the admin CRON dashboard are healthy—even if they only mention one suspicious stale dataset. Do not use a green dashboard status or fresh timestamp as sufficient proof.
Warnings for the author
- Not listed or searched: a skill under a hidden directory is discoverable only when the repository has no visible skill.
Papers With Code CRON health audit
Audit the production automation as an independent verifier. The admin dashboard is useful control-plane evidence, but it is not the source of truth: a buggy job can exit successfully, update a timestamp, and still leave incorrect or incomplete data.
Read before auditing
- Read the repository
AGENTS.md. - Read
docs/database.mdbefore any database access. - Read the CRON and admin sections of
docs/operations.md. - For a full audit, read all of
references/job-probes.md. For a focused audit, read the common rules and the requested job sections.
Use the exact active production release as the implementation and schedule contract. The developer checkout may be newer or dirtier.
Outcome standard
Complete a full audit only after every dashboard entry has all four evidence planes classified:
| Plane | Question |
|---|---|
| Registration | Is the job represented consistently in the deployed registry, scheduler, launcher allowlist, and dashboard? |
| Execution | Did the expected scheduled slot run the correct release and terminate cleanly without a stuck process, lock, queue, or provider failure? |
| Durable output | Did the intended database rows, objects, files, or queue states actually reach fresh and complete state? |
| Correctness | Do deterministic recomputation, upstream comparison, invariants, or a public functional smoke test show that the values/content are right? |
Classify each plane as healthy, degraded, unhealthy, unverified, or not_applicable. A job is fully healthy only when all applicable planes are healthy. Preserve unverified; never turn missing evidence into green.
Safety boundary
This skill is read-only. Inspection does not authorize remediation.
- Run
sudo pwc-cron status, but neversudo pwc-cron JOB. Job invocations—including most dry runs—write launcher records, acquire locks, call providers, and commonly mutate shared data. - Do not dispatch, rerun, or cancel GitHub workflows; restart services/timers; delete locks; edit configuration; rotate tokens; deploy; upload/sync/delete bucket objects; or write SQL.
- Use bounded
SELECTqueries inside an explicitly read-only transaction. Run repository Python/CLI code withuv run --env-file backend/keys.env .... - Bound logs, journals, external API comparisons, and object downloads. Redact tokens, database URLs, webhook URLs, private traces, and chat content.
- Prefer metadata and aggregate health for chat monitoring. Do not expose user content.
- If a check would be expensive, rate-limited, paid, or stateful, use a stratified sample and label the remaining scope
unverified.
Phase 1: pin the live scope
Capture a UTC audit timestamp and read-only release evidence:
pwc-status
sudo pwc-cron status
readlink -f /srv/paperswithcode/environments/production/current
Record the production release ID and exact 40-character SHA. Confirm launcher provenance points to the same release. If source and live release differ, inspect files under the resolved production release rather than assuming the checkout reflects production.
Build the inventory dynamically from the deployed registry (backend/services/cron/registry.py, which assembles the job rows in backend/services/cron/jobs.py and leaderboard_jobs.py); do not trust a remembered list or README. Record the discovered count; no fixed job count is a permanent contract.
Capture a fresh, uncached baseline from the repository backend CLI. Start in
the developer checkout with its existing environment. Do not run uv from an
immutable release: it can create a release-local .venv and build artifacts.
--no-sync prevents dependency installation; -B prevents bytecode writes.
The Python process below selects live source only after uv has started:
PWC_CRON_LOG_DIR=/var/lib/paperswithcode/production/cron-logs \
PWC_THUMBNAIL_CACHE_DIR=/var/lib/paperswithcode/shared/thumbnails \
uv run --no-sync --env-file backend/keys.env python -B - <<'PYTHON' > /tmp/pwc-cron-health.json
import os
import runpy
import sys
from pathlib import Path
release = Path("/srv/paperswithcode/environments/production/current").resolve()
os.chdir(release)
sys.path.insert(0, str(release))
sys.argv = ["backend.cli", "cron", "health", "--strict", "--json"]
runpy.run_module("backend.cli", run_name="__main__")
PYTHON
Confirm these log/cache paths against the active environment without printing credentials. If checkout dependencies cannot load live code, use an isolated temporary environment; never install into or edit the release. Treat any local configuration mismatch as missing audit evidence, not a production failure.
backend/keys.env is not the production configuration, so this baseline
misreads production enablement flags. A job gated by enablement_settings
(for example send_research_digests, whose PWC_RESEARCH_EMAIL_ENABLED is
set only in /etc/paperswithcode/production.env) shows a false "timer is
active while disabled by configuration" finding. Before reporting such a
finding, check the flag with sudo grep -c '^FLAG_NAME=true' /etc/paperswithcode/production.env (never print secret values) or compare
with the admin dashboard /status, which the production backend builds.
The public catalog pwc executable may not expose the repository-only cron command. When pwc cron health and the source parser disagree, use python -m backend.cli from code matching the active release and report the mismatch.
Save launcher status separately and run the bundled inventory check:
sudo pwc-cron status > /tmp/pwc-cron-launcher.json
uv run --env-file backend/keys.env \
python .agents/skills/pwc-cron-health/scripts/check_inventory.py \
--repo-root /srv/paperswithcode/environments/production/current \
--dashboard-json /tmp/pwc-cron-health.json \
--launcher-json /tmp/pwc-cron-launcher.json
Also enumerate all scheduled automation, because dashboard coverage discovery only recognizes cron-*.yml workflows and systemd services invoking pwc-cron:
rg -n "schedule:|cron:" /srv/paperswithcode/environments/production/current/.github/workflows/*.yml
# Every timer whose service runs repo code, whatever the unit is named (x-*-sheet-import, x-post-schedule, ...).
for s in $(systemctl list-timers --all --no-legend --plain | awk '{print $NF}'); do
systemctl cat "$s" 2>/dev/null | rg -qi 'paperswithcode|pwc|autonomous|submission' && echo "$s"
done
Report scheduled duties outside the dashboard separately. Do not silently redefine them as dashboard jobs, but audit each one's durable effect like a dashboard job. Never treat Result=success as proof for them.
x-post-schedule and x-post-watch (the X growth agent, which also mirrors every X post to LinkedIn) are audited by the pwc-social-health skill: run its scripts/social_report.py and report its broken findings here.
Headless-Claude Drive-sheet routines
x-trending-sheet-import (hourly at :20 UTC, "AI Papers on X" sheet → paper_x_trending and the curation priority queue) and x-thread-sheet-import (03, 09, 15 and 21 UTC, "PwC X threads" sheet → paper X threads) run handoffs/<name>-routine/run.sh in the main checkout. Their source is deploy/sheet-routines/ (see its README). That script starts claude -p in dontAsk mode, which exits 0 even when a tool call is denied and nothing gets applied. A run counts as applied only when:
- x-trending: the newest
handoffs/x-trending-routine/runs/<UTC stamp>/result.jsonexists (not onlydry-run.json;"unchanged": trueis a healthy run), andmax(shared_on)inpaper_x_trendingis within about two days of today; - x-thread: the newest run dir (one per run, four a day) has
candidates.json, andhandoffs/x-thread-routine/ledger.jsonwas modified after it whenever there were candidates. Its reports arereports/<date>T<HH>Z.md; a growing "rows still waiting" count or invalid rows in every run means the import is not keeping up with the Grok bots.
Also read the first lines of the newest report in each routine's reports/ dir. x-post-schedule, x-post-watch, cron-health-audit and both sheet routines must list /etc/paperswithcode/claude-oauth.env in systemctl show -p EnvironmentFiles (root's interactive login expires every four weeks and must not be what they run on). The sheet routines export their sheet before Claude starts with the service-account key /etc/paperswithcode/google-sheets-sa.json; a failed export fails the unit and is in the run's export.log (HTTP 403/404 means the sheet is no longer shared with pwc-sheet-reader@pwc-sheet-routines.iam.gserviceaccount.com). "OAuth session expired" or "401" in a recent claude.log is broken. The setup-token lasts a year (created 2026-12-03); report it as due for renewal from 2027-11-15. "not applied" or "blocked" for more than one day in a row is a broken job, even when systemd shows success. Each run.sh exits non-zero when the run did not apply, so a red unit is real. A green unit still needs the checks above.
Phase 2: challenge the dashboard baseline
Inspect every job object, not only the summary, critical_issues, health score, or /cron/health boolean.
- Treat
degraded,unknown,broken, andstuckas findings even when the score is at least 80% or the endpoint says healthy. - Separate
execution_healthfromoutput_health; either can fail independently. execution_health.recent_runssummarizes the last 24 hours of launcherexitandlock_skippedrecords incron-logs/launcher.jsonl(runs,failures,consecutive_failures,lock_skips). Two or more consecutive failures mark a job broken even while a run is active, and a failure rate of 10% (at least three failures) degrades it even when the latest exit succeeded. Without the key (no launcher history yet), checkjournalctl -u SERVICE --since '24 hours ago' | grep -c 'Failed with result'yourself: systemd keeps only the latest exit.failure_alertis set on jobs that opt into failure alerts (failure_alert_afterin the registry; todayrefresh_paper_embeddingsafter 3 consecutive failures). It is computed fromrecent_runson every dashboard build; nothing is pushed to Slack or email, so this audit and the dashboard are the only places an alert surfaces. Open every report with each job wherealerting: true, its streak, andlast_failure_at, and probe its external dependency (for embeddings, the Inference Endpoint) before anything else. Alerting jobs are also listed insummary.critical_issues. A job that is broken onrecent_runswithoutalertingis below its threshold or not opted in: report it, and propose opting it in when a silent failure would hurt users.- Inspect
db_metrics,work_metrics, workflow/systemd evidence, lock state, process state, and diagnostics. - The admin
/statusresponse is cached stale-while-revalidate for about a minute. Prefer the fresh CLI build; useforce_refresh=trueonly as corroboration. - Treat the paused/manual URL extraction entry as
not_applicablefor schedule cadence. Audit its last manual run only when one is claimed. - Validate expected schedule slots against workflow YAML/timers. Inspect several consecutive runs and queue age, not only the newest success—long jobs can accumulate queued scheduled runs.
- A systemd job whose execution reason is
timer enabled after the last scheduled slot; first systemd invocation pendingis reportedhealthybecause the timer has never triggered and its last slot predates itsActiveEnterTimestamp. Manualpwc-cronruns do not count as invocations. Confirm the timer'sNEXTinsystemctl list-timersmatches the registry schedule, then re-check after that slot.
Useful bounded scheduler evidence:
gh run list --workflow WORKFLOW.yml --event schedule --limit 10 \
--json databaseId,status,conclusion,createdAt,updatedAt,event,headBranch,url
gh run view RUN_ID --json status,conclusion,createdAt,updatedAt,event,headBranch,jobs
systemctl show TIMER_OR_SERVICE --property=ActiveState,SubState,Result,ExecMainStatus,LastTriggerUSec,NextElapseUSecRealtime
journalctl -u SERVICE --since '24 hours ago' --no-pager -n 200
Use failed logs only when needed, and sanitize before reporting.
Phase 3: verify the data plane independently
Follow references/job-probes.md for every dynamically discovered dashboard ID. The reference gives the durable effect, likely dashboard blind spot, and strongest independent checks.
Apply these rules across all jobs:
- Prove cohort completeness. Reconstruct the eligible population or upstream cohort and anti-join it against the output.
MAX(updated_at)proves only that one row was touched. - Inspect distributions. Measure oldest wait, percentiles, missing/stale counts, failures, and consecutive-run deltas. A recent average or maximum can hide a starved partition.
- Check semantics. Recompute deterministic scores/hashes/ranks or compare a bounded stratified sample to GitHub, Semantic Scholar, Hugging Face, or the live leaderboard source.
- Check invariants. Look for duplicates, orphans, non-finite vectors, impossible values, stale owned rows, rank direction errors, and mismatched junction tables.
- Exercise a public read path. When appropriate, verify the production API/page/search/thumbnail endpoint exposes plausible current output—not merely that storage rows exist.
- Prove no-work. A successful no-op is healthy only if an independent eligible-cohort/backlog check shows there was no work. Natural upstream stability is not itself a failure.
- Avoid circular proof. Do not reuse only the registry's
db_freshness_queryor the same summary counter that powered the dashboard. Add a logically independent check.
For database work, keep the transaction read-only and bounded. Prefer a short repository script or SQL file that begins a read-only transaction, emits aggregates/samples, and rolls back. Never paste credentials into commands or reports.
Phase 4: cross-job invariants
Check producer/consumer chains after individual probes:
- GitHub star snapshots → repository trending → paper trending → organization trending.
- HF daily cohort → paper import → curation workflows/jobs → enrichment/evaluations → curation thumbnails.
- Thumbnail preload bucket → local mirror → public thumbnail endpoint.
- Paper catalog/content hashes → active embedding generation → semantic search.
- Method keyword/reference backfills → paper-method evidence and links.
- Live leaderboard sources → owned evaluations → recomputed ranks → public benchmark API.
A downstream fresh timestamp cannot compensate for stale or incorrect upstream inputs. Report the earliest broken edge and affected consumers.
Reporting
Lead with the outcome and audit timestamp. Use this structure:
Executive summary
- Production release ID and SHA
- Dashboard entries audited / registry entries / launcher mappings / gaps
- Fully healthy, degraded, unhealthy, unverified, paused counts
- Earliest broken producer and likely user-visible impact
- Explicit statement that no state was changed
Every-job matrix
Include one row for every dynamically discovered dashboard entry:
| Job | Registration | Execution | Durable output | Correctness | Key evidence | Finding |
|---|
Do not collapse healthy jobs into “the rest looked fine.” Exhaustiveness is part of the audit.
Cross-job findings
Describe broken producer/consumer chains, scheduler drift, launcher/release drift, and dashboard false positives.
Unverified scope
List checks not completed, why, and the precise read-only evidence still needed.
Recommended remediation
Propose the smallest corrective or diagnostic action, ordered by impact. Do not perform it without separate authorization.
Known blind spots and gotchas
scan_model_releasesshowsunknown: its output goes to a different journal unit than the dashboard reads. Check its own unit withjournalctl -ubefore calling them broken or healthy.