Skip to content

fix(watch): forward --wrap-process to watchexec#10392

Merged
jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:fix-watch-wrap-process
Jun 13, 2026
Merged

fix(watch): forward --wrap-process to watchexec#10392
jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:fix-watch-wrap-process

Conversation

@JamBalaya56562

@JamBalaya56562 JamBalaya56562 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Problem

mise watch --restart --wrap-process none <task> hangs when the task launches a TUI, while the equivalent direct watchexec --restart --wrap-process none mise run <task> works fine. Reported in #10212.

Root cause

mise watch accepts --wrap-process (it mirrors watchexec''s options for help/completion), but Watch::run() never forwards the flag when building the watchexec command line — a repo-wide search finds wrap_process only in the clap definition. So mise watch --wrap-process none foo actually runs:

watchexec --restart -- mise run foo

and watchexec falls back to its default --wrap-process group. In group mode the TUI ends up in a non-foreground process group and blocks on terminal I/O, hence the hang.

Fix

  • Forward --wrap-process in Watch::run() when it differs from watchexec''s default (group), right next to the existing --on-busy-update forwarding.
  • Add PartialEq and a kebab-case strum::Display to WrapMode (mirroring OnBusyUpdate) so it serializes to watchexec''s accepted values: group / session / none.

Testing

  • Unit test pinning WrapMode''s serialized values (group/session/none) — these are forwarded verbatim to watchexec.
  • Manual: mise watch --restart --wrap-process none <task> under MISE_DEBUG now shows --wrap-process none in the spawned watchexec command, and the TUI no longer hangs. (The argv construction lives in the long-running Watch::run(), which isn''t covered by the existing e2e suite.)
  • cargo fmt --all -- --check passes.

Note: several other watchexec flags are similarly parsed-but-not-forwarded (e.g. -i/--ignore, --workdir); this PR is scoped to --wrap-process (the reported bug) and those can be a follow-up.

Addresses #10212

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • mise watch now correctly forwards the --wrap-process option to the process watcher instead of silently dropping it, ensuring process wrapping behavior is applied as specified.
  • Tests

    • Added regression tests to verify process wrapping configuration is handled correctly.

mise watch accepts --wrap-process (it mirrors watchexec's options) but never
forwarded it when building the watchexec command line, so e.g.
`mise watch --wrap-process none foo` actually ran `watchexec --restart -- mise run
foo` and watchexec fell back to its default `group` wrap mode. A task launching a
TUI then ended up in a non-foreground process group and blocked on terminal I/O,
hanging -- while the equivalent direct `watchexec --wrap-process none ...` worked
(jdx#10212).

Forward --wrap-process when it differs from watchexec's default (group), and add
PartialEq + a kebab-case strum::Display to WrapMode (mirroring OnBusyUpdate) so it
serializes to watchexec's accepted values (group/session/none). Add a unit test
pinning those serialized values.

Addresses discussion jdx#10212.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 13, 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c7abfeeb-072e-4794-98b7-dd0653607dde

📥 Commits

Reviewing files that changed from the base of the PR and between bcb5aa0 and 8a90d21.

📒 Files selected for processing (1)
  • src/cli/watch.rs

📝 Walkthrough

Walkthrough

The PR updates mise watch to forward the --wrap-process option to watchexec when the configuration value is not the default. The OnBusyUpdate enum gains automatic kebab-case string serialization via strum::Display, and tests validate that WrapMode values serialize to strings matching watchexec accepted forms.

Changes

Watch wrap-process flag forwarding

Layer / File(s) Summary
OnBusyUpdate enum serialization contract
src/cli/watch.rs
The OnBusyUpdate enum derives strum::Display with #[strum(serialize_all = "kebab-case")] and PartialEq, enabling automatic lowercase kebab-cased string conversion for CLI arguments.
Watch command wrap-process flag forwarding
src/cli/watch.rs
The Watch::run implementation appends --wrap-process <value> to watchexec arguments when wrap_process differs from the default WrapMode::Group.
WrapMode serialization validation
src/cli/watch.rs
Test imports include WrapMode, and a new unit test validates WrapMode::{Group,Session,None} serialize to lowercase strings (group, session, none) matching watchexec --wrap-process accepted values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A tiny hop to forward the flag,
No wrap-mode shall silently lag—
Kebab-case spins with strum's bright grace,
watchexec gets its rightful place!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: forwarding the --wrap-process flag to watchexec in the watch command.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a bug where mise watch --wrap-process <mode> silently dropped the flag when building the watchexec command line, leaving watchexec to use its default group mode and causing TUI tasks to hang on terminal I/O.

  • Adds PartialEq and #[strum(serialize_all = "kebab-case")] strum::Display to WrapMode, mirroring the identical treatment already applied to OnBusyUpdate, so the enum renders to the exact strings watchexec expects (group / session / none).
  • Forwards --wrap-process in Watch::run() when the value differs from watchexec's default (Group), right alongside the existing --on-busy-update forwarding; a unit test pins all three serialized values to guard against future renames.

Confidence Score: 5/5

Safe to merge — single-file change that closes a clear gap between the parsed CLI flag and the subprocess invocation.

The fix is minimal and well-scoped: it adds two derives to an enum, inserts one conditional push into an existing args-building block, and adds a unit test that pins the exact strings forwarded to watchexec. The pattern is identical to the already-working OnBusyUpdate forwarding, the default-comparison logic is correct, and strum's kebab-case serialization produces the values watchexec expects. No regressions are plausible.

No files require special attention.

Important Files Changed

Filename Overview
src/cli/watch.rs Adds PartialEq + strum::Display to WrapMode and forwards --wrap-process to watchexec when non-default; adds a unit test pinning the serialized values.

Reviews (1): Last reviewed commit: "fix(watch): forward --wrap-process to wa..." | Re-trigger Greptile

@jdx jdx merged commit e420ad4 into jdx:main Jun 13, 2026
33 checks passed
@JamBalaya56562 JamBalaya56562 deleted the fix-watch-wrap-process branch June 13, 2026 12:57
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