Repository navigation
fix(reach, trigger-probe): miscopied tokens, OAuth token in the claude-code profile, skills listed by directory name, turn-limit runs - #1563
Conversation
…e-code profile, skills listed by directory name, turn-limit runs - repo reach: a token the model miscopied (a space, dropped or swapped characters) is matched to the one token it fits instead of making the file 'truncated'; records carry misread and scenarios recovered. On Haiku every truncated cell in a seven-repository run was a miscopy. - claude-code profile: pass CLAUDE_CODE_OAUTH_TOKEN, as the claude-cli provider does, so repo reach runs with CLAUDE_CODE_OAUTH_TOKEN set. Execution ids of the profile move with its env. - catalog trigger-probe: a skill listed under its directory's name is listed (warned about, recorded in listed_as_folder), not 'invalid: skill not listed'. - catalog trigger-probe: --max-turns defaults to 8; a run where more than 10% of runs end at the limit with no skill loaded is 'suspect: turn limit'. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
CLI interface change detectedThis PR changes dokimi's user-facing CLI surface (commands and/or options): ~ `dokimi catalog trigger-probe` parameters changed:
~ changed option `--max-turns`: default: 3 -> 8Updated on every push; the |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved classification and aliasing bugs falsely credit unloaded files and unoffered skills, while token recovery mishandles valid edit combinations and produces order-dependent results.
4 open issues
What changed in this PR
5 findings.
This PR improves Dokimi’s reach and skill-trigger measurements by recovering miscopied tokens and reducing false failures.
Changes:
- Adds token recovery and forwards Claude Code OAuth credentials.
- Recognizes skills listed by folder name.
- Raises trigger-probe’s default turn limit and flags potentially incomplete measurements.
| File | Description |
|---|---|
| dokimi/tests/test_trigger_probe.py | Tests folder listings and turn-limit handling. |
| dokimi/tests/test_repo_reach_miscopy.py | Tests token recovery and scoring. |
| dokimi/tests/test_repo_dotdot_link_readers.py | Updates the classification spy signature. |
| dokimi/tests/test_profile_credentials.py | Checks credential forwarding. |
| dokimi/tests/test_batch_ledger_golden.py | Updates profile execution IDs. |
| dokimi/dokimi/repos/reach.py | Integrates recovery into classifications and reports. |
| dokimi/dokimi/repos/reach_tokens.py | Adds token-matching helpers. |
| dokimi/dokimi/repos/profiles/claude-code.yaml | Allows OAuth token forwarding. |
| dokimi/dokimi/commands/catalog_probe.py | Adds folder aliases and turn-limit warnings. |
| dokimi/docs/repo-evaluation-contract.md | Documents miscopy recovery. |
| dokimi/docs/reference/cli-interface.json | Records the new turn-limit default. |
| dokimi/changelog.d/20261202_090100_trigger-probe-folder-name-and-turns.md | Describes trigger-probe changes. |
| dokimi/changelog.d/20261202_090000_reach-miscopy-and-oauth.md | Describes recovery and authentication fixes. |
Review effort: Balanced
| if i > 1 and j > 1 and a[i - 1] == b[j - 2] and a[i - 2] == b[j - 1]: | ||
| rows[i][j] = min(rows[i][j], rows[i - 2][j - 2] + 1) |
There was a problem hiding this comment.
I would not call this must-fix. A swap with an insert between the swapped characters is a rare miscopy, and every widening of the match raises the chance of crediting a made-up token (6.6% of random tokens are already recovered against 300 run tokens, see my comment at line 40). Keeping the restricted distance is fine.
There was a problem hiding this comment.
I've left this as it is. I chose the restricted distance over the full Damerau–Levenshtein one, because a wider match credits more made-up tokens (see the thread at reach_tokens.py:40, where a miscopy is now one edit or a dropped head). RCABC1234 is also not a 6-character token, and a swap with an insert between is not a form seen in the Haiku runs.
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 16 selected item(s). CI at Review details
|
| # A token as a model may miscopy it: a space or dash after RC, characters dropped or swapped. | ||
| # Haiku's lead-in had 10 words; a longer ':' line is an explanation or a refusal, so it counts. | ||
| LEAD_IN_WORDS = 12 | ||
| NEAR_TOKEN_RE = re.compile(r"\bRC[ -]?([0-9A-Fa-f]{3,8})\b") |
There was a problem hiding this comment.
Allow non-hex character substitutions to reach the edit-distance check.
Trigger: classify a file with head RC1B9A00 and tail RCFD1CA3 against the answer RC1B9A0O\nRCFD1CA3, with those two tokens in known.
Evidence: O replacing 0 is one edit, but this regex rejects the entire head candidate (the preceding hex prefix has no word boundary), so answer_tokens misses it and classify returns truncated rather than loaded.
Impact: the documented recovery of unique miscopies within two edits still yields false missing-token measurements for non-hex substitutions.
Workaround: inspect the trace and manually correct the token. Broaden candidate extraction while retaining the unique-match check, and add this regression case.
Should fix: A run shows it; it was not judged to be met in ordinary use.
Shown by running: exit 1 (at the head) · exit 1 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)
python proof_c4.py
What the proof does: Calls answer_tokens with a head token miscopied as RC1B9A0O and asserts the known token RC1B9A00 is recovered.
The problem shows as the output C4 MISSED non-hex miscopy.
dokimi/proof_c4.py
from dokimi.repos.reach_tokens import answer_tokens
got, rec = answer_tokens('RC1B9A0O\nRCFD1CA3', {'RC1B9A00', 'RCFD1CA3'})
assert 'RC1B9A00' in got, 'C4 MISSED non-hex miscopy: %r' % (got,)
print('ok')Traceback (most recent call last):
File "/tmp/tmp.tXKCKskaFO/dokimi/proof_c4.py", line 4, in <module>
assert 'RC1B9A00' in got, 'C4 MISSED non-hex miscopy: %r' % (got,)
^^^^^^^^^^^^^^^^^
AssertionError: C4 MISSED non-hex miscopy: {'RCFD1CA3'}
There was a problem hiding this comment.
The gap is real, but widening the pattern to any letter raises the chance that prose or a made-up token is credited as a load (see my comment at line 40). I would keep hex only, or accept just O for 0 if it shows up in real traces.
There was a problem hiding this comment.
I've left this as it is. I chose hex only over accepting O for 0, because no trace I have shows that substitution and every widening raises the chance of crediting a token the model made up.
Mutation of changed lines✅ Tests catch all 80 breaks tried; 119 more were over the limit At 4f79b32: 80 caught · 0 missed Not checked:
Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary. |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1563 +/- ##
==========================================
- Coverage 96.53% 96.52% -0.02%
==========================================
Files 550 551 +1
Lines 73183 73253 +70
Branches 12623 12637 +14
==========================================
+ Hits 70645 70705 +60
- Misses 1553 1557 +4
- Partials 985 991 +6
🚀 New features to boost your workflow:
|
napetrov
left a comment
There was a problem hiding this comment.
Change class: ARCHITECTURAL (head 6642a5b)
- Contract: changed. cli dokimi/dokimi/commands/catalog_probe.py
- Responsibility: changed. move _prose from dokimi/dokimi/repos/reach.py to dokimi/dokimi/repos/reach_tokens.py; move prose_words from dokimi/dokimi/repos/reach.py to dokimi/dokimi/repos/reach_tokens.py
- Dependency: none
- Review depth: design read: new dependency/responsibility, ask for rationale
- Coverage gaps: none
1 new must-fix finding. The focused reach and trigger-probe tests pass. One token can receive both a recovered and an unknown diagnostic.
| # | Finding | Severity | Provenance | Evidence |
|---|---|---|---|---|
| 1 | A recovered token still triggers an unknown-token warning | must-fix | introduced | Reproduced in an offline probe. |
Checked the diff, input edges, and focused offline Linux tests (head: 203 passed in 21.14s).
- Still open. Ambiguous token recovery depends on answer order. Earlier thread
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
🟡 Changes needed · reviewed 6642a5b
To fix: token recovery can credit a made-up token as a load, and a skill listed under its directory name can score a silent low recall (line comments); the docs and changelog gaps there are small. Also answer the @Copilot and @napetrov threads below.
make ci-local --offline: 34,153 passed, 1 failed (test_cli_fault_contract[eval score ragas], fails on the base too) · ✅ a random 6-hex non-token is recovered in 6.6% of tries against 300 run tokens · ✅ the OAuth token passthrough and the new tests pass
The OAuth fix and the turn-limit warning are right, and most real miscopies are now recovered.
Agreed with @napetrov: a recovered token is still listed as unknown.
Agreed with @Copilot: folder-name collisions, recovery that depends on answer order, the shadow tokens missing from classify; on the full Damerau distance I disagree and replied in its thread.
Disagreed with @exai-bot on non-hex substitutions: replied in its thread.
Fixes review points on the miscopy and directory-name changes: - reach: a miscopy now needs one edit, or the token's last four or more characters, so made-up tokens and prose are no longer credited as loads; an ambiguous miscopy no longer depends on line order. - reach: every file classification knows the scenario's shadow tokens. - reach: a recovered token is not also listed as unknown. - trigger-probe: only a top-level directory not named like another skill is a folder alias; a load under the directory's name is scored as the skill it names. - docs and changelog: the status, alias rules, the miscopy paragraph placement, and the note that earlier runs are not comparable. - tests for each, for the 10% boundary and the edit distance, and for the top-level and directory-name checks of a folder alias. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
…pelling - trigger-probe: the known-positive guard accepts a load under the skill's directory name (Skill(skill) for a skill named io-read), the name Claude Code lists a top-level project skill under, and says "not loaded" for a skill listed under that name. - reach: every spelling the answer gave for one miscopied token is kept out of unknown; recovered still names the first. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
🟢 LGTM · re-checked 4f79b32 · nothing required from @vchamarthi
🔀 Merge: safe now · merges cleanly into current main, 8 commits behind; its tests pass on the merge · after it, #1559 (repos/reach.py, repo-evaluation-contract.md) and #1582 (repos/reach.py) need a rebase
✅ GitHub CI on 4f79b32: 27 jobs pass · ✅ the PR's tests on the merge with main: 193 passed · ✅ a random non-token is recovered in 0.2–0.5% of tries against 300 run tokens (was 6.6%) · ✅ an ambiguous miscopy gives the same result in either line order
The earlier points are fixed; the miscopy match is now strict and a folder-named skill is scored and guarded correctly.


Why
Measured with Dokimi on Claude Code (Haiku and Sonnet) across seven repositories and three skill catalogs:
repo reachasks the agent to repeat tokens planted in each guidance file. Haiku sometimes miscopies one, with a space afterRC, a dropped character or two swapped characters. Everytruncatedcell in a seven-repository run was such a miscopy, not a cut-off file.claude-codeprofile did not passCLAUDE_CODE_OAUTH_TOKENinto the isolated run, although theclaude-cliprovider already did.vllm/skill/SKILL.mdwithname: vllm-xeon-cpuloads, but Claude Code lists it by its folder name (skill), socatalog trigger-probemarked the run invalid.What changes
repo reach: a miscopied token is matched to the one known token it fits: within 1 edit, or being its last 4 or more characters, and only when exactly one token fits. It is recorded undermisread; the summary lists recovered scenarios. Helper module:dokimi/repos/reach_tokens.py.profiles/claude-code.yaml:CLAUDE_CODE_OAUTH_TOKENjoinsenv_allow. Execution ids of the profile move with its env, so the golden ids are updated.catalog trigger-probe: a top-level skill listed under its directory name (not another skill's name) counts as listed, with a warning and alisted_as_folderrecord; a load under that name is scored as the skill.catalog trigger-probe:--max-turnsdefaults to 8. When more than 10% of runs end at the limit with no skill loaded, the status issuspect: turn limit.Evidence
invalid: skill not listedsuspect; default 8 turnsHow to test
Full offline CI on the branch rebased on main: 34,141 passed, 1 failed; the failure (
test_repo_compare_interval::test_the_row_p_places_zero…) fails the same way on unchanged main.Mutation: tests added for the 17 survivors; three were equivalent and the code was simplified instead (the
endswithclause is implied by two edits for six-character tokens,rsplit(":", 1)isrpartition, andlisted andrepeated theif listed). Local run before the last two tests: 78 of 80 caught; both remaining survivors now have tests.Try it on a repository:
References
docs/repo-evaluation-contract.md(miscopy matching is documented there in this PR)claude setup-token)