Skip to content

feat(task): add per-run cache controls - #11396

Merged
jdx merged 6 commits into
mainfrom
agent/task-cache-run-controls
Jul 28, 2026
Merged

jdx merged 6 commits into
mainfrom
agent/task-cache-run-controls

Conversation

@jdx

@jdx jdx commented Jul 28, 2026 •

Copy link
Copy Markdown
Owner

What

  • add --task-cache and MISE_TASK_CACHE per-run controls
  • support read-write, read-only, write-only, off, and local-only modes
  • preserve stable dependency cache keys only when an artifact is restored or successfully published
  • document the modes and mark the parity tracker item complete

Why

CI and local workflows need to control cache consumption and publication independently. Read-only mode lets untrusted jobs consume existing results without publishing misses, write-only mode warms the cache without consuming entries, and off mode provides a clean diagnostic path.

Impact

This is experimental and only affects tasks with task output caching enabled. The default remains read-write. local-only currently matches read-write behavior because remote caching is not yet implemented, while establishing the per-run contract needed for that follow-up.

Stack

Checks

  • mise run lint
  • mise run test:e2e e2e/tasks/test_task_artifact_cache e2e/tasks/test_task_artifact_cache_modes
  • cargo test --bin mise task_cache
  • mise run docs:build
  • mise run render:usage
  • git diff --check

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


Note

Medium Risk
Changes when cached artifacts are read, written, and how dependents see keys; default read-write preserves prior behavior, but mis-set modes in CI could skip restores or publish unwanted entries.

Overview
Adds --task-cache and MISE_TASK_CACHE so a single run can control the experimental task output cache independently of task config. Modes are read-write (default), read-only, write-only, off, and local-only (documented as equivalent to read-write until remote cache exists).

The executor now gates artifact restore, skip-via-current-output, mark_current, and store on per-mode reads() / writes(). off disables artifact caching and keeps normal sources freshness behavior. The experimental check for artifact caching only runs when the run mode is not off. Bootstrap and naked task entry points pick up TaskCacheMode::from_env() so mise build honors MISE_TASK_CACHE like mise run.

Docs, usage/man output, parity tracker, and e2e coverage (test_task_artifact_cache_modes, --task-cache off in global-env test) accompany the change. This is separate from --no-cache (remote task definitions).

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

Summary by CodeRabbit

  • New Features
    • Added per-run task output caching control via --task-cache <mode> (also MISE_TASK_CACHE) for both mise run and mise tasks run.
    • Supported modes: read-write (default), read-only, write-only, local-only, and off (local-only acts like read-write without remote caching).
  • Documentation
    • Updated CLI help, man page, and task configuration docs to describe the new flag, modes, and scope for the experimental task output cache.
  • Tests
    • Added e2e coverage for all cache modes, restore/publish behavior, and invalid value validation (plus environment-related caching expectations).

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds --task-cache and MISE_TASK_CACHE support with five cache modes, propagates the setting through task execution, gates cache reads and writes accordingly, and documents and tests the behavior.

Changes

Per-run task cache modes

Layer / File(s) Summary
Cache mode contract and CLI wiring
src/task/task_cache.rs, src/task/mod.rs, src/cli/run.rs, src/cli/mod.rs, src/cli/bootstrap.rs, mise.usage.kdl
Defines TaskCacheMode, parses MISE_TASK_CACHE, exposes --task-cache on both run commands, and passes the selected mode into task execution.
Executor cache read and write gating
src/task/task_executor.rs, src/cli/run.rs
Propagates the mode through TaskExecutor and gates cache preparation, restoration, state updates, output capture, and cache-key generation based on read/write permissions.
Behavior documentation and validation
docs/cli/run.md, docs/cli/tasks/run.md, docs/tasks/task-configuration.md, e2e/tasks/test_task_artifact_cache_modes, e2e/tasks/test_task_artifact_cache_global_env, TASK_CACHE_PARITY.md, man/man1/mise.1
Documents supported modes and validates read-only, write-only, local-only, off, environment, and invalid-value behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant mise run
  participant TaskExecutor
  participant TaskArtifactCache
  User->>mise run: select --task-cache mode
  mise run->>TaskExecutor: pass TaskCacheMode
  TaskExecutor->>TaskArtifactCache: restore when reads are enabled
  TaskExecutor->>TaskArtifactCache: publish when writes are enabled
  TaskExecutor-->>mise run: return task result
Loading

Possibly related PRs

  • jdx/mise#11328: Adds the task artifact cache behavior controlled by this per-run mode.
  • jdx/mise#11340: Modifies the overlapping task execution and cache-key path.
  • jdx/mise#11347: Changes cached output replay in the overlapping task execution flow.

Poem

I’m a rabbit with caches tucked tight,
Reading by day, writing by night.
Five little modes hop into play,
Tests keep the carrots from straying away,
And docs mark the burrow just right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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: adding per-run task cache controls.

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.

Comment thread src/task/task_executor.rs Resolved
@greptile-apps

greptile-apps Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds per-run task artifact-cache modes and propagates the selected mode through normal, naked, and bootstrap task execution.

  • Introduces read-write, read-only, write-only, off, and local-only controls through the CLI and MISE_TASK_CACHE.
  • Gates artifact restoration, publication, and cache-backed freshness behavior according to the selected mode.
  • Adds mode-focused end-to-end coverage and updates generated CLI and task-cache documentation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/cli/mod.rs The naked-task synthetic Run now reads MISE_TASK_CACHE, resolving the previously reported environment-mode loss.
src/cli/bootstrap.rs Bootstrap-created task runs now propagate the environment-selected cache mode.
src/cli/run.rs Adds the cache-mode CLI option and passes it into task execution and experimental-feature validation.
src/task/task_cache.rs Defines cache-mode parsing and the read, write, and enabled capability checks.
src/task/task_executor.rs Applies mode-specific gates to cache preparation, restoration, state updates, output capture, and publication.
e2e/tasks/test_task_artifact_cache_modes Covers each cache mode, invalid values, and the previously reported naked invocation using MISE_TASK_CACHE.

Reviews (6): Last reviewed commit: "fix(task): preserve cache env when disab..." | Re-trigger Greptile

Comment thread src/cli/mod.rs Resolved
@github-actions

github-actions Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Instruction counts

benchmark trend instructions Δ wall (min) Δ
env ▁▁▁▃▂█▆▅▇█ 84,286,066 → 84,294,632 +0.01% 21.35 → 21.17ms -0.83%
hook-env ▁▃▃▄▆▆▅▄▄█ 86,845,016 → 87,034,434 +0.22% 23.71 → 22.13ms -6.70%
ls ▁▇▆▇██▇█▇█ 76,321,308 → 76,340,689 +0.03% 17.68 → 19.02ms +7.58%
registry ▃▁▂▂▄▆▆▆▇█ 50,040,954 → 50,084,961 +0.09% 13.15 → 12.55ms -4.51%
startup ▇▁▁▂▃▇▆▇▆█ 15,672,973 → 15,692,069 +0.12% 8.93 → 9.16ms +2.60%

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.

9729ba11417a vs 8326b22f0791 · measured on the runner, not pushed to the history.

Base automatically changed from agent/task-cache-lockfile-inputs to main July 28, 2026 01:55
@jdx
jdx force-pushed the agent/task-cache-run-controls branch from bd0deff to deeb33c Compare July 28, 2026 02:38

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@man/man1/mise.1`:
- Around line 3151-3155: Update the duplicated task output caching mode
descriptions in man/man1/mise.1 at lines 3151-3155 and 3925-3929: clarify in the
local-only entry that, because remote caching is not implemented, it is
currently equivalent to read-write and does not provide distinct behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: 474ebcfe-2703-4cda-a6db-c89519a0f0e4

📥 Commits

Reviewing files that changed from the base of the PR and between 8f40006 and bd68b21.

📒 Files selected for processing (1)
  • man/man1/mise.1

Comment thread man/man1/mise.1 Resolved
@jdx
jdx enabled auto-merge (squash) July 28, 2026 03:09

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

Comment thread src/task/task_executor.rs Resolved
@jdx
jdx disabled auto-merge July 28, 2026 03:34
@jdx
jdx enabled auto-merge (squash) July 28, 2026 03:47
@jdx
jdx merged commit 1909b9e into main Jul 28, 2026
36 checks passed
@jdx
jdx deleted the agent/task-cache-run-controls branch July 28, 2026 03:56
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