Skip to content

feat(task): audit artifact cache declarations - #11617

Merged
jdx merged 1 commit into
agent/task-cache-benchmarksfrom
agent/task-cache-audit
Aug 3, 2026
Merged

jdx merged 1 commit into
agent/task-cache-benchmarksfrom
agent/task-cache-audit

Conversation

@jdx

@jdx jdx commented Aug 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add an opt-in cache.audit mode for task artifact cache declarations
  • trace Linux task execution with strace and warn about undeclared project reads and writes
  • keep auditing advisory, bounded, and disabled when tracing is unavailable
  • expose the option in task schemas and documentation
  • cover classification, cache publication, and task-info serialization

Validation

  • mise run test:e2e e2e/tasks/test_task_artifact_cache_audit e2e/tasks/test_task_info
  • cargo test --all-features task_cache_audit::tests -- --nocapture
  • cargo clippy --workspace --all-features --all-targets -- -D warnings
  • mise run lint-fix
  • mise run render:schema

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


Note

Low Risk
Changes are opt-in and Linux-only for tracing; execution path only wraps commands when audit is enabled, with graceful fallback when strace is unavailable.

Overview
Adds opt-in cache.audit on experimental task artifact caching so teams can spot incomplete sources / outputs declarations.

On Linux, when audit is enabled and caching is on, mise wraps the real task command with strace, parses file syscalls after the run, and warns about undeclared reads under the workspace source root and undeclared writes under the task directory. Auditing is advisory (tasks still succeed and can still be cached); it is skipped for raw/dry-run runs, when strace is missing, or on non-Linux (warn once). Cache hits do not run the task, so mise run --force is needed to audit an existing entry.

Configuration is wired through TaskCacheConfig, JSON schemas, docs, and mise tasks info. Source matching for audits reuses a shared task_source_match_root helper extracted from the source checker.

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

@coderabbitai

coderabbitai Bot commented Aug 2, 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: 3874395b-566a-4ea1-a274-82cdd3e4b3b0

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.

@greptile-apps

greptile-apps Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds an opt-in Linux task-cache audit that traces filesystem activity and warns about accesses outside declared sources and outputs.

  • Adds cache.audit configuration, schema, documentation, and task-info serialization.
  • Wraps eligible task execution with strace, classifies traced reads and writes, and keeps auditing advisory when tracing is unavailable.
  • Adds unit and end-to-end coverage for trace parsing, declaration matching, and cache publication.

Confidence Score: 4/5

The PR is not yet safe to merge because relative non-*at filesystem accesses after a subprocess changes directory can still be audited against the wrong path.

The new fd-annotation parsing corrects relative openat and openat2 accesses, but unannotated relative paths from supported syscalls such as rename, unlink, chmod, and open still fall back to the task's initial root without tracking subprocess working-directory changes, leaving the previously reported false-warning and missed-access behavior reachable.

Files Needing Attention: src/task/task_cache_audit.rs

Important Files Changed

Filename Overview
src/task/task_cache_audit.rs Implements strace discovery, task wrapping, trace parsing, declaration matching, and bounded warnings; the previously reported changed-directory resolution issue remains for relative non-*at syscalls.
src/task/task_executor.rs Integrates advisory auditing into non-raw, non-dry-run task execution and reports the trace after execution.
src/task/task_source_checker.rs Extracts the shared source matching root used by both cache input matching and audit classification.
src/task/task_cache.rs Extends task artifact cache configuration with the opt-in audit flag.
schema/mise-task.json Exposes the task-level cache.audit boolean in the generated task schema.
schema/mise.json Exposes cache.audit for task-local and scoped default cache configuration.
e2e/tasks/test_task_artifact_cache_audit Covers declared and undeclared read/write warnings and verifies audited executions can still publish cache entries.

Reviews (11): Last reviewed commit: "feat(task): audit artifact cache declara..." | Re-trigger Greptile

Comment thread src/task/task_cache_audit.rs Resolved
@jdx
jdx force-pushed the agent/task-cache-audit branch from 8964563 to 4efc855 Compare August 2, 2026 01:52
Comment thread src/task/task_cache_audit.rs Resolved
Comment thread src/task/task_cache_audit.rs Resolved
@jdx
jdx force-pushed the agent/task-cache-audit branch from 4efc855 to dc0509a Compare August 2, 2026 01:58
@github-actions

github-actions Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Instruction counts

benchmark trend instructions Δ wall (min) Δ
env ▃▆▂▁▁▂▆▅▅█ 80,074,952 → 80,111,775 +0.05% 17.64 → 18.37ms +4.10%
hook-env ▇▆▁▄▃▂▅▃▆█ 82,190,914 → 82,253,634 +0.08% 18.34 → 19.04ms +3.83%
ls ▅▃▁▁▁▆▆▆▅█ 73,127,800 → 73,205,035 +0.11% 15.71 → 16.64ms +5.89%
registry ▁▁▂▂▃▆▆█▂▁ 49,102,713 → 49,091,722 -0.02% 11.64 → 11.93ms +2.43%
startup ▃▃▁▃▂▁▂▂▃█ 15,784,751 → 15,826,996 +0.27% 9.04 → 9.28ms +2.64%

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.

db83e203de06 vs e5230aa14775 · measured on the runner, not pushed to the history.

@jdx
jdx force-pushed the agent/task-cache-audit branch from dc0509a to f46ea52 Compare August 2, 2026 02:08

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

Comment thread src/task/task_cache_audit.rs Resolved
@jdx
jdx force-pushed the agent/task-cache-audit branch from f46ea52 to ceb86bb Compare August 2, 2026 02:19
@jdx
jdx force-pushed the agent/task-cache-audit branch from ceb86bb to 7f3c9cd Compare August 2, 2026 02:26
@jdx
jdx force-pushed the agent/task-cache-audit branch from 7f3c9cd to 00d378b Compare August 2, 2026 02:36
@jdx
jdx force-pushed the agent/task-cache-audit branch 3 times, most recently from 11bbabf to dd59e34 Compare August 2, 2026 13:09
@jdx
jdx force-pushed the agent/task-cache-audit branch from dd59e34 to db83e20 Compare August 2, 2026 15:18
@jdx
jdx merged commit 4eb3e64 into main Aug 3, 2026
31 checks passed
@jdx
jdx deleted the agent/task-cache-audit branch August 3, 2026 03:04
donbeave pushed a commit to donbeave/mise that referenced this pull request Aug 3, 2026
## Summary
- add an opt-in `cache.audit` mode for task artifact cache declarations
- trace Linux task execution with `strace` and warn about undeclared
project reads and writes
- keep auditing advisory, bounded, and disabled when tracing is
unavailable
- expose the option in task schemas and documentation
- cover classification, cache publication, and task-info serialization

## Validation
- `mise run test:e2e e2e/tasks/test_task_artifact_cache_audit
e2e/tasks/test_task_info`
- `cargo test --all-features task_cache_audit::tests -- --nocapture`
- `cargo clippy --workspace --all-features --all-targets -- -D warnings`
- `mise run lint-fix`
- `mise run render:schema`

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

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Changes are opt-in and Linux-only for tracing; execution path only
wraps commands when audit is enabled, with graceful fallback when strace
is unavailable.
> 
> **Overview**
> Adds opt-in **`cache.audit`** on experimental task artifact caching so
teams can spot incomplete `sources` / `outputs` declarations.
> 
> On **Linux**, when audit is enabled and caching is on, mise wraps the
real task command with **`strace`**, parses file syscalls after the run,
and **warns** about undeclared reads under the workspace source root and
undeclared writes under the task directory. Auditing is **advisory**
(tasks still succeed and can still be cached); it is skipped for
raw/dry-run runs, when `strace` is missing, or on non-Linux (warn once).
Cache hits do not run the task, so **`mise run --force`** is needed to
audit an existing entry.
> 
> Configuration is wired through **`TaskCacheConfig`**, JSON schemas,
docs, and **`mise tasks info`**. Source matching for audits reuses a
shared **`task_source_match_root`** helper extracted from the source
checker.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
db83e20. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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