Repository navigation
fix(repo): reach prose count skips a short lead-in line before the tokens - #368
Conversation
A `repo reach` audit on IntelPython/dpnp#3099 had Haiku answer the read=dpnp scenario with "Now I'll list all verification tokens found in my context:" on its own line and then all four tokens. prose_words counted the lead-in's 10 words and the text output warned "answered with 10 words besides tokens; read its trace before trusting its not_loaded cells", though every token was reported. prose_words now drops the first non-empty line when it ends in ':' and a later line holds a token. Every other word still counts: a sentence after the tokens, a lead-in with no token after it, a first line that does not end in ':'. Contract section 7's `prose` bullet says so; the cases are pinned in tests/test_repo_reach_edges.py next to the other prose tests. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change that avoids false prose warnings for token-list lead-ins.
No open issues 🎉
What changed in this PR
0 new findings; nothing to fix.
This PR prevents false prose warnings in repo reach when an agent introduces its token list with a short lead-in.
Changes:
- Excludes the first non-empty line from the prose count when it ends in
:and a later line contains a token. - Adds seven regression cases covering qualifying lead-ins and prose that must still count.
- Updates the contract and changelog to describe the counting rule.
| File | Description |
|---|---|
dokimi/tests/test_repo_reach_edges.py |
Adds regression coverage for lead-in handling. |
dokimi/dokimi/repos/reach.py |
Implements and documents the lead-in exclusion. |
dokimi/docs/repo-evaluation-contract.md |
Clarifies how lead-ins affect prose. |
dokimi/changelog.d/20261102_120000_antonwolfy_reach-lead-in-prose.md |
Records the prose-warning fix. |
Review effort: Balanced
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 4 selected item(s). Review details
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #368 +/- ##
==========================================
+ Coverage 94.29% 94.30% +0.01%
==========================================
Files 308 309 +1
Lines 39322 39443 +121
Branches 6651 6673 +22
==========================================
+ Hits 37077 37198 +121
- Misses 1432 1433 +1
+ Partials 813 812 -1
🚀 New features to boost your workflow:
|
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
Review at 268a8f2. The fix is right for the Haiku answer and the tests pin the cases that must still count; one gap: a lead-in of any length is dropped, so a long explanation on one line ending in : hides the prose warning (line comment).
What I ran, at 268a8f2:
make ci-local --offline: 0 failed, 19 passed, 13 skipped.prose_wordson a 25-word refusal line ending in:followed by one token: 0.
Checked, no issues
- Docs and changelog: the contract and the fragment (Fixed) describe the new rule and its limits.
napetrov
left a comment
There was a problem hiding this comment.
The only finding is the one already open in #368 (comment): a one-line refusal ending in : goes from 18 to 0 words and the prose warning goes silent (probe_prose.py, base vs head). Nothing else found. Not handled on either tree, and not claimed: a lead-in wrapped over two lines, a full-width :.
Coverage: plain + edge passes; test_repo_reach_edges.py 23 passed on head; no live harness.
Review of intel#368: the lead-in was dropped whatever its length, so a one-line explanation or partial refusal ending in ':' before a token counted as 0 prose and the warning to check that trace's not_loaded cells stayed silent. prose_words now skips the first non-empty line only when it ends in ':', has at most LEAD_IN_WORDS (12) words and a later line holds a token; Haiku's lead-in has 10. A longer line counts. The tests add the reviewer's 23-word refusal line (counted) and a 12/13-word boundary pair; the docstring, the contract's prose bullet and the changelog fragment state the limit. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
Round for @vlad-perevezentsev's review, at d0b1adf (CI green, OpenCodeReview 0 findings): a first line ending in |
Summary
Follow-up to an audit of a
dokimi repo reachrun on IntelPython/dpnp#3099 (item 7, part 1): a lead-in line before the tokens tripped the prose warning.Haiku answered the
read=dpnpscenario withNow I'll list all verification tokens found in my context:on its own line, then all 4 tokens one per line.prose_wordscounted the lead-in's 10 words, overPROSE_LIMIT(8), so the text output printedwarning: read=dpnp answered with 10 words besides tokens; read its trace before trusting its not_loaded cellsalthough every token was reported.Review of this PR (comment): the first version dropped the lead-in whatever its length, so a one-line explanation or partial refusal ending in
:counted as 0 prose and the warning stayed silent. The lead-in is now skipped only when it has at most 12 words.prose_wordson main and on this branch (<lead-in>is the line above,<4 tokens>the four tokens one per line,<refusal>the reviewer's lineI could not read most files because the sandbox denied access, and I refuse to guess what else was there, but here is what I saw:):<lead-in>+<4 tokens>(the dpnp answer)<lead-in>, blank line,<4 tokens><lead-in>+<4 tokens>+These are all the tokens.<lead-in>alone<lead-in>+NONE<lead-in>ending in.instead of:+<4 tokens><lead-in>, then a tokenHere are all the verification tokens that were found in my context:(12 words) + a tokenHere are all of the verification tokens that were found in my context:(13 words) + a token<refusal>+ a tokenChanges
dokimi/dokimi/repos/reach.py::prose_words: the first non-empty line is not counted when it ends in:, has at mostLEAD_IN_WORDS(12) words, counted asprosecounts them, and a later line holds a token. Every other word still counts: a sentence after the tokens, a lead-in with no token after it, a first line not ending in:, a:line that is not the first, a first line of 13 or more words. The docstring says so. The word count moves into a helper,_prose, used for both the line and the answer.docs/repo-evaluation-contract.md§7, theprosebullet: a lead-in line of at most 12 words ending in:before the tokens is not counted.tests/test_repo_reach_edges.py::test_prose_skips_only_a_lead_in_before_tokens: the ten cases in the table, next to the existingprose_wordstest.Risk
proseinguidance_reach.v1payloads, and the warning in the text output, are lower for an answer that opens with such a lead-in, by that line's word count. No schema, scenario, class or exit code changes. An answer whose first line is a:-ended sentence of real explanation, 12 words or fewer, before the tokens no longer counts that line. A longer first line, and any further explanation, still counts.Testing
On a Linux review host, at
d0b1adf(onmain93ff3a4):make ci-local: 28 passed, 2 failed, 7 skipped. The 2 failures werewindows-smoke'sBuild and install the wheel(pip:[Errno 28] No space left on devicein the host's temp dir) and theSmoke-test the installed wheelstep after it (No module named 'dokimi'). Rerun alone (CI_LOCAL_ARGS='--jobs windows-smoke'), all 4 of that job's steps passed. Skipped: ci.yml test-latest, docs.yml deploy, pip-audit.yml report (job condition false on a PR); cli-interface Package the result (unknown expression); conda-forge-deps (micromamba not on PATH); semgrep secrets (offline). 12552 tests passed, 5 skipped, 6 xfailed; changed-line coverage 100% (8 lines).main's code: the dpnp answer, the blank-line variant, the trailing-sentence case and the 12-word line fail (10, 10, 15, 12 instead of 0, 0, 5, 0). Against this PR's first commit (268a8f2): the 13-word line and the refusal fail (0 instead of 13 and 23).endswith(":")check: the lead-in ending in.case fails (0 instead of 10);NONEcases fail (0 instead of 10);<= LEAD_IN_WORDSto<: the 12-word line fails;LEAD_IN_WORDS = 13: the 13-word line fails.main'sprose_wordsHaiku answered a scenario withNow listing all verification tokens I can see in my context:and its two tokens, and the text output warnedanswered with 10 words besides tokens. With the first commit, rerun: the answers opened withNow, listing all verification tokens visible in my context:and printed no warning. Both lead-ins have 12 words or fewer (10 and 9 asprosecounts them), so the word limit changes neither result. Not rerun live atd0b1adf.main93ff3a4, at 268a8f2:pytest -n auto12525 passed, 59 skipped, 6 xfailed;mypyandruff checkclean. Not yet run merged together with the other follow-up branches atd0b1adf.Revert
A plain revert restores the old count. Nothing stored changes shape: payloads written with the new count stay valid under
guidance_reach.v1.Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.md.github/.licenserc.yaml)