fix: prioritize raw task output over task_output setting#7286
Conversation
When a task has `raw = true`, it needs stdin/stdout to be connected directly for interactive/streaming commands to work properly. The `task_output` setting (e.g., `task_output = "prefix"`) was being checked before the raw property, causing raw tasks to not receive proper stdin/stdout when a global task_output was configured. This fix reorders the output mode selection to check `raw` before the `task_output` setting, ensuring raw tasks always get interleave mode regardless of global configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a priority issue where the global task_output configuration setting was preventing raw tasks from receiving proper stdin/stdout connections. By reordering the conditional checks in the output mode selection logic, raw tasks now correctly receive interleave mode regardless of the configured task_output setting, while still respecting explicit CLI flag overrides.
Key Changes
- Moved the
rawproperty check before thetask_outputsetting check in the output mode selection logic - Raw tasks now always receive Interleave mode (needed for stdin/stdout) unless overridden by explicit CLI flags
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add tests to verify that raw tasks get Interleave output mode: - test_raw_task_gets_interleave_output: task with raw=true gets Interleave - test_raw_handler_gets_interleave_output: handler with raw=true gets Interleave - test_prefix_flag_overrides_raw: explicit --prefix flag still works - test_interleave_flag_with_raw: --interleave with raw task works 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds an integration test that verifies raw tasks get interleave output mode even when task_output = "prefix" is configured globally. The test confirms: - Normal tasks respect the task_output setting - Raw tasks bypass task_output and use interleave mode - Raw task stdout doesn't have prefix applied 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
bugbot run |
Add tests that verify raw=true tasks get Interleave output mode even when task_output=prefix is set in settings. Uses the established Settings::reset() pattern from http.rs for test isolation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| let task = raw_task(); | ||
|
|
||
| assert_eq!(handler.output(Some(&task)), TaskOutput::Interleave); | ||
| } |
There was a problem hiding this comment.
Bug: Unit tests depend on global Settings
The new unit tests call handler.output(...), which consults Settings::get() (including env/config). If a developer or CI environment sets values like MISE_TASK_OUTPUT/raw/silent, these tests can fail or pass for the wrong reasons, making them flaky and environment-dependent.
There was a problem hiding this comment.
Bug: Raw tasks bypass global silent output
OutputHandler::output() now checks self.raw(task) before Settings::get().task_output, so a config like task_output = "silent" or task_output = "quiet" no longer applies to raw = true tasks. This can unexpectedly emit output even when the user configured global output suppression.
src/task/task_output_handler.rs#L119-L133
mise/src/task/task_output_handler.rs
Lines 119 to 133 in 3664e6e
Raw tasks should still respect explicit output suppression settings (task_output = "silent" or "quiet") while only overriding output format settings like "prefix". This addresses the bugbot review comment about raw tasks bypassing global output suppression. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
bugbot run |
Restructure the output mode selection to maintain correct priority: 1. CLI flags (--prefix, --interleave) override all config settings 2. task_output silent/quiet from config overrides raw tasks 3. raw tasks get Interleave for other task_output modes (prefix, etc.) This ensures `mise run --prefix task` works even with `task_output = "silent"` in config, while still allowing silent/quiet config to suppress raw task output. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
bugbot run |
| let handler = OutputHandler::new(default_config()); | ||
| let task = raw_task(); | ||
| assert_eq!(handler.output(Some(&task)), TaskOutput::Interleave); | ||
| } |
There was a problem hiding this comment.
Bug: Test race condition due to missing lock acquisition
The test_raw_task_gets_interleave_output test does not acquire TEST_SETTINGS_LOCK before calling handler.output(), which reads from global Settings. Other tests (like test_task_output_silent_applies_to_raw_task) do acquire the lock and modify global settings via Settings::reset(). Since Rust runs tests in parallel by default, if both tests run concurrently, the first test may read task_output = Silent set by the other test. In that case, output.is_silent() returns true at line 128, causing the function to return TaskOutput::Silent instead of the expected TaskOutput::Interleave, leading to intermittent test failures.
Add with_default_settings helper that acquires TEST_SETTINGS_LOCK and resets settings to prevent race conditions when tests run in parallel. Updated test_raw_task_gets_interleave_output and test_prefix_flag_overrides_raw to use this helper. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { |
There was a problem hiding this comment.
I think just remove this and rely on the e2e test unless you think it's adding value
There was a problem hiding this comment.
sounds good to me 👍
Remove unit tests that were causing issues with global Settings dependencies. The e2e test provides sufficient coverage. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
bugbot run |
### 🚀 Features - **(java)** add created_at support to ls-remote --json by @jdx in [#7297](#7297) - **(ls-remote)** add created_at timestamps to ls-remote --json for more backends by @jdx in [#7295](#7295) - **(ls-remote)** add created_at timestamps to ls-remote --json for core plugins by @jdx in [#7294](#7294) - **(registry)** add --json flag to registry command by @jdx in [#7290](#7290) - **(ruby)** add created_at timestamps to ls-remote --json by @jdx in [#7296](#7296) ### 🐛 Bug Fixes - **(spm)** recursively update submodules after checkout by @JFej in [#7292](#7292) - prioritize raw task output over task_output setting by @skorfmann in [#7286](#7286) ### New Contributors - @skorfmann made their first contribution in [#7286](#7286) - @JFej made their first contribution in [#7292](#7292)
Summary
When a task has
raw = true, it needs stdin/stdout to be connected directly for interactive/streaming commands to work properly. Thetask_outputsetting (e.g.,task_output = "prefix") was being checked before the raw property, causing raw tasks to not receive proper stdin/stdout when a global task_output was configured.Problem
With a config like:
The
raw = truetask would not work correctly becausetask_output = "prefix"takes precedence in the output mode selection logic.Solution
Reorder the output mode selection to check
rawbefore thetask_outputsetting, ensuring raw tasks always get interleave mode regardless of global configuration.Test plan
mise run test:unit)task_output = "prefix"configured🤖 Generated with Claude Code
Note
Ensure
rawtasks use interleave output regardless oftask_output(except silent/quiet), and add an e2e test to verify behavior.src/task/task_output_handler.rs):--prefix,--interleave) override config.rawtasks to useTaskOutput::Interleaveeven whenSettings::task_outputis set (unlesssilent/quiet).silent/quietsuppression precedence overraw.e2e/tasks/test_task_raw_outputverifying raw task stdout is not prefixed whentask_output = "prefix".Written by Cursor Bugbot for commit 8a69478. This will update automatically on new commits. Configure here.