feat: complete with-watch command inference#362
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f101cdc5f8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| starbase_args::Argument::Option(option, Some(value)) => { | ||
| shell_command | ||
| .argv | ||
| .push(format!("{option}={}", value.as_str())); |
There was a problem hiding this comment.
Keep shell option values as separate argv tokens
build_shell_command rewrites every Argument::Option(option, Some(value)) into a single "{option}={value}" token, which breaks short-option inference in shell mode. For example, grep -f patterns.txt file.txt becomes -f=patterns.txt, and adapters like analyze_grep strip -f then treat "=patterns.txt" as the watched path, so changes to patterns.txt are missed. This causes false watch targets and missed reruns for common short-option commands parsed via --shell.
Useful? React with 👍 / 👎.
| let should_rerun = pending_rerun | ||
| && plan.metadata.side_effect_profile != SideEffectProfile::WritesWatchedInputs | ||
| && inputs_changed_since_baseline; |
There was a problem hiding this comment.
Rerun when non-self changes happen during self-mutating runs
The rerun gate unconditionally disables reruns for WritesWatchedInputs commands, so any external input updates that occur while the child is running are dropped together with self-writes. In that case pending_rerun is true, but should_rerun is forced false and baseline is advanced to the post-run snapshot, which loses the first legitimate external change instead of replaying once after completion.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6209fc6cf3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if token.starts_with('-') { | ||
| index += 1; | ||
| continue; |
There was a problem hiding this comment.
Parse grouped grep flags that carry a pattern file
analyze_grep only handles -f when it appears as -f/--file (or -fFILE), then drops any other short-flag group via token.starts_with('-'). grep --help documents -f, --file=FILE take PATTERNS from FILE, and grouped forms like grep -rf patterns.txt src are valid; here patterns.txt is treated as the positional regex instead of a watched input file, so edits to the pattern file do not trigger reruns.
Useful? React with 👍 / 👎.
| if !saw_expression && FIND_GLOBAL_OPTIONS.contains(&token) { | ||
| index += 1; | ||
| continue; |
There was a problem hiding this comment.
Consume find debug/optimize option arguments
analyze_find advances only one token for every entry in FIND_GLOBAL_OPTIONS, but find --help shows -D debugopts and -Olevel/-O LEVEL semantics. With inputs like find -D stat -name '*.rs', the stat debug argument is incorrectly inferred as a watched path; because inputs are now non-empty, the default . watch root is not added, so normal cwd changes can be missed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d97322a5b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if token == "-C" || token == "--directory" { | ||
| filtered_output_count += usize::from(matches!(mode, TarMode::ReadArchive)); | ||
| index += 2; | ||
| continue; |
There was a problem hiding this comment.
Track
tar -C/--directory as an input in create mode
analyze_tar skips the value of -C/--directory entirely, and only increments filtered_output_count when the mode is currently ReadArchive. GNU tar --help defines -C, --directory=DIR as “change to directory DIR”, which in create flows (tar -cf out.tar -C src .) changes where inputs are read from. Because this path is never added to inputs, edits under src can be missed and reruns won’t fire even though the archive contents should change.
Useful? React with 👍 / 👎.
| if !metadata_arg_consumed { | ||
| metadata_arg_consumed = true; | ||
| } else { | ||
| push_inferred_input(&mut inputs, token, cwd)?; |
There was a problem hiding this comment.
Preserve first FILE operand for
--reference attr commands
analyze_change_attributes always treats the first positional token as metadata (MODE/OWNER) and drops it, even when --reference is used. For commands like chmod --reference=ref.txt target.txt (documented as --reference=RFILE FILE...), target.txt is the first positional FILE, but this branch discards it, so the target path is not watched and changes to that file will not trigger reruns.
Useful? React with 👍 / 👎.
Summary
Testing