#197: grade cache default off (can't speed up generate re-runs) - #205
Conversation
The #189 grade cache is cross-invocation only (lookups run in the sync prefix before any write of the current run, so there is no intra-run reuse — single-run speed is the #186 asyncio fan-out). Its key mixes a hash of the drafted artefact text, and the drafter is a live, non-deterministic LLM, so a full `signalforge generate` re-run rotates the key and misses on every pair (measured: 370 entries written, 0 read back — docs/research/179-runtime-benchmark.md). Left on by default it silently wrote hundreds of never-hit .signalforge/grade-cache/*.json files and implied a 'fast re-run' UX the architecture can't deliver. Flip GradeConfig.cache_enabled default True -> False. The keying is correct (changed text should re-grade), so the cache stays in the code and is opt-in for the narrow cross-run paths where candidate text is identical (pinned-candidate CI, --no-grade draft-then-grade, resumed grade). Re-key (issue Option 3) rejected; delete deferred — it's the already-correct half of a future draft-cache 'fast re-run' feature. - config.py: default flip + rewritten docstring - grade-ops.md / SKILL.md: correct the overclaiming cache section - tests: default-assertion flip; cache tests opt in via _config_cache_on()
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe PR changes the grade cache behavior from enabled by default to disabled by default (issue ChangesGrade cache off-by-default (issue
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
Summary
Closes the actionable part of #197: the #189 grade cache provides no speed-up on
signalforge generatere-runs, because its key mixes a hash of the drafted artefact text and the drafter is a live, non-deterministic LLM — so every re-draft rotates the key and misses on every pair (measured: 370 entries written, 0 read back;docs/research/179-runtime-benchmark.md).Decision (per the #197 thread): flip
GradeConfig.cache_enableddefaultTrue → False, defer the delete.Why flip rather than delete
grade_artifacts's sync prefix before any write of the current run, so there's zero intra-run reuse. Single-run speed is the grade: parallelise per-(artifact × criterion) calls via asyncio.gather (deferred-to-v0.2 graduation) #186 asyncio fan-out, not the cache..signalforge/grade-cache/*.jsonfiles on the common path and implied a "re-run is fast" UX the architecture can't deliver.grade.cache_enabled: truefor the narrow cross-run paths where candidate text is identical: pinned-candidate CI,--no-gradedraft-then-grade, a resumed grade.Changes
src/signalforge/grade/config.py—cache_enableddefaultTrue → False+ rewritten docstring (cross-run-only, non-determinism caveat, opt-in guidance).docs/grade-ops.md— corrected the overclaiming "Grade cache" section (the "re-run hits cache on every pair" claim was the false one), the field reference, the yml example, and the hits/misses guidance.src/signalforge/skills/signalforge/SKILL.md— same correction on the parity surface.tests/grade/test_config.py— default-assertion flipped (..._defaults_false+ the DEC-defaults block).tests/grade/test_engine.py— new_config_cache_on()opt-in helper; the ~11 cache-behaviour tests (which relied on the old default-on) now opt in.Validation
uv run pytest tests/grade/ tests/cli/test_generate.py tests/cli/test_cache.py tests/cli/test_skill_cli_parity.py --no-cov→ 532 passed.ruff check/ruff format --checkclean on changed files.Follow-on (separate ticket, only if "fast re-run" is wanted)
A draft cache keyed on stable draft inputs (model
raw_codehash, neighbour manifest summary,prompt_version,exclude_tests, provider/model) that composes with this grade cache — identical re-drafted text → grade cache hits for free.Refs #197.
Summary by CodeRabbit
Bug Fixes
Documentation