Nothing is worse than discovering your automation script is broken on the day of the month-end deadline. Here's how I built a weekly dry-run to prevent exactly that.
Background: Our Month-End Automation Stack
At TechsFree, we automate a series of tasks at the end of every month:
| Time | Task |
|---|---|
| 17:00 | Hajimari timesheet auto-entry (Playwright) |
| 18:00 | Identity work report + invoice Google Forms auto-submit (CDP) |
| 19:00 | Edge-tech invoice email preview |
These directly impact company revenue and payments. What used to take 2–3 hours of manual work every month is now fully automated.
Tech stack:
- Playwright + Chrome CDP → browser automation for web services
- freee API → receipt OCR, transaction registration, invoice data
- Python / Node.js → 9 automation scripts
- SSH → remote execution on internal servers
- OpenClaw cron jobs → auto-trigger on the last business day of each month
The Problem: Breakage Stays Hidden Until Month-End
There's a critical flaw in this setup: each component only runs once a month.
- freee OAuth tokens expire silently
- Broken symlinks cause no errors until they're accessed
- Chrome CDP ports can go down without anyone noticing
- Scripts moved during refactoring leave stale paths behind
How do you guarantee a system that only runs monthly is actually working? You can't know until you try to run it for real.
Solution: A Weekly Dry-Run Every Monday Morning
A dedicated agent (techsfree_monthly) runs automated health checks every Monday at 10:00, reporting results via internal message bus to Joe.
Check items:
1. SSH connectivity (reach internal server)
2. Chrome CDP check (WebSocket connection to port 19222)
3. Playwright check (version + browser launch)
4. freee token check (.freee_token.json exists, readable, not expired)
5. Script existence check (all 9 scripts present)
6. .env file check (required keys present)
The key point: no actual operations are performed. No logins, no form submissions, no API calls. Pure dependency health checks.
A Real Catch: 2026-03-16
This dry-run proved its value.
Monday March 16th check results:
✅ SSH connection: OK
✅ Chrome CDP (19222): OK
✅ Playwright v1.58.2: OK
⚠️ freee token: ERROR
.freee_token.json symlink broken
→ Target /path/to/.freee_token.json does not exist
✅ All scripts (9): OK
The freee token symlink was broken.
What happened: a previous directory reorganization had moved the token file to config/, but the old symlink path remained in place.
The fix:
- Recreate the token directory
- Copy the token file (NFS environments make symlinks unreliable)
- Update
TOKEN_PATHin scripts to referenceconfig/directly
This was caught 2 weeks before month-end. Plenty of time.
If we'd discovered this on the deadline day, we'd have been scrambling to find the token file, fix paths, and re-run everything under pressure.
Today's Result (2026-03-23)
✅ SSH connection: OK
✅ Chrome CDP (19222): OK
✅ Playwright v1.58.2: OK
✅ freee token: OK (all keys present)
✅ All scripts: OK (9/9)
Conclusion: All healthy, month-end ready
About one week until March month-end. System is fully operational.
Design Rationale
Why weekly?
Month-end automation runs once a month. But dependencies (tokens, connections, files) can change daily. Weekly checks guarantee at least a few days of lead time between discovering a problem and the actual deadline.
Why the same agent?
The techsfree_monthly execution agent doubles as the dry-run runner. Same agent handles both production execution and health verification. No code duplication.
Why message bus reporting?
Alerts land directly in Joe's inbox. Not "there's a log somewhere"—but "every Monday morning, a report arrives in your inbox." Guaranteed visibility.
This Pattern Generalizes
Beyond month-end automation, this works for any low-frequency, high-importance automated process:
- Annual processing (tax filings, contract renewals)
- Quarterly report generation
- Scheduled backup restore tests
Turn "we don't know if it works until we run it" into "confirmed healthy every week." Cost: lightweight health checks only.
Top comments (0)