← Back to Pull requests

fix(state): preserve completed cron runs on resume #131434

Open
unknown opened this pull request with 294 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 02, 2026 11:22 UTC
Author

What does this PR do

Preserves a positively classified cron scheduler outcome separately from the mutable session lifecycle. Finalized cron history remains eligible for continuation after resume, while the resumed session becomes live and can record a later close normally. Cleanup/orphan rows remain read-only, and deliberate current closes cannot be replaced by compression publication.

Provenance

  • andrexibiza (Axl Ibiza): original diagnosis, mechanism, and repair direction in the published inline diagnosis and RCA.

  • DireMunchkin: production corroboration and issue report in #131433.

  • dskwe: implementation and regression coverage in this PR.
  • Changes made

  • Added one shared classifier for cron_complete and cron_incomplete_no_output.

  • Persisted the scheduler outcome for new finalizations and backfilled it atomically for legacy rows during resume.

  • Kept normal resume semantics: ended_at and end_reason are cleared so a later close records a fresh lifecycle boundary.

  • Exposed the classifier to backend session projections and the Desktop cron write gate; explicit cron_finalized: false takes precedence over timestamps, with a separate legacy fallback.

  • Allowed lease-backed compression for finalized cron history only when the current boundary is eligible; a later deliberate close remains authoritative.
  • Tests

  • /Users/liyuan/github/ai/hermes-agent/venv/bin/python3 -m pytest tests/hermes_cli/test_session_system_prompt_dedup.py tests/hermes_state/test_cron_attempt_classifier.py -q — 18 passed.

  • /Users/liyuan/github/ai/hermes-agent/venv/bin/python3 -m pytest tests/hermes_cli/test_session_system_prompt_dedup.py tests/hermes_state/test_cron_attempt_classifier.py tests/hermes_state/test_hermes_state.py tests/hermes_cli/test_cron_run_scheduler_ownership.py -q -k 'finalized_cron or cron_attempt_classifier or reopen or end_session or scheduler_owned' — 12 passed, 302 deselected.

  • git diff --check and Python compileall on changed modules — passed.

  • Desktop cron Vitest was not available in this checkout (vitest: command not found).
  • Fixes #131433

    Diff: 294 lines (+220 / -74) across 3 files Reviewer: DireMunchkin Review duration: 85970m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.47) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 294 lines diff across 3 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.340
    Real PR Conversation Timeline
    1 comments
    "Review active on #131434"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 46.9% (MEDIUM) · Higher = larger blast radius
    46.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26.0% · Safe to merge
    26.0%