Skip to content

fix(task): inherit output from task templates - #11059

Merged
jdx merged 1 commit into
jdx:mainfrom
risu729:agent/fix-task-template-output
Jul 16, 2026
Merged

jdx merged 1 commit into
jdx:mainfrom
risu729:agent/fix-task-template-output

Conversation

@risu729

@risu729 risu729 commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • deserialize output in task templates
  • inherit the template output style when a task does not set one
  • preserve task-local output overrides
  • document and test the merge behavior

Root cause

PR #10885 added the per-task output field and exposed it through the shared task schema, but did not add the field to TaskTemplate or its merge logic. Schema-aware tooling therefore accepted template output styles that mise ignored at runtime.

Unlike the task-only boolean flags, output is represented as Option<TaskOutput>, so template inheritance can distinguish an unset task value from an explicit local override.

Validation

  • mise x cargo -- cargo test task_template::tests --all-features
  • mise run test:e2e e2e/tasks/test_task_templates
  • mise run lint-fix

Summary by CodeRabbit

  • New Features

    • Task templates can now define a default output style.
    • Tasks inherit the template’s output style unless they specify their own.
  • Documentation

    • Clarified how task-level output settings override template values.
  • Bug Fixes

    • Ensured local output settings are preserved when applying task templates.

@greptile-apps

greptile-apps Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a gap introduced in #10885 where the per-task output field was exposed in the shared task schema but not deserialized in TaskTemplate or applied during template merging. Users who set output on a template would see the setting silently ignored at runtime.

  • Adds output: Option<TaskOutput> to TaskTemplate and applies it in merge_template using the same "local wins if set, fall back to template" pattern already used for shell, timeout, dir, etc.
  • Covers both the inheritance case (task inherits template's output) and the override case (task-local output is preserved) with a new unit test and an E2E test block.
  • Updates the merge-behavior table in the templates docs to document the new field.

Confidence Score: 5/5

The change is minimal, well-contained, and follows the exact pattern already used for every other optional field in merge_template.

Three-file change: a one-field struct addition with a two-line merge guard, an E2E test covering both the inheritance and local-override paths, and a doc table update. TaskOutput derives Copy, so the direct Option assignment is correct. No existing merge paths are touched.

No files require special attention.

Important Files Changed

Filename Overview
src/task/task_template.rs Adds output: Option<TaskOutput> to TaskTemplate and inheritance merge logic following the established pattern; unit tests cover both inherited and overridden cases.
e2e/tasks/test_task_templates Adds E2E test block verifying silent output suppression via template inheritance and that a task-local output value correctly overrides the template.
docs/tasks/templates.md Adds output row to the merge-behavior table with accurate semantics matching the implementation.

Reviews (1): Last reviewed commit: "fix(task): inherit output from task temp..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Jul 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: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 776a5c9f-325b-4eb4-8381-0797293f52bb

📥 Commits

Reviewing files that changed from the base of the PR and between 8627e34 and 7f6bb93.

📒 Files selected for processing (3)
  • docs/tasks/templates.md
  • e2e/tasks/test_task_templates
  • src/task/task_template.rs

📝 Walkthrough

Walkthrough

Task templates now accept an optional output setting. Tasks inherit the template value when unset, while explicit local values take precedence. Unit tests, end-to-end tests, and documentation cover this behavior.

Changes

Task template output behavior

Layer / File(s) Summary
Output schema and merge behavior
src/task/task_template.rs
TaskTemplate stores an optional TaskOutput, and Task::merge_template inherits it only when the task-local output is unset. Unit tests cover inheritance and overrides.
Output behavior validation and documentation
e2e/tasks/test_task_templates, docs/tasks/templates.md
End-to-end tests verify inherited and overridden output behavior, and documentation describes local override semantics.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: jdx

Poem

A rabbit hops through templates bright,
“Silent” flows from base just right.
Set it local, and words appear—
The tests all thump with carrot cheer!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: inheriting task output from templates with local overrides preserved.
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.

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.

@risu729
risu729 marked this pull request as ready for review July 16, 2026 16:03
@jdx
jdx merged commit d922d6c into jdx:main Jul 16, 2026
34 checks passed
@risu729
risu729 deleted the agent/fix-task-template-output branch July 16, 2026 16:36
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.

2 participants