Skip to content

fix(task): preserve system task precedence - #12204

Closed
risu729 wants to merge 2 commits into
jdx:mainfrom
risu729:agent/task-system-precedence-v2
Closed

risu729 wants to merge 2 commits into
jdx:mainfrom
risu729:agent/task-system-precedence-v2

Conversation

@risu729

@risu729 risu729 commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Recreates #11206 on the current configuration architecture.

Stacked on #12203. The final commit is the system-precedence delta; #12203 should be reviewed and merged first.

Summary

  • let explicit local HOME task context override system task metadata
  • suppress only incidental local copies of task sources already loaded by the system pass
  • cover custom global roots and local .mise/conf.d ownership without replaying the obsolete global-first loader

Bug examples

  • A system config can add SYSTEM_METADATA=applied to ~/.config/mise/tasks/system-meta. The local HOME walk previously rediscovered the same script and its undecorated copy could win, so the task printed SYSTEM_METADATA=<unset>. This fix suppresses that incidental duplicate and retains the system metadata.
  • Conversely, if $HOME/.mise/conf.d/local.toml explicitly includes that script and supplies a local directory or task metadata, broad same-source deduplication could discard the intentional local definition. The selective suppression now preserves explicit local context, so the local directory and metadata override the lower-precedence system values.

Testing

  • mise run lint-fix
  • mise run test:e2e e2e/tasks/test_task_system_config_home_dedup e2e/tasks/test_task_ls_global e2e/tasks/test_task_global_source_context_precedence

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

Summary by CodeRabbit

  • Bug Fixes
    • Improved task configuration precedence across system, global, included, and local sources.
    • Prevented duplicate evaluation of task templates and duplicate task loading.
    • Preserved task metadata, directories, shells, inputs, and working-directory settings when configurations overlap.
    • Ensured local task definitions and explicit project includes retain the expected precedence.
    • Improved global task behavior when using custom roots or running outside the home directory.

@coderabbitai

coderabbitai Bot commented Aug 20, 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: 763497ce-e807-4328-a786-9c37b6a639d5

📥 Commits

Reviewing files that changed from the base of the PR and between 8c19a41 and dfbbaf4.

📒 Files selected for processing (8)
  • e2e/tasks/test_task_global_config_dedup
  • e2e/tasks/test_task_global_config_precedence
  • e2e/tasks/test_task_global_include_precedence
  • e2e/tasks/test_task_global_source_context_precedence
  • e2e/tasks/test_task_ls_global
  • e2e/tasks/test_task_monorepo_config_dedup
  • e2e/tasks/test_task_system_config_home_dedup
  • src/config/mod.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The configuration loader now preserves task source metadata, separates global overlays from regular tasks, applies local and global precedence rules, suppresses duplicate task sources, and resolves inputs in distinct stages. End-to-end tests cover these behaviors.

Changes

Task configuration resolution

Layer / File(s) Summary
Input resolution and task-loading contracts
src/config/mod.rs
Task input processing is split into resolution stages. Loaded configuration now returns regular tasks and global overlays separately.
Local context and duplicate suppression
src/config/mod.rs
Local task loading applies cascade and HOME rules, identifies global sources, and suppresses marked duplicates.
Global overlays and source precedence
src/config/mod.rs
Global loading preserves explicit directory and shell settings while applying configuration overlays with precedence.
End-to-end precedence and deduplication coverage
e2e/tasks/test_task_global_*, e2e/tasks/test_task_ls_global, e2e/tasks/test_task_system_config_home_dedup, e2e/tasks/test_task_monorepo_config_dedup
Tests cover task precedence, source context, cascade behavior, relocated roots, and single template rendering.

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

Merge Risk: ⚪ Minimal · up to dfbba

This change preserves explicit local task precedence while avoiding duplicate task sources, with targeted end-to-end coverage; no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant mise_tasks
  participant load_config_tasks
  participant TaskSources
  participant local_task_loader
  mise_tasks->>load_config_tasks: load configuration tasks
  load_config_tasks->>TaskSources: collect regular tasks and overlays
  local_task_loader->>TaskSources: mark local tasks for global deduplication
  TaskSources-->>mise_tasks: return effective tasks and source context
Loading

Possibly related PRs

  • jdx/mise#11206: Extends related task-loading precedence and deduplication logic.
  • jdx/mise#12000: Also modifies task-include loading in src/config/mod.rs.

Poem

A rabbit checked each task with care,
And found one template rendered there.
Global paths now take their place,
Local tasks keep their context and space.
Precedence hops through every door—
No duplicate carrots anymore! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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: preserving system task precedence in task configuration loading.

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 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR refines task discovery and overlay merging so explicit local task context takes precedence while incidental copies of sources loaded by the system or global pass are suppressed.

  • Tracks whether locally discovered tasks are eligible for global-source deduplication.
  • Separates fully resolved global tasks from metadata overlays used on matching file tasks.
  • Splits task input-group and global-input application to preserve the intended overlay context.
  • Adds end-to-end coverage for system, global, include, custom-root, cascade, monorepo, and template-rendering precedence cases.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code failure established by the reviewed task-precedence paths.

The new ownership and overlay logic preserves explicit local context while restricting deduplication to incidental global-source copies, and the added end-to-end cases cover the principal precedence and rendering boundaries.

Important Files Changed

Filename Overview
src/config/mod.rs Refactors task input resolution and global overlay construction, then makes local/global source deduplication conditional on whether the local discovery is incidental.
e2e/tasks/test_task_system_config_home_dedup Covers system metadata precedence, custom global roots, explicit local context, and preservation of local-only tasks.
e2e/tasks/test_task_global_source_context_precedence Verifies global source context and explicit project-local overrides for metadata, directories, shells, and input groups.
e2e/tasks/test_task_ls_global Expands coverage of default-include ownership, local conf.d context, custom global roots, cascaded settings, and cascade opt-out.
e2e/tasks/test_task_global_config_precedence Tests precedence among system configuration, global conf.d fragments, the main global config, and global file tasks.
e2e/tasks/test_task_global_include_precedence Tests collisions among inline tasks and file tasks loaded from multiple global include directories.
e2e/tasks/test_task_global_config_dedup Adds a regression assertion that inspecting raw include ownership does not render an effectful template twice.
e2e/tasks/test_task_monorepo_config_dedup Initializes the render-count marker explicitly so the monorepo deduplication assertion has deterministic state.

Reviews (1): Last reviewed commit: "fix(task): preserve system task preceden..." | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown
Contributor

This PR currently has merge conflicts. If this continues for 7 days, it will be closed automatically.

This is warning day 1 of 7.

Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it.

This comment was generated by an automated workflow.

@github-actions

Copy link
Copy Markdown
Contributor

This PR currently has merge conflicts. If this continues for 7 days, it will be closed automatically.

This is warning day 4 of 7.

Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it.

This comment was generated by an automated workflow.

@github-actions

Copy link
Copy Markdown
Contributor

This PR currently has merge conflicts. If this continues for 7 days, it will be closed automatically.

This is warning day 6 of 7.

Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it.

This comment was generated by an automated workflow.

@github-actions

Copy link
Copy Markdown
Contributor

This PR has had merge conflicts for more than 7 days, so it is being closed automatically.

Feel free to reopen or create a new PR if you'd like to continue working on this.

This comment was generated by an automated workflow.

@github-actions github-actions Bot closed this Aug 30, 2026
@risu729
risu729 deleted the agent/task-system-precedence-v2 branch September 4, 2026 17:39
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