Repository navigation
feat(repo): process:guidance_searched counts the guidance files an agent searched, and guidance_read lists only files the workspace held - #1003
Conversation
… when the agent started (intel#626) A Bash call with several reads (`cat dpnp/tests/AGENTS.md; ls x; cat dpnp/tests/third_party/AGENTS.md 2>/dev/null`) gives each read `rc` 0, since a failing exit does not say which file failed (contract §4.1). `process_metrics` then matched a path that never existed against the guidance globs as a string, so `guidance_read` listed `dpnp/tests/third_party/AGENTS.md` for a workspace that never held it. `run_cell` now takes the workspace files `guidance.globs` match right after `prepare_workspace` and before the agent starts (`workspace.held_guidance`), and `run_process_metrics` keeps a path only when it is in that set. A path that never existed, a file the arm removed and a file the agent created itself are not listed. The `rc` rules, `unknown_reads`, `tool_calls`, denied reads and path normalisation are unchanged, and `process_metrics` keeps its `is_guidance` callable. Part of intel#626: the grep and rg half follows in the next commit. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…hed with grep, rg or Grep (intel#626) `guidance_read` counts files printed whole, so an agent that only ran `grep -n warn dpnp/AGENTS.md dpnp/tests/AGENTS.md` had `guidance_read` 0 although part of both files reached its context. The walker in `cli_traces.py` now also recognises `grep`, `egrep`, `fgrep`, `rg` and `git grep` (`shell_search.py`, over the option tables of `probes.py`, which `search_words` now exposes). A file named as an operand of a search that shows lines of it goes into an optional `searched` list on the `command` event, and a Claude Code `Grep` call in `content` mode with a `path` puts its path on its `tool` event. No event is added, so `tool_calls` is unchanged. `process_metrics` builds `guidance_searched` from those lists (sorted, glob-matched, held when the agent started), `process_counts` counts it as a list, and `repo compare` and `repo report` show a `process:guidance_searched` row. Not counted: `-q`, `-l`, `-L`, `-c`, `--count`, `--files`, a directory or glob operand, stdout sent to a file, a negated, refused or subshell command, a pipe into anything but `head` or `tail`, and a search that failed as one search of one file. The `cd` rules are `guidance_read`'s; a relative file after an earlier call's `cd` is dropped and not added to `unknown_reads`, which counts reads. The sed helpers moved to `shell_sed.py` to keep `cli_traces.py` under the file cap; `repo_event.v1` is widened in place by the optional `searched` field. Part of intel#626: the guidance_read half is the previous commit. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…ger moves the shell (intel#626) The piped-search step cut the first stage out of a pipeline and ran it through the walker's words(), which treats a computed directory change (cd $D, source $ENV, eval "$(...)") as run in this shell, because the stage alone has no pipe left. So `eval "$(conda shell.bash hook)" 2>&1 | tail -2` set shell_moved and dropped every later relative guidance read of the trace. words() now takes `staged`: the first stage of a pipeline ran in a subshell, so it never loses this shell's directory. words() has no other side effect on the walker. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…el#626) search_words put every letter of a short-option word into the flag set, also the letters of a value attached to an option that takes one. So `rg -tc warn AGENTS.md` read `-c` (count) and `rg '-g*.lock' warn AGENTS.md` read `-l` and `-c`, and the searched file was dropped although rg shows its lines. A short cluster now ends at its first letter that is a value option of the program (`_SEARCH_VALUES`); the rest of the word is the value. `grep -cm1` and `grep -nc` still read the count flag, which comes before the value option. The operands of a searcher are unchanged. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…el#626) `probes._value_span` read a short cluster by its last letter: `-g*.md` ends in `d` (rg's `--max-depth`) and `-g*.C` in `C` (`--context`), so the next word, the pattern, was taken as that value, the file became the pattern and `rg -g'*.md' warn AGENTS.md` lost `AGENTS.md`, as did a probe path pattern on a file such a command names. `_value_span` now reads the cluster from the left, as `_option_names` does: the first letter that takes a value ends the options; when it is the last letter the value is the next word, when letters follow it they are its value (`rg -tm pat f` is `-t` with the type `m`). A cluster with no value letter, long options and `--name=value` are unchanged. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
OpenCodeReview: Commit f825045 was not reviewed. This PR has reached its review limit (6 reviews). CI at `f825045`: 7 still running, 18 passing, 2 skipped
To review this commit: re-request review from exai-bot in the Reviewers list. <details><summary>Last review (c7594b1): 1 medium</summary> Open threads from the bot: 0 </details> |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1003 +/- ##
==========================================
+ Coverage 96.03% 96.05% +0.02%
==========================================
Files 456 460 +4
Lines 60406 60741 +335
Branches 10425 10489 +64
==========================================
+ Hits 58013 58347 +334
- Misses 1481 1482 +1
Partials 912 912
🚀 New features to boost your workflow:
|
…l cuts, links and denials Settles the review threads on intel#1003 and the codecov gap in shell_sed.py. - A keyword before a piped search (`if grep x f | head`, `while`, `then`, `elif`) is dropped as the unpiped path does, but `!` still ends it. - A trailing `head` or `tail` counts only when its options are known, it names no file, its count is not zero (`-n 0`, `-c 0`, `--lines=0`; `tail -n +0` is all lines), it is not `--help` or `--version`, and the call defines no function of that name (`cuts_lines` in shell_search.py). - A short cluster holding `-e` or `-f` with its value attached (`-ewarn`, `-nefoo`, `-fpatterns.txt`) marks the expression as given, so the file operand is no longer taken for the pattern (`search_words`). - A refused Grep tool event drops its `searched` list, so the persisted event agrees with the events format. - The held-guidance check moves to held_guidance.py and resolves a path through links: `alias/AGENTS.md` with `alias -> docs` counts, a dangling or looping link is no held file. - sed tests cover the attached `-e` script and `--`; the `sed -n` with no script and no `-e` branch, which gave the same empty result as the general one, is removed. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…e ignores its stderr redirect Settles the review threads on `held_guidance.py` and `shell_search.py`. - `HeldGuidance` records the workspace's links when the agent starts and resolves an event path through them, so a read or search through `alias/AGENTS.md` still counts after the agent removed or retargeted `alias`. - `_search_stage` strips the harmless stderr redirects (`2>/dev/null`, `2>&1`, `2>file`) from each `head` or `tail` stage before `cuts_lines` checks its options, as `_Walk.words` does for the first stage; a stdout redirect still refuses the stage. The strip is one helper, `_without_stderr`. - Tests cover both, and the cut-stage `--quiet` option and an unsplittable stage that the coverage report named. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…syntax and a Windows alias as the tools and the platform do A search names a guidance file only when the shell would show its lines. The command line is now read as the tools read it. `--help` and `--version` count as options of the search only where the parser sees an option, so `grep -e --help AGENTS.md` searches for the text and keeps the file. A match limit of zero (`-m0`, `-m 0`, `--max-count=0`, in a cluster too) shows no line and leaves the file out. The valued options of grep (`--include`, `--exclude`, `--exclude-dir`, `--exclude-from`, `--group-separator`) and of rg (`--ignore-file`, `--pre`, `--color`, `--colors`, `--engine`, and the other options that take a separate value) no longer leave their value among the operands. A `head` or `tail` stage that cuts lines accepts the end of options `--` and the explicit stdin `-` when no file follows, refuses a value on a valueless long option (`--quiet=bad`) and reads only the size suffixes GNU reads (`1k`, `2KiB`, `3MB`), so `head -n 1qq` and `head -c 2kb` no longer count as a cut. The links of the held workspace are resolved from the drive or share anchor (`C:\`) instead of a drive-relative `C:`, a rooted or absolute link target restarts from that anchor with the drive of the link, and the link targets are normalized as `overlay_paths._link_target` does, so an alias through a directory link leads to the held file on Windows. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…tail's values and reads grep's long-option prefixes A Claude Code Grep call with a relative path now starts at the directory the harness started in, as a Bash call does (`sub/AGENTS.md`, not `AGENTS.md`). A `tail` whose `--follow` mode, `--pid`, `--sleep-interval`/`-s` or `--max-unchanged-stats` value, or whose `-n`/`-c` count, the tool refuses is no stage that passes lines, so the search before it is not counted. For `grep`, `egrep` and `fgrep` an unambiguous prefix of a long option (`--qui`, `--cou`) is read as the option it abbreviates before the output modes are checked; rg reads no abbreviation and is left alone. `_match_limit` loses a loop exit no input reaches (the caller has already found the value letter), which is the partial line codecov names. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…link and an abbreviated option's value A Claude Code Grep result that is empty or says "No matches found" (an offset past the last line gives it) no longer keeps `searched` on its event, as an error result already did not. A link whose target returns to itself through a `..` component (`alias -> alias/../docs`) now makes `HeldGuidance.resolved` return None past 40 links, so the path is not held, instead of finishing the pending components and landing on `docs/`. GNU grep long options are normalized to their full name while `search_words` reads them, so `--exclude-d AGENTS.md` takes `AGENTS.md` as the value of `--exclude-dir` and not as an operand, and `--max=0` is read as the zero match limit it is (intel#1013); rg is not normalized. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
Review points answered at Declined, with the evidence in the replies:
Follow-up issues opened:
|
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…ame, a dangling link target and a cross-drive link Settles review points 4635357721, 4635357740, 4635357745 and 4635357752 of intel#1003. A Bash call, Codex command or Copilot bash command whose result is the empty text drops its searched list: `grep x AGENTS.md | head` exits 0 when nothing matched, so the exit code could not tell. A result that is absent from the trace is not taken for empty. `tail --follow=name` (and its prefixes) is no stage that passes lines: tail refuses to follow its input by name before it prints one. A link whose target goes `..` out of a name that was no directory at the start (`alias -> missing/../docs`) leads to no held file, decided from the directories the workspace had at the start. A link target on another drive (Windows) leads to no held file instead of raising ValueError in os.path.relpath, which lost the cell's whole process object. `searched_field` moves to shell_search.py so cli_traces.py stays under the 800-line cap. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…thru as the last search, and reads a huge count
Settles the three exai-bot threads on cli_traces.py:157, cli_traces.py:363 and shell_search.py:126.
The `}` that closes a brace group no longer becomes the script's last part, so `echo hi; { grep zzz AGENTS.md docs/AGENTS.md; }` that exits 1 lists no file.
`rg --passthru` marks the walk only when it names files it shows lines of, so `rg --passthru -q x other.txt; grep nomatch AGENTS.md` that exits 1 lists none.
A head/tail count and a grep `-m` value are tested for zero by digit, not through int(), so a 5000-digit value no longer raises ValueError.
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…nd reads git grep's own options Settles the three open threads on the Claude pipeline exit and git grep. Claude Code reports only that a call failed, so a failed `grep x AGENTS.md | head` under `set -o pipefail` may be grep killed by the closed pipe after head showed a line. A last part that pipes the search into head or tail is no failed search when the exit is unknown; a result with no text still drops it, and a known exit 1 (Codex, Copilot) still does. `git grep` is now its own program in the search option tables, so `--max-depth 0` takes its value word and the pattern is no longer read as a file. `git grep -h` is --no-filename in git (it ran and printed the line here), so it stays a search. Test-narrowed: the case `cd sub && grep zzz AGENTS.md | head` moves from the failed-search parametrization to the new pipeline test, since a Claude error on a cut pipeline no longer proves no match. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…hat exited 141 Settles the review point that Codex and Copilot lost `searched` for `grep x AGENTS.md | head -n 1` with exit 141: `drop_failed_searches` also asked `_failed_read`, which is true for any non-zero exit of a one-file command, and `failed_search` could not override it. A search piped into head or tail is now judged by `failed_search` alone, whose exit 1 rule still drops a search that matched nothing. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
… rg --hostname-bin's value Settles the two review threads on probes.py: `git grep --max-d 0 AGENTS.md -- other.txt` now expands `--max-d` against git grep's own long options (it was matched against GNU grep's, which has no `--max-depth`), so `0` is the value and AGENTS.md the expression; `--hostname-bin` is added to rg's valued options so `/bin/hostname` is no longer taken as the expression. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
dokimi/dokimi/repos/events.py: the import block conflicted (main added `claude_events` from `.turn_events`, this branch imports `failed_search`, `shell_walked` and `_from_cwd`); both sets are kept. dokimi/dokimi/repos/events.py: the end of `_claude_stream_json` conflicted (main keeps the parsed trace in `trace` for `claude_events`, this branch calls `_settle_grep` first); the branch's `_settle_grep` call and main's `trace` variable are both kept. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…searches
Settles the review thread on cli_traces.py:367. `{ rg --passthru zzz other.txt; } >/dev/null; echo hi; grep nomatch AGENTS.md` that exits 1 kept the walk's `passthru` flag after `close_group` dropped the group's searches, so `failed_search` returned false for the final no-match grep and credited AGENTS.md.
`open_group` now records the flag and `close_group` restores it where it removes the group's reads, as it does for `unknown`.
The test gains the redirected and piped group cases, run through the Claude Code, Codex and Copilot converters. The changelog fragment names the case.
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
… not read as whole-file delivery Settles the two review threads on the PR. A zero match limit written with a leading plus (`grep -m +0`, `rg -m +0`, `--max-count=+00`) is now a zero limit, as `-m 0` is: strtoimax and Rust's parse both accept the plus, so the search prints no line and credits no guidance file. The tests cover the option forms and a completed-converter case with a trailing `echo done`. The reviewing guide and the changelog fragment no longer say `guidance_read` lists files printed whole: `head -n 1 AGENTS.md` and `sed -n 1p AGENTS.md` list the file, so the list does not show the whole file reached the agent, and `agent.stdout` does. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
Review points answered at codecov has not reported on this head yet. |
napetrov
left a comment
There was a problem hiding this comment.
Change class: ARCHITECTURAL (head c7594b1)
- Contract: changed. defaults dokimi/dokimi/repos/cli_traces.py:138; defaults dokimi/dokimi/repos/cli_traces.py:291
- Responsibility: changed. move bare from dokimi/dokimi/repos/cli_traces.py to dokimi/dokimi/repos/shell_redirects.py; move _SedScan.init from dokimi/dokimi/repos/cli_traces.py to dokimi/dokimi/repos/shell_sed.py
- Dependency: none
- Review depth: design read: new dependency/responsibility, ask for rationale
- Coverage gaps: none
2 blocking findings. I checked the shell and tool event paths, workspace filtering, the per-cell count and the version emitted by Transcript.
Focused tests on c7594b1d4: 299 passed in 3.15s. CI on head c7594b1: 0 failing Actions jobs; merge base 5d4e205 is behind base tip 36075a0.
…ile search is documented as naming its files The `searched` field was added to the retired `repo_event.v1.json`, which tightened a frozen format and left the field unchecked on the lines the writer emits (`v: 2`). It is now declared as a list of strings in `repo_event.v2.json`, and `repo_event.v1.json` is back as it was. The schema test validates under v2, and a converted trace's lines are checked under the version the writer stamps. A `grep` of several files lists every file it named once the command showed a line, without attributing lines to files. The contract, events format, reviewing guide and changelog fragment now say so, and a test pins the example `grep -n visible AGENTS.md docs/AGENTS.md` with output only from the first file. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@napetrov (#1003 (review)): This review lists the two threads above (the v2 schema and the multi-file search); each has its own reply. The change class is as the review states it; no further change. |
Conflict in dokimi/dokimi/repos/cli_traces.py: main made the heredoc pattern a HeredocPattern and replaced the STDOUT_AFTER_STDERR regex with the linear _stdout_after_stderr in shell_words, while this branch had moved the redirect regexes into shell_redirects. The merge keeps HeredocPattern for _HEREDOC, keeps the redirect helpers in shell_redirects, and makes shell_redirects.without_stderr and close_group call main's _stdout_after_stderr; the branch's STDOUT_AFTER_STDERR regex is dropped. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
Review points answered at No review of this head yet from exai-bot. |
…e when cue tests/test_shell_search_rg_follow.py pins how process:guidance_searched reads rg -L, which belongs to intel#1003. It has no license header, so Static checks failed on this PR, and nothing in this PR reads it. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
…ues (#743) * fix(validate): count the ja いつ cue only before a use verb A bare いつ also matched inside 思いつく, 追いつく, 食いつく and こいつ, so a Japanese capability-only description lost the description-no-when warn. Accept いつ only when a use verb follows (いつ使う, いつ呼び出す, ...). Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com> * fix(validate): do not read 耗时, 超时 or 延时 as a zh when cue 时 after 耗/超/延 (time-consuming, timeout, delay) before 调用/执行 matched the 时+verb cue, and 当事人 opened a 当…时 span. Exclude them there; the closing 时 of a 当… span keeps its class, since 当请求超时 is a when clause. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com> * fix(validate): count de beim only next to a use verb A bare beim matched "Hilft beim ..." and "Unterstützt beim ...", which state a capability, so those descriptions lost the description-no-when warn. Accept beim only with verwenden, nutzen, benutzen, einsetzen or aufrufen in the same sentence. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com> * docs(external): say which capability words are not when cues Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com> * fix(validate): keep when cues for de beim, zh 超时 and ja いつ Fixes the narrowed cues that turned real when-clauses into description-no-when: - de: no 60-character cap, imperative and separable use verbs (ruf auf, setz ein), either order, z. B. does not end the sentence - zh: 超时/延时/耗时 followed by a comma or 请 and a use verb counts again; 当事人签字时 counts - ja: いつ with an object before the use verb counts - de: a full stop before an acronym ends the sentence - zh: 当事人 with an unrelated 用时 is no cue - ja: そいつ, あいつ and どいつ are no いつ cue - tests: one case per verb or character in the cue lists Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com> * fix(validate): read german beim per sentence, narrow zh 当事人 guard - German `beim` is matched per sentence after dropping abbreviation dots, so `z. B. GitHub` no longer ends a sentence and a quote-led sentence no longer joins the previous one; the lazy regex spans are gone, so a long description without a terminator stays linear. - The 当事人 guard ends the 当…时 span only on a duration 时 (耗/延/用, 超 before a noun), so `当事人使用时` and `当事人确认超时后` keep their cue and `查询耗时和超时次数` is still no cue. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com> * fix(validate): tighten de, zh and ja when cues after review Fixes: German conjugated use verbs (nutzt, verwendest, benutzt) did not count with beim; a capitalised noun (Ruf, Nutzen) counted as a use verb; zh 当事人 span accepted a terminal 超时 before punctuation; ja いつ accepted noun characters such as 商用 as a use verb. Adds the beim Verwenden capability cases. Fixes: German conjugated use verbs (nutzt, verwendest, benutzt) did not count with beim; a capitalised noun (Ruf, Nutzen) counted as a use verb; zh 当事人 span accepted a terminal 超时 before punctuation; ja いつ accepted noun characters such as 商用 as a use verb. Adds the beim Verwenden capability cases. A capitalised use verb after a label, bullet or opening quote stays a verb: Einsatz: Verwende diesen Skill beim Deployen. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com> * fix(validate): read a German use verb after beim in linear time (#454) _de_verb_in copied the text before every rejected capitalised candidate, so a description with 200000 'Ruf' after 'beim' took seconds. The character before the match is now found by looking back over the spaces. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com> * fix(validate): a German abbreviation like Nr. or Abs. does not end the sentence before beim (#454) 'Verwende diesen Skill laut Nr. 3 beim Deployen.' lost its cue because the dot after Nr ended the sentence between the use verb and beim. Nr, Abs, Art, Kap, Tel, Bd, Hrsg, zzgl, exkl, Mio and Mrd join the abbreviations that keep a sentence going. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com> * fix(validate): a duration word before 处理 keeps the cue of a following use verb (#454) '当事人需要超时处理,请使用本技能重试。' lost its cue because 超时 closed the 当事人 span before 处理. 超时处理 now takes a comma or 请 and a use verb like the bare duration word does. The changelog names this and the German abbreviations. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com> * fix(validate): read an いつ cue up to the sentence end, not 20 characters いつ followed by a use verb more than 20 characters later was no longer a when cue; the verb is now looked for up to the sentence end. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com> * fix(validate): bound the いつ cue lookahead, count German scans (#454) - ja: いつ looked for a use verb to the end of the sentence at every いつ, so a long text of いつ without one was quadratic; it now looks 80 characters on. - tests: the German linear-time test counted elapsed time; it now counts the text read, and the いつ case is pinned by a growth test and a bound test. - ja: いつ looked for a use verb to the end of the sentence at every いつ, so a long text of いつ without one was quadratic; the cue is now found per sentence, with the verb searched once after the first いつ. - tests: the German linear-time test counted elapsed time; it now counts the text read, and the いつ case is pinned by a growth test and a distance test. - changelog: the fragment says the いつ cue has no distance limit within its sentence. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com> * fix(validate): a German abbreviation before a capitalised use verb ends the sentence (#454) `Erstellt Berichte, Tabellen usw. Verwende diesen Skill beim Deployen.` was read as one sentence, so `Verwende` counted as a noun and the `beim` cue was dropped. An abbreviation followed by a capitalised imperative use verb (`Verwende`, `Nutze`, `Benutze`) now keeps its sentence end; a noun such as `Nutzdaten` or `Ruf` after `z. B.` does not. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com> * fix(validate): read Nutzen Sie after an abbreviation, bare verb after 超时处理 (#454) An abbreviation followed by Nutzen/Benutzen/Verwenden/Einsetzen/Rufen/Setzen Sie now ends the sentence, so the formal instruction before beim counts as a cue. 超时处理 followed by a comma and a bare use verb is no cue; it needs 请. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com> * test(repo): pin rg -L as a search that shows lines, grep -L as none rg -L follows links, so rg -L warn AGENTS.md is a counted search; grep -L lists files without a match and is not. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com> * test(repo): drop the rg -L pin, it tests guidance_searched and not the when cue tests/test_shell_search_rg_follow.py pins how process:guidance_searched reads rg -L, which belongs to #1003. It has no license header, so Static checks failed on this PR, and nothing in this PR reads it. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com> * fix(validate): 耗时, 超时 and 延时 are no cue only directly before 调用 or 执行, any other use verb keeps its cue (#454) The generic zh cue excluded every use verb after 耗/超/延 + 时, so 超时使用本工具重试。 and 请求超时触发本技能重试。 were True on main and False here, while the PR text names only 耗时调用, 超时调用 and 延时执行. The exclusion is now those two verbs; a comma or 请 between the duration word and the verb restores them, as before. The changelog fragment and docs say the same. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com> * test(validate): pin the 使お form of the ja いつ cue Signed-off-by: Anton Volkov <antonwolfy@gmail.com> --------- Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com> Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com> Signed-off-by: Anton Volkov <antonwolfy@gmail.com> Co-authored-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com> Co-authored-by: Anton Volkov <antonwolfy@gmail.com>
Summary
process:guidance_readis the row a reader ofrepo compareuses to answer "did the guidance reach the agent", and onmainit is wrong in two directions (#626):maingrep -n -i "deprecat|warn" dpnp/AGENTS.md dpnp/tests/AGENTS.mdshell_walkgives([], False, 0): no record of either file;guidance_read[]guidance_read[],guidance_searched["dpnp/AGENTS.md", "dpnp/tests/AGENTS.md"]rg -n warn dpnp/tests/AGENTS.md([], False, 0)guidance_searched["dpnp/tests/AGENTS.md"]git grep -n warn -- dpnp/AGENTS.md([], False, 0)guidance_searched["dpnp/AGENTS.md"]cat dpnp/tests/AGENTS.md; ls dpnp/tests/third_party/; cat dpnp/tests/third_party/AGENTS.md 2>/dev/null; cat dpnp/tests/third_party/cupy/AGENTS.md 2>/dev/null, in a workspace that holds onlydpnp/tests/AGENTS.mdguidance_readlists all three paths: a call with several reads gives eachrc0, since its exit does not say which file failed, andprocess_metricsmatched the path as a stringguidance_readis["dpnp/tests/AGENTS.md"]The issue offers a second per-cell list or a note under the row. This PR adds the list,
guidance_searched, because a note leaves the number unknown.guidance_readkeeps its meaning (files a print command named;head -n 1 AGENTS.mdlists the file, so the list does not show that the whole file reached the agent). For the second part, the issue offers keeping only paths that exist in the run's workspace or that the arm wrote. This PR keeps the guidance files the workspace held when the agent started: the arm's files and the base's own are in that set, and a file the agent created itself is not.Closes #626
Closes #1013
The same cause was checked in the other readers of
readevents:skill_usageandarm_uptakefilter by the installed skills and the arm's added files, which exist at the start, so a path that never existed is not counted there (first_usefulcounts edits and commands only;reachseeds its probe files and aliases in the workspace). Copilot's owngreptool call is still not parsed, and is tracked in #1002.Changes
guidance_read):held_guidance.held_guidancelists the workspace filesguidance.globsmatch;run_celltakes it right afterprepare_workspaceand before the agent starts, andrun_process_metricskeeps aguidance_readpath only when it is in that set. Thercrules,unknown_reads,tool_calls, denied reads and path normalisation are unchanged, andprocess_metricskeeps itsis_guidancecallable. Nothing is added tometa.json.guidance_searched): the shell walker incli_traces.pyalso followsgrep,egrep,fgrep,rgandgit grep(newshell_search.py, over the option tables ofprobes.py, whichsearch_wordsnow exposes instead of_operandskeeping them private).shell_walkedreturns the reads and the searched files, andshell_walkkeeps its tuple. A piped search counts only when every later stage is aheadortailwith known options that passes lines (_search_stage,cuts_lines).searchedlist on thecommandevent (Claude Code Bash, Codex, Copilotbash) and on thetoolevent of a Claude CodeGrepcall with apathandoutput_modecontent. No event kind orreadevent is added, sotool_callsis unchanged.repo_event.v2.json(the version the writer emits) declares the field as a list of strings, andrepo_event.v1.jsonis unchanged;docs/events-format.mddocuments the field.drop_failed_searchesfor Codex and Copilot,_note_searchedfor Claude Code). A relative file after an earlier call'scdis dropped and is not added tounknown_reads, which counts reads.drop_failed_searchesjudges a search piped intoheadortailbyfailed_searchalone:grep warn AGENTS.md | head -n 1with exit 141 (grepkilled by the closed pipe after it showed a line) keepssearchedfor Codex and Copilot, and the same pipeline with exit 1 still drops it.process_metricsbuildsguidance_searched(sorted, distinct, glob-matched, held at start);process_countscounts it as a list (LIST_KEYS), which givesrepo compareaprocess:guidance_searchedrow andrepo reportthe figure next toguidance_read.sedhelpers ofcli_traces.pymoved unchanged toshell_sed.py: the file was at 796 of the 800-line cap.guidance_readstates the held-at-start rule; newguidance_searchedrow; the pipe/grep/rgsentence and §7's "stays unseen" point to it),docs/events-format.md,docs/reviewing.md.test_repo_events_search.py(walker, Claude/Codex/Copilot traces,Greptool, schema),test_repo_run_guidance.py(fake runs: held set, arm-removed file, searched list), and cases intest_repo_process_metrics.pyandtest_repo_process_counts.py(thecomparerow and the report line). Four existing tests pinned the wholeprocessobject or the measure list, and now include the new key:test_no_events_counts_zero,test_process_counters_are_descriptive_measures,test_run_isolates_the_agent_and_grades_each_cell,test_process_metrics_reach_result_json._Walk.words()takesstaged, and the piped-search step passes it, so a computed directory change cut out of a pipeline (eval "$(conda shell.bash hook)" 2>&1 | tail -2,cd $D | head,source $ENV | tail) loses no directory, as the whole pipeline part did not. Without it, one such command emptiedguidance_readfor every later relative read of the trace. Commit5dea4ff2.probes._option_namesends a short cluster at its first value option of the program, sorg -tc warn AGENTS.md(-twith the typec) andrg '-g*.lock' warn AGENTS.mdare searches ofAGENTS.md, whilegrep -cm1andgrep -ncstill read the count flag. Commit08302210.probes._value_spanreads a short cluster from the left too: the first value letter ends the options, and the next word is its value only when that letter is the last one.rg -g'*.md' warn AGENTS.mdandrg -g'*.C' warn AGENTS.md(clusters ending in-dand-C, rg's value options) no longer takewarnas that value and loseAGENTS.md;rg -tm pat flikewise. This changesprobes._operandsfor those command lines only, so a probe path pattern on a file such agreporrgnames is found as well (no probe test pinned the old result). Commit181a7ca3.a8c05745: a keyword before a piped search (if grep x f | head,while,elif,then) is dropped as the unpiped path does,!still ends it. A trailingheadortailcounts only with known options, no file, a nonzero count (-n 0,-c 0,--lines=0pass nothing;tail -n +0is all lines), no--helpor--version, and no shell function of that name defined in the call (cuts_linesinshell_search.py).probes.search_wordsreads-e/-fwith an attached value, alone or in a cluster (grep -ewarn AGENTS.md,rg -nefoo,grep -fpats AGENTS.md), so the file operand is no longer taken for the expression. A refusedGreptool event drops itssearchedlist (events._deny).held_guidancemoves toheld_guidance.pyand returns aHeldGuidancethat resolves a path through links:alias/AGENTS.mdwithalias -> docscounts, a dangling or looping link (sub/AGENTS.md -> missing.md) is no held file, for reads and searches.shell_sed.pygains tests for the attached-escript and--, and loses a branch that returned the same empty list as the general one.f5748d93:HeldGuidancerecords the workspace's links when the agent starts and resolves an event path through them, soalias/AGENTS.mdstill counts after the agent removedaliasor put a directory of its own there._search_stagestrips the harmless stderr redirects (2>/dev/null,2>&1,2>file) from eachheadortailstage beforecuts_linesreads its options (new_without_stderr, which_Walk.wordsuses too), sogrep warn AGENTS.md | head -n 20 2>/dev/nullsearchesAGENTS.md;| head > out.txtand| tail 2>/dev/null 1>&2still do not. Contract §4.1 and the fragment say so.acaedab5:--helpand--versionstop a search only as options the parser sees, sogrep -e --help AGENTS.mdandrg -e --version AGENTS.mdsearchAGENTS.md(searched_filesreads them from the parsed flags; the argument scan insearchingis gone). A match limit of zero (-m0,-m 0,--max-count=0,-nm0) searches nothing:search_wordsnow also returns the value of the last-m/--max-count. The valued-option tables gain grep's--include,--exclude,--exclude-dir,--exclude-from,--group-separatorand rg's--type-clear,--ignore-file,--pre,--pre-glob,--color,--colors,--engine,--max-filesize, the separators, the size limits and--hyperlink-format, sogrep -e warn --exclude AGENTS.md other.txtsearchesother.txtonly. Ahead/tailcut stage takes--and-when no other file follows (head -n 20 --,tail -n 20 -), refuses an attached value on a valueless long option (--quiet=bad;tail --follow=descriptorand its prefixes stay valid) and reads only GNU's size suffixes (1k,2KiB,3MB; not1qq,2kb).HeldGuidanceresolves from the path's anchor (C:\withntpathrules), restarts a rooted or absolute link target on the drive of the link and reads link targets withoverlay_paths._link_target.73d5e541: a relativepathof a Claude CodeGrepcall starts at the directory the harness started in (sub/AGENTS.mdwithcwd="sub"; an absolute path is unchanged). Atailstage with a value the tool refuses (--follow=bad,--pid=x,--pidwith no number,-s x,--sleep-interval=x,--max-unchanged-stats=-1, and a count that is no number even when a later-n 5follows) no longer passes lines, sogrep warn AGENTS.md sub/AGENTS.md | tail --follow=badsearches nothing. Forgrep,egrep,fgrepandgit grepan unambiguous prefix of a long option is read as the option (--qui,--cou,--files-witho); an ambiguous one (--co) and anyrgoption are read as written.probes._match_limitloses a loop exit no input reaches, the partial line codecov names.b182121c: a Claude CodeGrepresult that is empty or saysNo matches found(anoffsetpast the last line) keeps nosearchedon its event, as an error result does not.HeldGuidance.resolvedreturns None for a path that follows more than 40 links, and membership refuses it, soalias -> alias/../docs(each pass of the pending..returns todocs) no longer leadsalias/AGENTS.mdtodocs/AGENTS.md.probes.search_wordswrites a GNU grep long option in full (_gnu_long, the table moved fromshell_search.py) before it decides the option's value span, sogrep -e warn --exclude-d AGENTS.md other.txtsearchesother.txtonly and--max=0is a zero match limit (guidance_searched counts a grep with an abbreviated zero match limit (--max=0) #1013); an ambiguous prefix (--exclu) andrgoptions are read as written.29cc666a: a Claude Code Bash call, Codex command or Copilotbashcommand whose result is the empty text keeps nosearched(grep warn AGENTS.md | headexits 0 when nothing matched, so the exit code could not tell); a result that carries no text field keeps itssearched, since only an explicitly empty text shows that nothing printed.tail --follow=nameand its prefixes (n,na,nam) no longer pass lines: tail refuses to follow its input by name before it prints one (tail: cannot follow '-' by name).HeldGuidancesnapshots the workspace's directories with its links, and a link whose target goes..out of a name that was no directory at the start (alias -> missing/../docs, or out of a file) leads to no held file, as the system fails there; a target on another drive (Windows) returns None instead of raisingValueErrorfromos.path.relpath, which lost the cell's wholeprocessobject.searched_fieldmoved toshell_search.py:cli_traces.pywas over the 800-line cap with the change.188a5c09anda75ee080:HeldGuidancekeys its held files, links and directories byos.path.normcase, so under Windows rulesDOCS/AGENTS.mdis held wheredocs/AGENTS.mdis, while POSIX stays case-sensitive andresolved()keeps the spelling it was given. A command whose searches are all in its last part and exits 1 lists none of its files (failed_search, used bydrop_failed_searchesand_note_searched; Claude Code's error counts as exit 1, except for a last part that pipes the search intoheadortail). A relative Claude CodeGreppath after a Bash call that may have moved the shell is dropped (_settle_grep).grep -V,rg -Vandrg -hsearch nothing (grep -hstays a search). A cut stage may be a system path tohead/tailor start withNAME=valuewords,|&is a pipe (shell_split.pyno longer reads its&as backgrounding), andgit --no-pager,-Pand-c key=valuemay come beforegrep;git -Cstill does not.docs/reviewing.mdsaysguidance_searched: []is not "never searched". The redirect helpers moved toshell_redirects.py:cli_traces.pywas at the 800-line cap.92c84964: anrg --passthru(or--passthrough) prints every line of its files, matching or not, and exits 1 when none matched, so it is no failed search:failed_searchand_failed_readkeep its files (shell_search.passes_through,_Walk.passthru).failed_searchno longer compares the number of searched paths of the whole script with that of its last part walked alone; the walker records where the last part began (_Walk.last_start), so an earlier search is found in the same walk as the whole script's.grep x AGENTS.md; cd "$D"; grep y docs/AGENTS.mdthat exits 1 keepsAGENTS.md: the final relative operand was lost after the computedcd, and the old counts were both 1. A Claude CodeGreppath that is absolute on Windows (C:/ws/AGENTS.md,C:\ws\AGENTS.md, a UNC path) is no relative grep for_settle_grep(events._absolute), so a Bashcdbefore it keeps itssearched.97f2cf19: the}that closes a brace group is no longer the script's last part (_Walk.last_start), soecho hi; { grep zzz AGENTS.md docs/AGENTS.md; }that exits 1 lists none, as without the braces._Walk.passthruis set only by anrg --passthruthat names files it shows lines of, soecho hi; rg --passthru -q x other.txt; grep nomatch AGENTS.mdthat exits 1 lists none. Ahead/tailcount and a match limit are tested for zero by digit, not throughint(), so a value of 5000 digits no longer raisesValueError(it aborted the Claude Code conversion, and dropped the record in Codex and Copilot).dd31b7cf: a Claude Code Bash call that failed and whose last part pipes a search intoheadortailkeeps itssearchedwhen the result has text (set -o pipefail; grep x AGENTS.md | head -n 1can fail withgrepkilled by the closed pipe afterheadshowed a line); with the empty text it still keeps none, and a known exit 1 of Codex or Copilot still drops them (failed_search(..., exit_known=False),_Walk.cut;_settle_bashnow always asks_note_searchedfor a call that was not refused).git grepis its own program in the option tables, sogit grep --max-depth 0 AGENTS.md -- other.txtsearchesother.txt, notAGENTS.md;git grep -hstays a search, as in git.226e5968:probes._gnu_longexpands an abbreviated long option against git grep's own options forgit grep(_GIT_GREP_LONG), not GNU grep's, sogit grep --max-d 0 AGENTS.md -- other.txtreads0as the value of--max-depthand searchesother.txtonly.--hostname-binis added to rg's valued options, sorg --hostname-bin /bin/hostname AGENTS.md other.txtsearchesother.txtonly.f6c1c964: a brace group whose output goes to a file or a pipe ({ rg --passthru zzz other.txt; } >/dev/null) is dropped from the reads with its searches, and now also itsrg --passthrumark:_Walk.open_grouprecordspassthruandclose_grouprestores it besideunknown.{ rg --passthru zzz other.txt; } >/dev/null; echo hi; grep nomatch AGENTS.mdthat exits 1 lists none; the leftover mark madefailed_searchfalse and creditedAGENTS.md.c7594b1d: a match limit written with a leading plus (grep -m +0,-m+0,--max-count=+00,rg -m +0) is a zero limit and searches nothing, as-m 0does:searched_filesstrips one leading+before it tests the value for zero (strtoimax and Rust's integer parse take the plus), sogrep -m +0 warn AGENTS.md; echo doneno longer creditsAGENTS.md.docs/reviewing.mdand the fragment no longer callguidance_reada list of files printed whole:head -n 1 AGENTS.mdandsed -n 1p AGENTS.mdlist the file, so the list does not show that the whole file reached the agent, andagent.stdoutdoes.909e7011:searchedwas declared inrepo_event.v1.json, the retired version, so a stringsearchedwas rejected on v1 and accepted on the v2 lines the writer emits. It is declared inrepo_event.v2.jsonnow (a list of strings, for every kind that carries it) andrepo_event.v1.jsonis as onmain; the schema test validates v2 lines, and a second test checks the linesevents_jsonl()writes (v: 2) for a Bash search and aGrepcall. A search of several files lists every file it named once the command showed a line, without attributing lines to files:grep -n visible AGENTS.md docs/AGENTS.mdwith the outputAGENTS.md:1:visiblelists both. Contract §4.1,docs/events-format.md,docs/reviewing.mdand the fragment say so, and a test pins the example.Addedchange, apart from the sentences the fourth to seventeenth rounds append to theAddedentry.Risk
result.jsonprocessgainsguidance_searchedfor runs from now on; earlier cells lack it and are left out of its mean, not counted as zero. Stored results and traces are not re-derived.guidance_readcan only shrink, and only for cells that named a path the workspace did not hold (the issue's replay has 3 such Opus cells) or that the agent created itself and then read. A read of a file the workspace held is unchanged.events.jsonllines may carrysearched; readers ignore unknown fields,repo_event.v1.jsonis unchanged, andschema_compatstays green (it warns thatsearchedis a new typed property of an open object that no base fixture writes).grep x AGENTS.md sub/AGENTS.md,echo hi; grep zzz AGENTS.md) that exits 1 lists none of its files, since 1 is a search that matched no line in any of them; Claude Code reports only an error, which counts as exit 1, so a search over two files that matched in one and hit a missing file in the other loses both there; a search piped intoheadortailkeeps its files on an error with a result text, since underpipefailthe error may begrepkilled by the closed pipe after lines were shown. Any other exit (2), anrg --passthru, and a command with an earlier search (grep a A.md; grep b B.md, also when a later computedcdloses the directory of the last part) keep their files, as a multi-file read does, unless the trace gives the command's result as the empty text, which drops them...after a symlink in a command operand (grep warn alias/../AGENTS.mdwithalias -> docs/nested) is read lexically, for reads as well as searches, as onmain: the path is persisted normalised (AGENTS.md), so it credits the file the system would not open.greptool (repo: a Copilot grep tool call over a guidance file is not in guidance_searched #1002), PowerShell,git -C dir grep, a glob or computed operand, a directory operand (grep -r x docsnames no guidance file).git merge-tree): feat(repo): turn and compaction events per model call in events.jsonl #779 meets one conflict inevents.py's imports (shell_walkedhere, feat(repo): turn and compaction events per model call in events.jsonl #779'sturn_eventsimport on the next line); itsdocs/events-format.mdconflict is withmainalready. fix(text): scan openers with no closer in linear time at ten regex sites #933 has merged intomain; its_stdout_after_stderris what this branch uses now. feat(repo): choice events for a candidate's install, import, use or removal #787 already conflicts withmaininevents.py,probes.py,runner.pyand the contract, so its rebase also meetssearch_wordsand_value_spaninprobes.py,_note_searchedand_tool_eventinevents.py, and theheldline ofrun_cell. cli: reps and concurrency flags have one spelling each (F1b, part of #94) #957's one conflict, intests/test_repo_batch_lifecycle.py, is withmain, not with this branch. feat(repo): fingerprint the host with collectors; --label-host runs a missed host #781, fix(repo): refuse a --cache-root, --cache or $DOKIMI_REPO_CACHE that is not a usable directory with exit 2 #891, feat(repo scan): a gate any repository can adopt (#851) #898, fix(repo): repo validate reports a task.json link that loops or is a directory (#910) #952, fix(repo): inspect skips a tracked file in an unsearchable dir (#906) #953, feat(cli): one spelling each for the spend and dry-run flags (part of #94) #955, feat(cli): explore list and repo validate move to eval tasks list and eval check --schema-only (#276 M1) #956, feat(cli): --fail-on takes warn or fail on the gate leaves (#94 F1b) #958 and docs(repo): events.jsonl output clip and review gold file match the code (#964) #977 merge with it cleanly.Testing
On a Linux review host, at
f825045c(onmain5e96beb):make ci-local: 35 passed, 2 failed, 14 skipped. The two failures are the gitleaks download (Install gitleaks: curl error 504 four times, thenScan commitsfinds no binary, exit 127), which this host cannot fetch; the Docker steps, the pinned Claude Code install, the conda-forge, fuzz and semgrep steps, the Intel matrix legs, deploy and report jobs are skipped. 25847 tests passed, 19 skipped; mutation of changed lines: the step passed.maininto the branch conflicted inrepos/cli_traces.py:mainmade_HEREDOCaHeredocPatternand replaced theSTDOUT_AFTER_STDERRregex with the linear_stdout_after_stderr(fix(text): scan openers with no closer in linear time at ten regex sites #933), while this branch had moved the redirect regexes torepos/shell_redirects.py. The merge keepsHeredocPatternand the branch's module, andwithout_stderrandclose_groupcallmain's_stdout_after_stderr; the branch's regex is dropped.git diff --stat origin/main HEADlists only this PR's files;test_repo_cli_traces.py,test_repo_events_search.py,test_unclosed_openers.py,test_repo_run_guidance.py,test_import_architecture.pyandtest_growth_ratchet.pypass (982 passed).main(before this one) conflicted inrepos/events.py(the import block and the end of_claude_stream_json); both sides were kept.main's code the new tests fail on assertions:test_repo_events_search.py83 failed (the first:assert [None] == [['dpnp/AGENTS.md']]for the issue's grep),test_repo_run_guidance.py3 failed (['sub/AGENTS.md', 'sub/x/AGENTS.md', 'sub/x/y/AGENTS.md'] == ['sub/AGENTS.md']),test_repo_process_metrics.py4 failed, 38 passed,test_repo_process_counts.py2 failed, 11 passed,test_repo_run.py2 failed, 92 passed.mainhas noshell_walkedorheldparameter, so the copy ofmainused for these runs gave them main's behaviour under those names.grep warn AGENTS.md | head -n 1with exit 141 and outputAGENTS.md:1:warn:searchedwas lost (None) for Codex and Copilot, and is["AGENTS.md"]now. With the old condition restored on a copy, the 3 new tests intest_repo_events_search.pyfail (3 failed, 278 passed).test_repo_events_search.pyat6ee0bea1, the first onassert ([], True, 1) == (['AGENTS.md'], False, 0)), the short-option tests fail (3 failed, 97 passed at5dea4ff2, the first onassert [] == ['AGENTS.md']forrg -tc); the operands test passes in both; the cluster-value tests fail at08302210(5 failed, 102 passed, the first onassert () == ('AGENTS.md',)forrg -g*.md).git grep, the negation and pipe rules, the failed-search and refused-call rules, thecdrule, theGrepmodes, the list counting and the row order, the staged guard, the whole-cluster flag reading, the last-letter rule of_value_span) each fail at least one new test.181a7ca3:test_repo_events_search.pyandtest_repo_cli_traces.pyfail 27 cases (the first:grep -fpatterns.txt AGENTS.mdandif grep warn AGENTS.md | head -n 20; then echo yes; figive no searched file);test_repo_run_guidance.pycannot importheld_guidance.py. Behaviour now:grep warn AGENTS.md | head -n 0,| head --help,head() { :; }; grep warn AGENTS.md | headandif ! grep warn AGENTS.md | head; then ...search nothing;grep -ewarn AGENTS.mdandif grep warn AGENTS.md | head -n 20; then echo yes; fisearchAGENTS.md.!rule, the zero-count rule, the--help/--versionrule, the function check, the-n/-ccount option, the-fletter of an attached cluster, the attached expression value, the refused-Greppop, the dangling-link filter, the link resolution, the attached-eofsed,sed's--) each fail at least one test; the one that first survived (a pattern file namedpatterns.txt, whoseeread as-e) is killed by-fpats.alias -> docslinked at the start and then replaced by a directory,alias/AGENTS.mdstays inguidance_readandguidance_searched;grep warn AGENTS.md | head -n 20 2>/dev/null,rg warn AGENTS.md 2>&1 | tail -n 5 2>/dev/nulland| tail -3 2>&1searchAGENTS.md,| head --quiettoo;| head 2>/dev/null > out.txt,| tail -n 5 2>/dev/null 1>&2and an unsplittable stage search nothing._cut_longrefusing a flag without a value,cuts_linesaccepting a stageshlexcannot split) each fail at least one new test: 6 failed for the first two, and 5 failed intest_repo_events_search.pywith the other two added.grep -e --help AGENTS.md,rg -e --version AGENTS.md,grep -e warn --exclude AGENTS.md other.txt(other.txtonly),rg warn --ignore-file AGENTS.md other.txt,| head -n 20 --,| tail -n 20 -and| head -c 2KiBsearch the file;grep -m0 warn AGENTS.md | head,-m 0,--max-count=0,--help -e warn AGENTS.md,grep -e warn --exclude AGENTS.md,| head --quiet=bad,| head -n 1qq,| head -c 2kb,| head -n 20 -- other.mdand| tail -n 5 - other.mdsearch nothing. A Windows alias (alias -> docsunderC:\repo\workspace, an absoluteC:\...target, a rooted\repo\...target, a..\target) leads to the helddocs/AGENTS.mdunderntpathrules, and a link loop leaves the path unheld.--helpscan over all arguments, the zero limit,--excludeand--ignore-filedropped from the tables, the attached value on a flag, the permissive suffix pattern,--refused,-refused, the drive dropped from the anchor) each fail at least one new test: 7, 10, 2, 2, 6, 3, 2, 1 and 1 failed.cwd="sub"aGrepcall withpath="AGENTS.md"persistssearched=["sub/AGENTS.md"]and one with/ws/AGENTS.mdpersists["AGENTS.md"];grep warn AGENTS.md sub/AGENTS.md | tail --follow=bad(also--pid=x,--pid,-s x) andgrep --qui warn AGENTS.md/grep --cou warn AGENTS.mdsearch nothing in the Claude Code, Codex and Copilot converters;tail --follow=d,--pid=123 -s 0.5,grep --line-n warn AGENTS.md,grep --co warn AGENTS.mdandrg --cou warn AGENTS.mdsearch the file.shell_search.pyis at 100% line and branch coverage under the search tests, and theprobes.pyline codecov named is gone from the missing list.Greppath not anchored at the start directory, grep's long-option prefixes not expanded, the value check oftail's valued long options dropped, and that plus the--followmode check dropped) each fail at least one new test: 1, 10, 6 and 10 failed intest_repo_events_search.py.Grepcall incontentmode onAGENTS.mdwithoffset50 and the resultNo matches found(or empty, or blank) persists nosearchedand givesguidance_searched[]; withalias -> alias/../docsanddocs/AGENTS.mdheld,alias/AGENTS.mdis not held anddocs/AGENTS.mdis;grep -e warn --exclude-d AGENTS.md other.txt,--exclude-f=AGENTS.mdsearchother.txtonly,--max 1,--aft 2and--max=1searchAGENTS.md,--max=0searches nothing;rg -e warn --exclude-d AGENTS.md other.txtsearches both files.Grepdropped, the hop limit continuing past the 40th link instead of returning None,_gnu_longnot applied insearch_words) each fail at least one new test: 3, 1 and 4 of the new cases, and the older--quiand--coucases fail with the third (the--max=0case was added after this run).grep warn AGENTS.md | headandgrep warn AGENTS.md sub/AGENTS.mdwith a result of the empty text persist nosearchedin the Claude Code, Codex (started and completed-only) and Copilot converters, and with the textAGENTS.md:1:warnthey do; a Codex item without anaggregated_outputfield keeps itssearched.grep warn AGENTS.md sub/AGENTS.md | tail --follow=name(also=n,=nam) searches nothing,| tail --follow,--follow=dand--follow=descriptorsearch both. Withdangling -> missing/../docs,afile -> docs/AGENTS.md/../../docsandfine -> docs/../docs,dangling/AGENTS.mdandafile/AGENTS.mdare not held andfine/AGENTS.mdis, also aftermissingis made later; underntpathrules a link toD:\externalfromC:\repo\workspaceleavesext/AGENTS.mdunheld and raises nothing.nameaccepted again, in the cut-stage, Codex and Copilot tests; the Claude Code empty-result flag unset, and its use in_note_searched; the Codex finished and completed-only empty rules; the Copilot empty rule; the..check on a link target's names;ValueErrornot caught) each fail the test that pins them: 3, 2, 1, 2, 2, 1, 1, 1, 1 and 1 failed.grep warn AGENTS.md sub/AGENTS.md,echo hi; grep zzz AGENTS.mdandcd sub && grep zzz AGENTS.mdwith an error result list nothing, and with an ok result list their files;grep a AGENTS.md; grep b sub/AGENTS.mdwith an error keeps both; a Codexgrep warn AGENTS.md sub/AGENTS.mdlists nothing on exit 1 and both files on exit 0 and 2, and a Copilot one the same on exit 1 and 2. Aftercd subin a Bash call, aGrepcall withpath="AGENTS.md"persists nosearchedand one with/ws/AGENTS.mdpersists["AGENTS.md"]; before thecd, or after a refused one, the relative path counts.grep -V,rg -Vandrg -hsearch nothing,grep -h warn AGENTS.mdsearches the file;| /usr/bin/head,| LC_ALL=C head -n 3,|& head -n 2,git --no-pager grep,git -P grepandgit -c k=v --no-pager grepsearchAGENTS.md, while| ./head,| /opt/bin/headandgit -C sub --no-pager grepsearch nothing. UnderntpathrulesDOCS/AGENTS.md,docs/agents.md,ALIAS/AGENTS.mdandDots/AGENTS.mdare held wheredocs/AGENTS.mdand the aliases to it are.failed_searchnever true, ignoring earlier searches, and true for any exit; the Claude Code emptyno_matchflag; theGrepdrop after acdoff, counting a refusedcdand dropping an absolute path;Vand rg'shdropped from the no-line options andgrep -hadded to them; the|&strip and theshell_split.pyrule; the system path and theNAME=valuerule of a cut stage and a cut stage taking any path;--no-pager,-Pand-cnot skipped beforegrep) each fail the test that pins them. With these tests on the code of29cc666a18 fail (the first:grep warn AGENTS.md sub/AGENTS.mdwith an error result still lists both files).# a\nline\n,rg --passthru zzz AGENTS.md sub/AGENTS.md,rg --passthru zzz AGENTS.md,rg --passthrough zzz AGENTS.mdandcd sub && rg --passthru zzz AGENTS.md | headkeep their files in the Claude Code, Codex and Copilot converters, while the same commands without the option and with the empty output list none.grep x AGENTS.md; cd "$D"; grep y sub/AGENTS.mdandgrep x AGENTS.md; cd $(dirname $F) && grep y sub/AGENTS.mdwith exit 1 keep["AGENTS.md"]in the three converters;failed_searchis false for both, and true forecho hi; cd "$D"; grep y /ws/AGENTS.md. After a Bashcd sub, aGrepcall withC:/ws/AGENTS.md,C:\ws\AGENTS.md(workdirC:/ws) persistssearched["AGENTS.md"]and a UNC path persists itself, while a relativeAGENTS.mdstill persists none.passes_throughalways false (4 failed), the old count comparison infailed_searchback (2 failed of the lost-directory test, plus 4 of the passthru test, which the old code also fails) andevents._absolutereading only a leading/(3 failed). Replacing the earlier-search check by a constant false fails only the oldergrep a AGENTS.md; grep b sub/AGENTS.mdcases, as the last part alone finds nothing after the lostcd.hi\n,echo hi; { grep zzz AGENTS.md docs/AGENTS.md; }(also with2>/dev/nullafter the brace),echo hi; rg --passthru -q x other.txt; grep nomatch AGENTS.mdand the same with--countlist nothing in the Claude Code, Codex and Copilot converters, andfailed_searchis true for each.grep x AGENTS.md | head -n Nandgrep -m N x AGENTS.mdwith N of 5000 nines or zeros, or 5000 zeros and a 1, raise nothing in the three converters: the nines and the last value listAGENTS.md, the zeros list nothing.rg --passthrumarking the walk without a file (2 failed), and theint()zero test back incuts_lines(3 failed) or insearched_files(3 failedValueError, with thecuts_linesfix kept).AGENTS.md:1:x,set -o pipefail; grep x AGENTS.md | head -n 1persists["AGENTS.md"]andcd sub && grep x AGENTS.md | tail -3persists["sub/AGENTS.md"]; with an error and the empty text both persist none;failed_searchwith a known exit 1 is still true for both.git grep --max-depth 0 AGENTS.md -- other.txtsearches["other.txt"]and givesguidance_searched[];git grep -h warn -- AGENTS.mdandgit grep --threads 2 -m 1 warn AGENTS.mdsearchAGENTS.md. Run with git 2.53:git grep -h x AGENTS.md AGENTS.mdprinted the line, and with a missing second file it exited 128, not a help exit 129.walk.cutguard offailed_searchdisabled (2 failed) andgit grepconverted togrepagain (2 failed).git grep --max-d 0 AGENTS.md -- other.txtandgit grep --max-depth=0 AGENTS.md -- other.txtsearch["other.txt"]and giveguidance_searched[];rg --hostname-bin /bin/hostname AGENTS.md other.txtthe same._gnu_longusing GNU grep's options forgit grepagain (test_git_grep_reads_an_abbreviated_max_depth_as_git_does, 1 failed) and--hostname-bindropped from_RG_VALUES(test_rg_hostname_bin_takes_the_next_word_as_its_value, 1 failed).hi\n,{ rg --passthru zzz other.txt; } >/dev/null; echo hi; grep nomatch AGENTS.mdand{ rg --passthru zzz other.txt; } | cat; echo hi; grep nomatch AGENTS.mdlist nothing in the Claude Code, Codex and Copilot converters, andfailed_searchis true for each.passthruinclose_groupfails the two new cases oftest_a_no_match_search_in_a_brace_group_or_after_a_quiet_passthru_shows_no_line(2 failed, 284 passed intest_repo_events_search.py).grep -m +0 warn AGENTS.md,grep -m+0 warn AGENTS.md,grep --max-count=+00 warn AGENTS.mdandrg -m +0 warn AGENTS.mdsearch nothing, and a Codex commandgrep -m +0 warn AGENTS.md; echo donewith exit 0 and the outputdonepersists nosearched, whilegrep -m +1 warn AGENTS.md; echo donepersists["AGENTS.md"]. I could not run GNU grep with-m +0here (the host'sgrepis ugrep); the reading rests onstrtoimaxand Rust'susizeparse accepting a leading+.+fails 6 cases (4 option forms oftest_a_search_that_shows_no_line_of_a_file_is_not_searched, andtest_codex_searches_follow_the_same_rulesstarted and completed only; 6 failed, 284 passed intest_repo_events_search.py).schema_errors("repo_event.v2", ...)rejects acommandevent whosesearchedis a string or holds an integer and accepts a list of paths, for acommandand atoolevent;repo_event.v1.jsonstill accepts a stringsearched; thesearchedevents of a converted Bash search andGrepcall, asevents_jsonl()writes them, carryv: 2and validate.grep -n visible AGENTS.md docs/AGENTS.mdwith the outputAGENTS.md:1:visiblegivesguidance_searched["AGENTS.md", "docs/AGENTS.md"].python -m dokimi.schema_compat --base origin/mainis OK (a warning for the newsearchedproperty).searcheddropped fromrepo_event.v2.json(test_the_schema_takes_a_list_of_paths_in_searched),searchedadded torepo_event.v1.jsonagain (test_the_retired_version_1_schema_is_unchanged_by_searched), and_note_searchedkeeping only the first file (test_a_multi_file_grep_lists_every_file_it_named_when_only_one_showed_a_line); the writer stampingv: 1failstest_the_searched_events_the_converter_writes_validate_under_the_version_it_writes.Grepdefaultoutput_mode(files_with_matches) is not shown by any fixture in the repo.Open questions
Grepincontentmode with apathcounts unless its result is an error, empty or the textNo matches found; no fixture in the repo shows what Claude Code prints for no match, so that text is the assumed one, and any other wording for it would still count. For a Bash, Codex or Copilot command the empty text is the only result taken as no line shown.Revert
A plain revert restores the old
guidance_read(which lists a path the workspace never held) and dropsguidance_searched. Storedresult.jsonfiles keep theguidance_searchedkey and storedevents.jsonllines keepsearched; the reverted code ignores both, and nothing else is stored.Checklist
pytestpasses (25847 passed, 19 skipped;make ci-localfailed only on the gitleaks download)ruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)