← Back to Pull requests

feat(api): add full checkpoint persistence, capability flag, admission, and restore routing #3107

Closed
unknown closed this pull request without merging on Dec 01, 2026 10:10 UTC
View on GitHub
unknown unknown commented on Nov 26, 2026 08:35 UTC
Author

TL;DR

Adds apps/api persistence, MEMORY_CHECKPOINTS_ENABLED gating and deployment forwarding, source-state/capability admission, archive kind validation, and runner capability routing for full checkpoints, remaining disabled by default.

Design doc: https://github.com/boxlite-ai/boxlite/issues/3109

Documentation: [docs/contributing/architecture/platform/api.md](docs/contributing/architecture/platform/api.md), [docs/contributing/architecture/platform/schema.md](docs/contributing/architecture/platform/schema.md), [apps/api/README.md](apps/api/README.md), [apps/infra/docs/configuration.md](apps/infra/docs/configuration.md)

How it works

A pre-deploy migration adds kind (default 'disk') and nullable memorySizeBytes to checkpoint. apps/infra (mstage.env.json and mdeploy/stack/index.ts) forwards optional MEMORY_CHECKPOINTS_ENABLED (default 'false') to the API, and GET /v1/config exposes memory_checkpoints_enabled. When enabled, CheckpointService requires STARTED boxes (409 invalid_state otherwise) and a source runner with memory_checkpoint (400 unsupported otherwise), emits kind on export/import jobs, normalizes omitted callback kind to 'disk' when validating export/upload archives, and persists/returns memory_size_bytes.

Verification

  • cd apps/infra && npm run --silent typecheck:mdeploy && npm exec -- tsx --conditions=development --test mdeploy/test/api-environment.test.ts mdeploy/test/stack.test.ts → passed (121/121).

  • cd apps && yarn nx run api:build:production --skipTypeChecking=false & yarn nx run api:lint → passed.

  • make test:apps:api TEST_FILES="checkpoint|box-state-waiter" → 4 unit suites, 81 passed.

  • Gaps: Postgres-backed migration/integration specs skipped locally without DB_HOST/REDIS_HOST (covered by CI).
  • Diff: 227 lines (+170 / -57) across 2 files Reviewer: DefeatMan Review duration: 7294m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 227 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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
    Diff Size diff_size
    0.325
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3107"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 36.9% (MEDIUM) · Higher = larger blast radius
    36.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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 14.6% · Safe to merge
    14.6%