Skip to content

feat(cache): report action cache phase timings - #12077

Merged
jdx merged 2 commits into
mainfrom
codex/cache-phase-timings
Aug 16, 2026
Merged

jdx merged 2 commits into
mainfrom
codex/cache-phase-timings

Conversation

@jdx

@jdx jdx commented Aug 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add a versioned JSON report for Rust action-cache session activity, bytes, request counts, and phase timings
  • measure manifest/action lookups, individual blob transfers, local CAS writes, prefetch, and output materialization
  • report restored files/bytes and compiler invocations avoided
  • preserve the existing summary while adding a concise human-readable timing line

Configuration

Set task.cache.stats_report or MISE_TASK_CACHE_STATS_REPORT to the report path. Timing values are nanoseconds; concurrent phase values are cumulative work and may exceed the end-to-end session duration.

The current client still fetches blobs individually, so the schema intentionally reports remote_blob_requests and blob-transfer time. This gives follow-up packed-transfer work a measurable baseline without claiming a protocol path that is not in use.

Validation

  • mise run lint-fix
  • cargo test --locked -p mise-cache-core --no-fail-fast
  • cargo test --locked --bin mise cache::session --no-fail-fast
  • cargo clippy --locked -p mise-cache-core --all-features --all-targets -- -D warnings
  • cargo clippy --locked --bin mise --all-features -- -D warnings
  • mise run test:e2e e2e/tasks/test_task_rust_cache_restore
  • mise run render:schema

AI-assisted — Tool: Codex; model: unavailable/unavailable; version: unavailable.


Note

Low Risk
Additive metrics and optional file output; agent protocol gains required restore fields on hit/verification requests, which must stay in sync with rustc shims in the same release.

Overview
Adds observability for Rust action-cache sessions: phase timings, remote request counts, restored output volume, and an optional versioned JSON report for CI/benchmarking.

Instrumentation extends the cache agent with RestoreStats on hit/verification records so the rustc adapter reports materialization time and restored file/byte counts. Remote manifest/action lookups, per-blob transfers, local CAS writes, and prefetch runs are timed and counted via AtomicDurationTimer and new AgentStats fields. Session end-to-end duration is set when the cache session finishes.

User-facing output: task.cache.stats_report / MISE_TASK_CACHE_STATS_REPORT writes a v1 JSON report atomically after mise run; the stderr summary gains a second line with cumulative phase timings (nanoseconds). Schema and settings document the new option; e2e restore test asserts the report shape.

Reviewed by Cursor Bugbot for commit 984a1c1. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • Added optional action-cache session statistics reports in versioned JSON format.
    • Reports include cache hits and misses, avoided compiler work, data transfers, restored outputs, file and byte counts, and operation timing.
    • Reports are written atomically to the configured path, with parent directories created automatically.
    • Added configuration through task.cache.stats_report or MISE_TASK_CACHE_STATS_REPORT.
  • Improvements

    • Cache restoration and remote operations now provide more detailed performance metrics.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: ab4c97ed-3aa7-4959-ab72-a7441bcb467a

📥 Commits

Reviewing files that changed from the base of the PR and between 4b36fd6 and 984a1c1.

📒 Files selected for processing (1)
  • crates/mise-cache-core/src/agent.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/mise-cache-core/src/agent.rs

Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The cache agent now records restoration, remote-transfer, prefetch, CAS, and timing metrics. Cache sessions can write versioned JSON reports through the new task.cache.stats_report setting. Rust cache restoration forwards output and materialization statistics.

Changes

Cache statistics

Layer / File(s) Summary
Agent metrics and request contracts
crates/mise-cache-core/src/agent.rs, crates/mise-cache-core/src/lib.rs
Adds RestoreStats, expands AgentStats, instruments cache operations, and records restoration aggregates.
Restore metric propagation
src/cache/rustc.rs
Measures restored files, bytes, and materialization time. Forwards these values for action hits and verification.
Session report configuration and output
src/cache/session.rs, schema/mise.json, settings.toml, e2e/tasks/test_task_rust_cache_restore
Adds session timing, versioned JSON report generation, atomic writes, configuration, and end-to-end validation.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 984a1

The change is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

Possibly related PRs

  • jdx/mise#11328: Implements local artifact-cache restores that this PR measures.
  • jdx/mise#11817: Introduces Rust cache restoration and action-hit paths extended by these metrics.
  • jdx/mise#11932: Modifies Rust cache output materialization paths instrumented by this PR.

Poem

A rabbit counts each cached byte,
And times the blobs that hop in flight.
Restored files join the report,
Atomic paths keep data short.
“Hop!” says the cache, with metrics bright.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: reporting action-cache phase timings.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a versioned action-cache statistics report with request counts, transfer volumes, restored-output metrics, and phase timings while retaining the existing console summary.

  • Instruments remote manifest and action lookups, blob transfers, local CAS writes, prefetch runs, and output materialization.
  • Adds task.cache.stats_report and MISE_TASK_CACHE_STATS_REPORT configuration.
  • Correctly excludes qualification-only staged outputs from restored file and byte totals.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported qualification-accounting issue is fixed because verification records materialization timing without adding staged outputs to restored file or byte totals.

Important Files Changed

Filename Overview
crates/mise-cache-core/src/agent.rs Adds atomic phase metrics and restore accounting; verification now records only materialization duration, so the previously reported restored-output inflation is fixed.
src/cache/rustc.rs Measures cached-output materialization and distinguishes persisted cache hits from qualification-only staging.
src/cache/session.rs Tracks session duration, emits the versioned JSON report atomically, and adds concise timing output.
settings.toml Defines the optional statistics-report path and documents timing semantics.
e2e/tasks/test_task_rust_cache_restore Extends cache restoration coverage to validate the generated report and its key counters.

Reviews (2): Last reviewed commit: "fix(cache): exclude verified outputs fro..." | Re-trigger Greptile

Comment thread src/cache/rustc.rs Resolved

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4b36fd6. Configure here.

Comment thread crates/mise-cache-core/src/agent.rs Resolved
@github-actions

github-actions Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Instruction counts

Nothing was compared, and so nothing was gated. No series appears on both sides: either the base has no measurements recorded, or the two were measured on different runner classes, which are deliberately not comparable — counts shift between machine types by more than a real regression does.

New, nothing to compare against: env on bamboo-v2-ubuntu24.04-x64-30vcpu-24gb-rust1.97.1, hook-env on bamboo-v2-ubuntu24.04-x64-30vcpu-24gb-rust1.97.1, ls on bamboo-v2-ubuntu24.04-x64-30vcpu-24gb-rust1.97.1, registry on bamboo-v2-ubuntu24.04-x64-30vcpu-24gb-rust1.97.1, startup on bamboo-v2-ubuntu24.04-x64-30vcpu-24gb-rust1.97.1

Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run.

Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.

984a1c11625b vs 6bb08b5d701d · measured on the runner, not pushed to the history.

@jdx
jdx enabled auto-merge (squash) August 16, 2026 21:47
@jdx
jdx merged commit e20aef9 into main Aug 16, 2026
32 checks passed
@jdx
jdx deleted the codex/cache-phase-timings branch August 16, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant