Files
webdev-pipeline/backlog/tasks/task-25 - Harden-website-enrichment-against-Convex-action-runtime-aborts.md

44 lines
2.3 KiB
Markdown

---
id: TASK-25
title: Harden website enrichment against Convex action runtime aborts
status: In Progress
assignee: []
created_date: '2026-06-05 06:59'
updated_date: '2026-06-05 07:04'
labels: []
dependencies: []
priority: high
ordinal: 27000
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Website enrichment actions can be killed by Convex with a transient invalid environment error before the JS catch block runs, leaving runs without normal failure finalization or PageSpeed queueing. Add an internal action runtime budget so long browser/bootstrap/crawl work fails inside the action before the platform aborts it.
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Website enrichment has an action-level runtime budget below the Convex runtime abort window
- [x] #2 Long Chromium bootstrap, browser launch, crawl, link checks, and screenshots are bounded by remaining action time
- [x] #3 When the runtime budget is exceeded, the existing catch path finalizes the enrichment run and queues PageSpeed for the lead
- [x] #4 Regression tests cover the runtime budget guard and full verification passes
<!-- AC:END -->
## Implementation Plan
<!-- SECTION:PLAN:BEGIN -->
1. Add RED source regression for action runtime budget and bounded browser/crawl steps
2. Implement minimal runtime budget helper in websiteEnrichmentAction
3. Run tests/type/lint and deploy Convex dev
4. Record findings and leave task open pending manual retest
<!-- SECTION:PLAN:END -->
## Implementation Notes
<!-- SECTION:NOTES:BEGIN -->
2026-06-05: Investigation found latest website_enrichment run was manually set to failed, but Convex logs show the underlying action ended with "Transient error while executing action" and environment "invalid" before app-level catch/finalization ran. This explains missing finishedAt/errorSummary/PageSpeed follow-up.
2026-06-05: Implemented action-level budget guard (default 120s, TASK8_ACTION_BUDGET_MS override) around Playwright import, Chromium executable resolution, AL2023 library preparation, browser launch/context creation, page crawls, internal link checks, and desktop/mobile screenshots so long work rejects inside the action catch path before Convex invalidates the runtime. Verified with targeted website-enrichment action tests, full pnpm test, TypeScript, lint, and Convex dev typecheck/deploy.
<!-- SECTION:NOTES:END -->