Skip to content

fix(reach, trigger-probe): miscopied tokens, OAuth token in the claude-code profile, skills listed by directory name, turn-limit runs - #1563

Merged
vchamarthi merged 5 commits into
intel:mainfrom
vchamarthi:lab-fixes-1202
Dec 4, 2026

Conversation

@vchamarthi

@vchamarthi vchamarthi commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Dokimi's results about which instructions and skills an AI agent actually uses become trustworthy. Four bugs made it report failures that weren't real, or miss successes.

Why

Measured with Dokimi on Claude Code (Haiku and Sonnet) across seven repositories and three skill catalogs:

  • False "truncated" files. repo reach asks the agent to repeat tokens planted in each guidance file. Haiku sometimes miscopies one, with a space after RC, a dropped character or two swapped characters. Every truncated cell in a seven-repository run was such a miscopy, not a cut-off file.
  • Every cell failed "Not logged in". The claude-code profile did not pass CLAUDE_CODE_OAUTH_TOKEN into the isolated run, although the claude-cli provider already did.
  • A working skill was called "not listed". A skill in vllm/skill/SKILL.md with name: vllm-xeon-cpu loads, but Claude Code lists it by its folder name (skill), so catalog trigger-probe marked the run invalid.
  • Recall cut short. At the default 3 turns, 16 of 33 Haiku runs ended before loading any skill and counted as misses.

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 under misread; the summary lists recovered scenarios. Helper module: dokimi/repos/reach_tokens.py.
  • profiles/claude-code.yaml: CLAUDE_CODE_OAUTH_TOKEN joins env_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 a listed_as_folder record; a load under that name is scored as the skill.
  • catalog trigger-probe: --max-turns defaults to 8. When more than 10% of runs end at the limit with no skill loaded, the status is suspect: turn limit.

Evidence

Problem Before After
Truncated cells in a 7-repository reach run (Haiku) 21 2 left (19 recovered as miscopies; the 2 are too scrambled to match)
Reach with an OAuth token login every cell "Not logged in" runs
Skill in a folder not named after it invalid: skill not listed counted, with a warning
Haiku trigger-probe runs ending before any skill load (33 runs) 16 at 3 turns flagged suspect; default 8 turns

How to test

cd dokimi
python -m pytest -q tests/test_repo_reach_miscopy.py tests/test_profile_credentials.py tests/test_trigger_probe.py tests/test_batch_ledger_golden.py
make ci-local CI_LOCAL_ARGS='--offline'

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 endswith clause is implied by two edits for six-character tokens, rsplit(":", 1) is rpartition, and listed and repeated the if listed). Local run before the last two tests: 78 of 80 caught; both remaining survivors now have tests.

Try it on a repository:

dokimi repo reach <repo> --harness claude-code --model haiku
dokimi catalog trigger-probe --catalog <skills-dir> --trigger-set <trigger-set.json> --model haiku

References

…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>
@vchamarthi
vchamarthi requested a review from a team as a code owner December 3, 2026 04:33
Copilot AI balanced review requested due to automatic review settings December 3, 2026 04:33
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

CLI interface change detected

This PR changes dokimi's user-facing CLI surface (commands and/or options):

~ `dokimi catalog trigger-probe` parameters changed:
    ~ changed option `--max-turns`: default: 3 -> 8

Updated on every push; the cli-interface-change label is on while the diff is non-empty.

@github-actions github-actions Bot added the cli-interface-change Changes dokimi's user-facing CLI surface label Dec 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread dokimi/dokimi/commands/catalog_probe.py Resolved
Comment thread dokimi/dokimi/repos/reach.py Resolved
Comment on lines +21 to +22
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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread dokimi/dokimi/repos/reach_tokens.py Resolved
@exai-bot

exai-bot commented Dec 3, 2026 •

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 0 finding(s) across 16 selected item(s).

CI at 4f79b32: 26 passing, 4 skipped.

Review details
  • Commit reviewed: 4f79b32 against merge base 0db63b5
  • Coverage: 16 files in 2 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 548k tokens (379k from cache), 1m6s
  • Tool calls: 41 (20 file_read, 7 code_search, 7 pr_threads, 2 ci_status, 2 file_read_diff, 2 local_check_results, 1 file_find)
  • Repository reach miscopy handling and OAuth credentials: 9 files
  • Trigger probe folder naming and turn handling: 7 files

# 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")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · should fix
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'}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Mutation of changed lines

✅ Tests catch all 80 breaks tried; 119 more were over the limit

At 4f79b32: 80 caught · 0 missed

Not checked:

  • 119 more breaks of covered changed lines were over the limit and not tried
  • 15 changed lines were not mutated

Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary.

@codecov-commenter

codecov-commenter commented Dec 3, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 97.91667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.52%. Comparing base (49981f9) to head (4f79b32).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dokimi/dokimi/repos/reach.py 88.23% 1 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
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     
Files with missing lines Coverage Δ
dokimi/dokimi/commands/catalog_probe.py 97.20% <100.00%> (+0.53%) ⬆️
dokimi/dokimi/harnesses/trigger_probe.py 92.07% <100.00%> (ø)
dokimi/dokimi/repos/reach_tokens.py 100.00% <100.00%> (ø)
dokimi/dokimi/repos/reach.py 98.31% <88.23%> (-0.42%) ⬇️

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread dokimi/dokimi/repos/reach.py Resolved

@vlad-perevezentsev vlad-perevezentsev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread dokimi/dokimi/repos/reach_tokens.py Resolved
Comment thread dokimi/dokimi/commands/catalog_probe.py Resolved
Comment thread dokimi/dokimi/commands/catalog_probe.py Resolved
Comment thread dokimi/docs/repo-evaluation-contract.md Resolved
Comment thread dokimi/dokimi/repos/reach_tokens.py Resolved
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>
Comment thread dokimi/dokimi/commands/catalog_probe.py Resolved
Comment thread dokimi/dokimi/repos/reach.py Resolved
…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 vlad-perevezentsev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.

@vchamarthi
vchamarthi merged commit ac3f374 into intel:main Dec 4, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli-interface-change Changes dokimi's user-facing CLI surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants