fix(pdf-quality): Phase 3 timeout + dataset dir permissions#236
Merged
Conversation
First prod test of Phase 3 surfaced two bugs: - Claude timeout was a hardcoded 300s — large chapters (15-20k words) need 10-15 min to rewrite, so every big chapter timed out and was skipped. Now CLEANUP_TIMEOUT env var, default 900s. - data/pdf-cleanup-dataset couldn't be created — data/ is root-owned, the poller runs as the deploy user. `make fix-permissions` now creates + chowns it (via the root alpine container, like the other caches); the poller degrades gracefully (skips pair-logging) if it's missing. Phase 1-2 + the Phase 3 mechanism itself verified working on the test run (chapter cleaned → gate accepted → HTML written back). Co-Authored-By: Claude Opus 4.7 (1M context) <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
First prod test of feat-0007 Phase 3 surfaced two bugs. Phase 1-2 and the
Phase 3 mechanism itself (chapter → Claude → preservation gate → write back)
worked; these two stopped it short.
Bugs fixed
timeout 300was hardcoded. Large chapters(15-20k words) take 10-15 min for Claude to rewrite, so every big content
chapter timed out and was skipped (wasting 5 min each). Now
CLEANUP_TIMEOUTenv var, default 900s.
data/pdf-cleanup-datasetpermission denied —data/is root-owned;the poller runs as the deploy user and can't
mkdirthere.make fix-permissionsnow creates + chowns it via the root alpine container(same pattern as the other caches). The poller also degrades gracefully —
cleanup still runs, only pair-logging is skipped — if the dir is missing.
Changes
infra/scripts/quality-poll.sh—CLEANUP_TIMEOUTenv (default 900s);graceful dataset-dir handling.
Makefile—fix-permissionscreates/chownsdata/pdf-cleanup-dataset..env.example— documentsCLEANUP_TIMEOUT.Tests
bash -nclean;make -n fix-permissionsverified.(
CONTENT_CLEANUP_ENABLED).Rollback plan
Pre-release bug fix to a flag-gated feature — revert the commit if needed,
no runtime impact while
CONTENT_CLEANUP_ENABLEDis off.🤖 Generated with Claude Code