day 7 cold-run resolve cap + result dedup + tuning-knob hardening - #7
Merged
Conversation
Knobs for the cold-run bound + a fail-fast validator, from Day-7 validation and three adversarial-review rounds: - RESOLVE_CANDIDATE_LIMIT (75), JOB_TIMEOUT_S (900), WORKER_MAX_JOBS (1); and GATE1_ASYNC_THRESHOLD 15->5 so it stays <= GATE2 (closes the inline-resolve-then-defer dead band). All env-tunable, passed through compose. - WORKER_MAX_JOBS=1 because cold work is MusicBrainz-bound: worker concurrency shares one ~1 req/s limiter, so >1 only multiplies latency + embed memory. - _validate_tuning (at import) rejects incoherent values: non-positive knobs, a cap that can't finish in the timeout under concurrency (max_jobs*N*cost), and GATE1 > GATE2. - app Gate-1 counts uncached only within the capped top-N; worker reads job_timeout/max_jobs from config.
- Resolve/embed only the top-N (RESOLVE_CANDIDATE_LIMIT) cultural candidates and backfill the rest culturally. A 194-candidate seed had overrun job_timeout at 85 resolved (~7s each via MusicBrainz ~1 req/s); the cap bounds + scales it. - Dedup results on the verified resolver MBID and drop the seed's own MBID, so two credits for one recording can't both appear and the seed can't recommend itself (both reproduced in a live container run).
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.
The first real Docker run of the Day-6 image surfaced that a popular seed's cold recommendation overruns the worker timeout: MusicBrainz's
1 req/s (×3 paced calls/candidate ≈ 7s each) makes resolving a full 100–200 candidate pool infeasible, so a 194-candidate seed was cancelled at 85 resolved. This caps resolve+embed to the top-N cultural candidates (RESOLVE_CANDIDATE_LIMIT, default 75) and backfills the rest culturally, bounding cold latency while the lazy corpus still grows across queries. Three review rounds then hardened the edges —GATE1_ASYNC_THRESHOLDdrops to 5 (≤ Gate 2, closing the inline-resolve-then-defer dead band),WORKER_MAX_JOBS=1since cold jobs share one MB limiter so concurrency only adds latency, a_validate_tuningimport guard rejects incoherent knob combinations, and results dedupe on the verified resolver MBID and exclude the seed's own recording (a duplicate and a seed-alias leak were both reproduced live). 261 passed / 4 skipped across the offline gate and the--run-dbsuite; the full image build/run validation and the VPS deploy are the remaining Day-7 work.