Repository navigation
fix(readers): a directory that cannot be listed is an error, not an empty result, in the skills globs of a repo config and six root globs - #1510
Conversation
…t list (intel#1387) RepoConfig._skill_dirs expanded the config's defaults.skills globs without strict=True, so a directory it could not list (mode 0o111) matched nothing and its skills were missing from subjects(), with hashes=False and hashes=True alike. The globs are now expanded strictly: the OSError reaches the existing handler in RepoConfig.subjects, which raises ConfigError naming the directory and the reason. A literal segment such as packs/a is matched against the listing of packs, so it is refused too. Test-narrowed: test_an_unreadable_directory_under_a_skills_glob_matches_nothing pinned the result this issue reports (the skills under an unreadable directory left out); it is renamed test_an_unreadable_directory_under_a_skills_glob_is_a_config_error_naming_it and now pins the ConfigError. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
… empty, in six globs (intel#1389) benchflow's pack check and treatment_names, a plugin manifest's skill count and declared skills paths, report summary's input expansion, discover_agent_profiles and catalog list --kind subject expanded a * pattern directly under a directory with Path.glob, which gives nothing for a directory it cannot list (mode 0o111). The directory read as empty: the pack check blamed a missing pack, a manifest counted 0 skills, report summary kept the directory as one input, and the subject list printed nothing. digest_entries.children_matching and pack_files now list the one directory with os.scandir and filter by name: the same sorted names for a listable directory, no entries for a missing one, the OSError for one that cannot be listed. A pack file is only stat-ed in each child, so a child of mode 0o111 still has its SKILL.md found. report summary and catalog list --kind subject turn the OSError into an input error (exit 2) naming the directory and the reason, the benchflow pack check says it cannot list the directory instead of holding no pack, catalog formats keeps its existing exit 2, and discover_agent_profiles and treatment_names raise the OSError. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 14 selected item(s). CI at `34aead4`: 1 failing, 25 passing, 4 skippedNot fully read: job Tests (py3.14): HTTP 404: The specified blob does not exist.
Test notes (1)
Review details
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1510 +/- ##
========================================
Coverage 96.31% 96.32%
========================================
Files 515 515
Lines 68928 69033 +105
Branches 11933 11949 +16
========================================
+ Hits 66389 66493 +104
+ Misses 1563 1562 -1
- Partials 976 978 +2
🚀 New features to boost your workflow:
|
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head f8b3241)
- Contract: changed. errors dokimi/dokimi/commands/report.py:192; errors dokimi/dokimi/commands/subjects.py:51
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
I checked the six root glob callers, strict skill selection and missing roots. All 14 focused tests passed. The stated guarantee for a child without search permission fails on Python 3.14.
There was a problem hiding this comment.
🟡 Changes recommended
On Python 3.14, Path.is_file() suppresses permission errors for inaccessible child directories, silently omitting packs and producing incomplete manifests and misleading benchflow diagnostics.
1 open issue
What changed in this PR
1 new finding.
This PR addresses #1387 and #1389 by making dokimi’s readers report directories they cannot list instead of silently treating them as empty.
Changes:
- Enables strict expansion of repository-config skill globs.
- Adds shared single-directory listing helpers and updates readers and command error handling.
- Adds permission-error regression tests, changelog entries, and a growth-baseline adjustment.
| File | Description |
|---|---|
dokimi/tests/test_unlistable_root_globs.py |
Tests unreadable roots and searchable child directories. |
dokimi/tests/test_repo_config.py |
Expects a configuration error for unreadable skill paths. |
dokimi/tests/test_repo_config_skills_unlistable.py |
Tests strict skill expansion with and without hashes. |
dokimi/scripts/growth_baseline.json |
Records benchflow’s size increase and rationale. |
dokimi/dokimi/skills/formats.py |
Uses strict directory listings for manifest skill counts. |
dokimi/dokimi/report/summary.py |
Propagates directory-listing errors during input expansion. |
dokimi/dokimi/repo_config.py |
Enables strict skill-glob expansion. |
dokimi/dokimi/harnesses/benchflow.py |
Updates pack validation and treatment-name discovery. |
dokimi/dokimi/digest_entries.py |
Adds shared child-listing and pack-file helpers. |
dokimi/dokimi/commands/subjects.py |
Converts listing failures into input errors. |
dokimi/dokimi/commands/report.py |
Reports input-directory listing failures. |
dokimi/dokimi/agent_profiles/loader.py |
Uses strict listing for profile discovery. |
dokimi/changelog.d/20261201_140100_root-globs-unlistable.md |
Documents root-listing fixes and error behavior. |
dokimi/changelog.d/20261201_140000_repo-config-skills-unlistable.md |
Documents strict repository skill-glob behavior. |
Review effort: Balanced
….14 too Review of intel#1510: `pack_files` tested each `child/SKILL.md` with `Path.is_file`, which returns False for any OSError on Python 3.14, so a child of mode 0 dropped its pack silently where 3.12 and 3.13 raise PermissionError. `pack_files` now stats the file and raises every OSError except a missing path, a parent that is no directory and a link loop. `_skill_dirs` loses the `resolve` try block that no input reaches, since a found pack always stats. A test emulates the 3.14 `is_file` and checks a mode 0 child, and another covers the `report summary` refusal of directories with no JSON file. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Mutation of changed linesAt 34aead4: 39 caught · 7 missed Each row is a small deliberate break (a mutant) of a line this PR changes that every test reaching that line still passes. Add a test that fails on it or, if it cannot change behaviour, put
Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary. |
@napetrov (#1510 (review)): The review body's one finding is the 3.14 child-without-search-permission case, answered in the two threads above (34aead4). The six callers, strict selection and missing roots are unchanged. |
|
Ready for another look at codecov has not reported on this head yet. |
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 34aead4)
- Contract: changed. errors dokimi/dokimi/commands/report.py:192; errors dokimi/dokimi/commands/subjects.py:51
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
Verified the explicit marker stat propagates permission errors and handles missing paths and link loops. Reviewed the root glob callers and both report-summary input cases. All 16 focused tests passed locally.

Summary
Two open issues with one cause: a glob expands a
*pattern under a directory that cannot be listed (mode0o111), and the directory reads as empty.chmod 111)maintodaydefaults.skills: ['skills/*', 'packs/*'],skills/b/SKILL.md,packs/a/SKILL.md,packslocked:load_repo_config(root).subjects(hashes=False)andhashes=True['skills/b']both times;packs/ais dropped with no errortreatment_names(root)withroot/a/SKILL.md,root/b/SKILL.mdNone(no treatment names)_require_packs(root)of the benchflow arm (the same root)ValueError: ... holds no <name>/SKILL.md pack, which blames a missing packgemini-extension.jsonbundle whoseskills/is locked (classify)details['skills'] == 0, no problem recordedreport summary dirwithdir/a.jsonexpand_inputskeepsdiras given, and the command exits 2 withno *.json file to summarize in dirdiscover_agent_profiles(dir)withdir/a.md[]catalog list --kind subject --subjects-root dirwithdir/a.toml#1387 fix option taken: pass
strict=Trueto the skills glob, as the suite glob already does, so the error reaches the existingConfigErrorconversion inRepoConfig.subjects. #1389 fix option taken: list the one directory withos.scandirand filter by name (a shared helper, since seven sites repeat it), notdigest_entries.listed_entries, which walks a whole tree; a child directory is never listed, only stat-ed forSKILL.md, so a pack in a child of mode0o111is still found. The issue'ssubjects listiscatalog list --kind subjectat this head.catalog formatsalready exits 2 for a bundleskills/directory under the scanned root (the tree walk ofdetect_skill_packagesraises first, #1211); this PR does not redo that. What it adds there is the manifest's own skill listing, which also reads declaredskillspaths outside the scanned root.The
jobs_dir.globlines of benchflow (rollout_dirs,rollout_results) have the same bug; they are not changed here and are tracked in #1509. The same cause inmemory/store.py, in the repository-evaluation readers and incontext/session_log.pyis tracked in #1506, #1507 and #1508.Closes #1387
Closes #1389
Changes
repo_config._skill_dirs(repo_config skill globs drop a directory they cannot list: _skill_dirs lists with a non-strict _listing #1387) expandsdefaults.skillswithstrict=True.RepoConfig.subjectsalready turns theOSErrorintoConfigError: cannot read <dir>: Permission denied, withhashes=Falseandhashes=True. A literal segment such aspacks/ais matched against the listing ofpacks, so it is refused too (it was silently dropped before).digest_entries.children_matching(directory, pattern)andpack_files(directory, filename)(a root directory that cannot be listed reads as empty in five globs: benchflow treatment names and pack check, plugin skill count, report inputs, agent profiles, subjects list #1389) list one directory withos.scandir: the same sorted names asPath.glob, no entries for a missing directory or a file, theOSErrorfor a directory that cannot be listed.BenchflowHarness._require_packssayscannot list <root>: Permission deniedinstead ofholds no <name>/SKILL.md pack;treatment_namesraises theOSError. The pack check runs before every run of a skills arm, sotreatment_namesis only reached with a root it has already listed.pack_filesstats eachchild/SKILL.mdand raises everyOSErrorexcept a missing path, a parent that is no directory and a link loop.Path.is_filereturns False for anyOSErroron Python 3.14, which dropped a mode0child's pack silently.formats._manifestandformats._skill_dirscount the skills of a plugin or extension manifest withpack_files; a declared skills directory that cannot be listed raises instead of being recorded ascannot be resolved.catalog formatsalready turns anOSErrorofdetect_skill_packagesinto exit 2.report.summary.expand_inputsraises;report summaryexits 2 withcannot list <dir>: Permission denied.discover_agent_profilesraises itsOSError(no caller in the package).catalog list --kind subjectexits 2 with--subjects-root cannot be listed: <dir>: Permission denied.tests/test_repo_config.py:test_an_unreadable_directory_under_a_skills_glob_matches_nothingpinned the result repo_config skill globs drop a directory they cannot list: _skill_dirs lists with a non-strict _listing #1387 reports (the skills left out); it is now..._is_a_config_error_naming_itand pins theConfigError.scripts/growth_baseline.json:harnesses/benchflow.py866 to 873 lines, with the rationale the ratchet asks for.Risk
ConfigErrorwhere it silently listed fewer subjects. A config that lists fine gives the same subjects.0(not even searchable) under a skills root, a pluginskills/directory or a benchflow pack root now raises on every Python version, 3.14 included, wherePath.globskipped it: itsSKILL.mdcannot be stat-ed, so the pack is not known to be absent. A child of mode0o111is unchanged.report summaryandcatalog list --kind subjectexit 2 for an unlistable directory, the code they already use for an input they cannot read (an absent path, a directory with no*.json);catalog formatskeeps its exit 2.reportdirectory with no*.json(kept as given) and a*.jsonfile given directly are unchanged.defaults.skills: ['packs/a']withpacksat mode0o111also raisesConfigErrornow (strict listing lists the directory of a literal segment too), where it was dropped.test_an_unreadable_directory_under_a_skills_glob_matches_nothingpinned the old result; it is renamed and pins theConfigError, with aTest-narrowedline in the commit.agent_profiles/loader.pyandharnesses/benchflow.pyand conflict with this branch inbenchflow.py; Part of #94 (F1b, model + judge) #1197 conflicts ingrowth_baseline.json. Each is a small rebase for whichever merges second.treatment_namescount a directory namedSKILL.mdas no pack (is_file), whereglobmatched any entry of that name.Testing
On a Linux review host, at
34aead45304d6e0822e4155398e52beb886a9076(onmain9e41f5e):make ci-local: 38 passed, 0 failed, 16 skipped (docker external-catalog smoke, the PR-comment packaging steps,test-latestandtest-seeds, the Claude Code install, conda-forge, atheris fuzz, the intel-ci matrix jobs, semgrep). 32106 tests passed, 27 skipped. A first run had one timeout intests/test_unclosed_openers.py(a test this PR does not touch, under host load); that file alone gave 346 passed, and the second full run was green.0child under a pack root: withPath.is_fileemulating Python 3.14 (False for anyOSError),pack_filesandtreatment_namesraisePermissionError; withpack_filesback onis_file,tests/test_unlistable_root_globs.py::test_a_pack_in_a_child_that_cannot_be_searched_is_refused_not_droppedfails (DID NOT RAISE PermissionError).main's code the new tests fail:tests/test_unlistable_root_globs.py8 failed, 2 passed (the 2 are the child-directory0o111cases, which pin what must not change);tests/test_repo_config_skills_unlistable.py4 failed (DID NOT RAISE ConfigError);tests/test_repo_config.py1 failed, 131 passed.OSErrorconversion removed, the manifest back onglob, a single-skill declared path ignored, the empty-directory fallback removed), each fail a new test.ci-local: 38 mutants, 33 killed, 5 survived: three areexc.strerror or excfallbacks of the messages, two are guards (p.is_dir()beforechildren_matching,listedbeforepack_files) that a missing directory or a file makes redundant.Path.is_fileis emulated in the test), the Windows legs, and the tests as root (they skip: root lists a mode0o111directory).Open questions
None.
Revert
A plain revert restores the old results: an unlistable root reads as empty in those sites, and
defaults.skillsdrops the skills behind it. Nothing is stored.Checklist
Tests added/updated and
pytestpassesruff,mypy, and schema checks passDocs updated (or N/A) — see the docs-drift checklist in CONTRIBUTING.md
Self-reviewed per "Before opening a PR" in
AGENTS.mdEach new
raise/exit and test names the doc, contract or issue it traces to (the new tests and fragments name repo_config skill globs drop a directory they cannot list: _skill_dirs lists with a non-strict _listing #1387 and a root directory that cannot be listed reads as empty in five globs: benchflow treatment names and pack check, plugin skill count, report inputs, agent profiles, subjects list #1389; the messages name the directory and the OS reason, not an issue)No ad-hoc run artifacts committed
New files carry the SPDX license header (or are exempt in
.github/.licenserc.yaml)Merged together with
fix/unlistable-pattern-globs,fix/sandbox-cleanup-unlistable,fix/novelty-out-dir-unlistableonmainbcb1f9f:pytest -n auto32223 passed, 27 skipped,mypyclean,ruff checkclean.