Ralph Loop 2026-03-16: Latest State Freshness
Change
Added explicit freshness metadata for PRD 003/004 handoff quality.
Files:
- research/continuous_loop.py
- research/status.py
- research/discord_status.py
- research/README.md
- tests/test_research_status.py
Why
The previous status output could show a stale loop snapshot beside a freshly recomputed replay check without making the age gap obvious. That weakened candidate-review quality because handoff consumers had to infer whether latest_state.json was still trustworthy.
Result
research/latest_state.json now carries a freshness block with:
- state generation timestamp
- candidate-review generation timestamp
- latest scan timestamp
- warning thresholds for each timestamp
Status and Discord summaries now compute concrete ages and mark stale sections explicitly.
Current smoke output shows the real bottleneck clearly:
state_age=55802s stale=Truecandidate_review_age=0s stale=Falselatest_scan_age=55803s stale=True- notes include
latest_state_differs_from_current_replay_rows,latest_state_is_stale, andlatest_scan_is_stale
That means the stored loop handoff is old, while the candidate-review packet is being refreshed from current live rows.
Validation
Commands run:
pytest -q tests/test_research_status.py tests/test_candidate_review.py
python3 -m py_compile research/continuous_loop.py research/status.py research/discord_status.py
python3 research/status.py
python3 research/discord_status.py
Observed behavior:
- Focused tests passed:
7 passed - Updated modules compiled cleanly.
- Human and Discord status now expose concrete freshness ages and stale warnings.
Next bottleneck
Freshness is now visible, but the stored loop snapshot is still materially behind the current replay rows. The next bounded change should either refresh latest_state.json more aggressively or make the replay/candidate-review handoff path less dependent on the last completed loop cycle.