Skip to content

feat(task): report task cache statistics - #11601

Merged
jdx merged 1 commit into
agent/task-cache-explain-jsonfrom
agent/task-cache-stats
Aug 1, 2026
Merged

feat(task): report task cache statistics#11601
jdx merged 1 commit into
agent/task-cache-explain-jsonfrom
agent/task-cache-stats

Conversation

@jdx

@jdx jdx commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • add --task-cache-stats for an opt-in per-run cache summary
  • report artifact lookup hit rate, uncompressed restored bytes, and recorded execution time saved
  • persist compatible metrics in cache manifests while defaulting older entries to zero
  • exclude freshness skips from cache lookup totals and document the behavior

Why

Cache hits were individually visible, but users could not assess the aggregate benefit of caching across a run.

User impact

Users can run mise run --task-cache-stats <task> to receive a summary such as Task cache: 1/1 hits (100%), 10 B restored, 6.4ms saved. Existing cache entries remain readable; older entries contribute zero bytes and time until rewritten.

Validation

  • cargo test stats -- --nocapture
  • mise run test:e2e e2e/tasks/test_task_artifact_cache
  • mise run render
  • mise run lint
  • cargo clippy --workspace --all-features --all-targets -- -D warnings

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


Note

Low Risk
Additive CLI and manifest fields with backward-compatible defaults; behavior is observability-only and does not change cache keying or restore logic beyond recording metrics.

Overview
Adds --task-cache-stats to mise run for an opt-in end-of-run summary of experimental task output cache lookups: hit rate, uncompressed bytes restored, and execution time saved from manifest metadata.

Cache manifests now record restored_bytes (archive + captured log bytes) and execution_duration_ns when entries are written; restores surface those fields on hits and older entries deserialize with zeros. TaskExecutor aggregates per-run hits/misses and metrics; freshness skips that never hit the artifact cache are excluded from totals (Task cache: no lookups).

The flag conflicts with --dry-run; docs, usage spec, man pages, parity tracker, and e2e coverage are updated.

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

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: 2a0e3817-7ffa-4fc7-90fe-4084e7571635

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@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 ede2f60. Configure here.

Comment thread src/cli/run.rs
@greptile-apps

greptile-apps Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds opt-in aggregate task-cache statistics and persists compatible byte and execution-duration metadata in cache manifests.

  • Tracks cache hits and misses across task execution.
  • Reports restored bytes and recorded execution time saved.
  • Keeps older cache manifests readable through zero-valued defaults.
  • Updates generated CLI documentation and end-to-end coverage.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/cli/run.rs Adds the CLI flag and prints aggregate cache statistics after task result processing, including on failed runs.
src/task/task_cache.rs Persists backward-compatible restored-byte and execution-duration metadata and returns it with cache hits.
src/task/task_executor.rs Accumulates cache lookup statistics and records command execution duration when storing successful results.
e2e/tasks/test_task_artifact_cache Covers hits, misses, freshness skips, failed tasks, and the dry-run flag conflict.

Reviews (2): Last reviewed commit: "feat(task): report task cache statistics" | Re-trigger Greptile

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Instruction counts

benchmark trend instructions Δ wall (min) Δ
env ▁▁▅▅▄▄▂▃▄▄▂█▃▄ 84,768,161 → 84,817,059 +0.06% 18.30 → 18.24ms -0.35%
hook-env ▃▁▆▇▅▅▂▄▃▄▆█▄▇ 87,107,664 → 87,190,487 +0.10% 27.66 → 19.55ms -29.33%
ls ▁▂▆▅▆▆▄▅▄▅▅█▆▆ 76,738,032 → 76,754,461 +0.02% 15.51 → 16.49ms +6.31%
registry ▅▃▁▁█▇▇████▄▂▅ 50,296,101 → 50,369,232 +0.15% 10.91 → 11.78ms +8.05%
startup ▄▄▄▄▄▄▄▄▄▄▄▇▁█ 16,054,361 → 16,171,578 +0.73% 7.81 → 8.61ms +10.29%

No instruction-count regression above 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.

ac6b27b187f8 vs aec80d623194 · measured on the runner, not pushed to the history.

@jdx
jdx force-pushed the agent/task-cache-stats branch from ede2f60 to ac6b27b Compare August 1, 2026 22:23
@jdx
jdx merged commit 80d6f9f into main Aug 1, 2026
38 of 47 checks passed
@jdx
jdx deleted the agent/task-cache-stats branch August 1, 2026 23:26
This was referenced Aug 1, 2026
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