fix(launchd): triage 5 flapping plists — phase-B-prime CLI fallback + buttons-smoke regex assertion#340
Merged
mitwilli-create merged 1 commit intoMay 29, 2026
Conversation
… buttons-smoke regex assertion
Resolves 2 of 5 CRIT flapping plists surfaced by /system-maintainer +
/career-ops-health Phase 9 (2026-05-29). Other 3: 1 already fixed in
main today (kickstart cleared flap), 2 need USER action (OAuth re-auth
+ Tahoe Full Disk Access).
### Fix 1 — lib/contact-priority-scorer.mjs CLI fallback
`loadAndRank()` now falls back to reading `dashboard/data/contacts-annotated.json`
directly when the dashboard HTML's inline `_CONTACTS_DATA` regex returns
nothing. build-contacts-page.mjs writes the JSON as
`{generated_at, contacts: [...], stats: ...}` (not bare array) — fallback
unwraps via `parsed.contacts` and also handles bare-array shape for
future-proofing.
Closes 5+ consecutive daily failures of phase-B-prime-daily since
2026-05-25 with `FATAL: No _CONTACTS_DATA found`. Root cause: the
dashboard build externalized contacts to dashboard/data/contacts.json
+ contacts-annotated.json, so the inline `var _CONTACTS_DATA = [...]`
array that loadAndRank's regex was looking for no longer exists.
Verified: `loadAndRank({limit:5})` returns 5 ranked contacts via the
fallback (top: Jake Standish / OpenAI, score 8.700).
### Fix 2 — scripts/agents/buttons-smoke-test.mjs concurrent-mutation-aware assertion
"Expected queue size" assertion changed from exact-count match
(`Triage queue: ${snapshot_count} items`) to regex pattern
(`/Triage queue:\s+\d+\s+items\s+in\s+batch\/triage-advance\.tsv/`).
Daemons (community-scan, scan-only, triage) append to
batch/triage-advance.tsv concurrently with the smoke test, so the count
can grow between `snapshotState()` and `batch-runner --dry-run` load.
Canonical incident: snapshot=21, batch-runner read=99 → strict assertion
failed.
The relaxed match still validates that batch-runner reports a queue
size from the expected file — it just doesn't require the count to
match the pre-snapshot exact value.
Verified: smoke now passes 14/14 (was 13/14 with the strict assertion).
### Status of other 3 flapping plists
- `health-column-liveness` — ALREADY FIXED IN MAIN today (sibling). Always
exits 0 now (data/health-column-coverage.json is the signal, not the
exit code). Kickstart cleared flap state (runs=3, last exit 0).
- `scan-email-poll` — BOOTED OUT this session to stop a 181-run OAuth
retry storm (`invalid_grant`, Gmail token revoked). Mitchell action:
re-auth Gmail OAuth + bootstrap plist.
- `network-database-build` — Tahoe TCC denies launchd cwd access to
~/Documents. Wrapper works manually (exit 0) but launchd kickstart
still fails exit 126. Mitchell action: grant Full Disk Access to the
plist OR move cron-run.sh to ~/Library/Application Support/career-ops/.
Audit: .claude/audit/flapping-plist-triage-2026-05-29/notes.md
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves 2 of 5 CRIT flapping plists surfaced by
/system-maintainer+/career-ops-healthPhase 9 (2026-05-29):✅
phase-B-prime-daily— 5+ consecutive daily failures (since 2026-05-25) withFATAL: No _CONTACTS_DATA found. Root cause: dashboard build externalized contacts todashboard/data/contacts-annotated.json, so the inlinevar _CONTACTS_DATA = [...]regex inloadAndRank()no longer matched anything. Fix: CLI fallback that reads the externalized JSON directly + unwrapsparsed.contacts.✅
buttons-smoke— 13/14 pass, 1 assertion failing on exact-count match (Triage queue: ${snapshot_count} items). Root cause: daemons (community-scan, scan-only, triage) append tobatch/triage-advance.tsvconcurrently with the smoke test — count grew from 21 (snapshot) to 99 (batch-runner load). Fix: relaxed to regex pattern that validates batch-runner reports A queue size from the expected file without requiring exact-count match.Status of other 3 flapping plists
health-column-livenessruns=3 last exit 0scan-email-pollinvalid_grant, Gmail token revoked)network-database-buildcron-run.shto~/Library/Application Support/career-ops/Code changes
lib/contact-priority-scorer.mjs— phase-B-prime CLI fallbackVerified:
loadAndRank({limit:5})returns 5 ranked contacts via the fallback (top: Jake Standish / OpenAI, score 8.700).scripts/agents/buttons-smoke-test.mjs— concurrent-mutation-aware assertionVerified: smoke now passes 14/14 (was 13/14 with the strict assertion).
Test plan
node --checkclean on both filesloadAndRankreturns contacts via JSON fallback when_CONTACTS_DATAnot in HTMLnode scripts/maintenance/phase-B-prime-mechanical-enrich.mjs --top 5 --dry-runruns end-to-endnode scripts/agents/buttons-smoke-test.mjsexits 0 with 14/14 PASSRollback
git revert <merge-sha>— both changes are purely additive (new fallback path + relaxed assertion).Out of scope (USER action required)
scan-email-pollOAuth re-auth: Gmail token rotated out. Plist is currently UNLOADED. Mitchell needs to run the OAuth setup script then bootstrap the plist.network-database-buildTahoe Full Disk Access: Requires manual System Settings action OR a structural fix to move the wrapper out of~/Documents/. Documented options in.claude/audit/flapping-plist-triage-2026-05-29/notes.md.🤖 Generated with Claude Code