Skip to content

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

Merged
antonwolfy merged 3 commits into
intel:mainfrom
antonwolfy:fix/unlistable-root-globs
Dec 1, 2026

Conversation

@antonwolfy

@antonwolfy antonwolfy commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two open issues with one cause: a glob expands a * pattern under a directory that cannot be listed (mode 0o111), and the directory reads as empty.

Issue Input (non-root user, directory at chmod 111) On main today
#1387 a git repo with defaults.skills: ['skills/*', 'packs/*'], skills/b/SKILL.md, packs/a/SKILL.md, packs locked: load_repo_config(root).subjects(hashes=False) and hashes=True ['skills/b'] both times; packs/a is dropped with no error
#1389 treatment_names(root) with root/a/SKILL.md, root/b/SKILL.md None (no treatment names)
#1389 _require_packs(root) of the benchflow arm (the same root) ValueError: ... holds no <name>/SKILL.md pack, which blames a missing pack
#1389 the skill count of a gemini-extension.json bundle whose skills/ is locked (classify) details['skills'] == 0, no problem recorded
#1389 report summary dir with dir/a.json expand_inputs keeps dir as given, and the command exits 2 with no *.json file to summarize in dir
#1389 discover_agent_profiles(dir) with dir/a.md []
#1389 catalog list --kind subject --subjects-root dir with dir/a.toml prints nothing, exit 0

#1387 fix option taken: pass strict=True to the skills glob, as the suite glob already does, so the error reaches the existing ConfigError conversion in RepoConfig.subjects. #1389 fix option taken: list the one directory with os.scandir and filter by name (a shared helper, since seven sites repeat it), not digest_entries.listed_entries, which walks a whole tree; a child directory is never listed, only stat-ed for SKILL.md, so a pack in a child of mode 0o111 is still found. The issue's subjects list is catalog list --kind subject at this head.

catalog formats already exits 2 for a bundle skills/ directory under the scanned root (the tree walk of detect_skill_packages raises first, #1211); this PR does not redo that. What it adds there is the manifest's own skill listing, which also reads declared skills paths outside the scanned root.

The jobs_dir.glob lines of benchflow (rollout_dirs, rollout_results) have the same bug; they are not changed here and are tracked in #1509. The same cause in memory/store.py, in the repository-evaluation readers and in context/session_log.py is 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) expands defaults.skills with strict=True. RepoConfig.subjects already turns the OSError into ConfigError: cannot read <dir>: Permission denied, with hashes=False and hashes=True. A literal segment such as packs/a is matched against the listing of packs, so it is refused too (it was silently dropped before).
  • digest_entries.children_matching(directory, pattern) and pack_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 with os.scandir: the same sorted names as Path.glob, no entries for a missing directory or a file, the OSError for a directory that cannot be listed.
  • BenchflowHarness._require_packs says cannot list <root>: Permission denied instead of holds no <name>/SKILL.md pack; treatment_names raises the OSError. The pack check runs before every run of a skills arm, so treatment_names is only reached with a root it has already listed.
  • pack_files stats each child/SKILL.md and raises every OSError except a missing path, a parent that is no directory and a link loop. Path.is_file returns False for any OSError on Python 3.14, which dropped a mode 0 child's pack silently.
  • formats._manifest and formats._skill_dirs count the skills of a plugin or extension manifest with pack_files; a declared skills directory that cannot be listed raises instead of being recorded as cannot be resolved. catalog formats already turns an OSError of detect_skill_packages into exit 2.
  • report.summary.expand_inputs raises; report summary exits 2 with cannot list <dir>: Permission denied.
  • discover_agent_profiles raises its OSError (no caller in the package).
  • catalog list --kind subject exits 2 with --subjects-root cannot be listed: <dir>: Permission denied.
  • tests/test_repo_config.py: test_an_unreadable_directory_under_a_skills_glob_matches_nothing pinned 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_it and pins the ConfigError.
  • scripts/growth_baseline.json: harnesses/benchflow.py 866 to 873 lines, with the rationale the ratchet asks for.
  • Changelog fragments (Fixed), one per issue.

Risk

  • A skills glob of a repo config that matches through a directory it cannot list now raises ConfigError where it silently listed fewer subjects. A config that lists fine gives the same subjects.
  • A child directory of mode 0 (not even searchable) under a skills root, a plugin skills/ directory or a benchflow pack root now raises on every Python version, 3.14 included, where Path.glob skipped it: its SKILL.md cannot be stat-ed, so the pack is not known to be absent. A child of mode 0o111 is unchanged.
  • report summary and catalog list --kind subject exit 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 formats keeps its exit 2.
  • A listable directory gives the same names in the same sorted order; a missing directory, a report directory with no *.json (kept as given) and a *.json file given directly are unchanged.
  • A literal skills entry such as defaults.skills: ['packs/a'] with packs at mode 0o111 also raises ConfigError now (strict listing lists the directory of a literal segment too), where it was dropped. test_an_unreadable_directory_under_a_skills_glob_matches_nothing pinned the old result; it is renamed and pins the ConfigError, with a Test-narrowed line in the commit.
  • Open PRs refactor(utils): split dokimi/utils.py into frontmatter, files, digest, model_names #1190 and refactor(judge): split eval judge agreement into helpers; public build_validity_pairs #1416 change import lines of agent_profiles/loader.py and harnesses/benchflow.py and conflict with this branch in benchflow.py; Part of #94 (F1b, model + judge) #1197 conflicts in growth_baseline.json. Each is a small rebase for whichever merges second.
  • The benchflow pack check and treatment_names count a directory named SKILL.md as no pack (is_file), where glob matched any entry of that name.

Testing

On a Linux review host, at 34aead45304d6e0822e4155398e52beb886a9076 (on main 9e41f5e):

  • make ci-local: 38 passed, 0 failed, 16 skipped (docker external-catalog smoke, the PR-comment packaging steps, test-latest and test-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 in tests/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.
  • A mode 0 child under a pack root: with Path.is_file emulating Python 3.14 (False for any OSError), pack_files and treatment_names raise PermissionError; with pack_files back on is_file, tests/test_unlistable_root_globs.py::test_a_pack_in_a_child_that_cannot_be_searched_is_refused_not_dropped fails (DID NOT RAISE PermissionError).
  • On main's code the new tests fail: tests/test_unlistable_root_globs.py 8 failed, 2 passed (the 2 are the child-directory 0o111 cases, which pin what must not change); tests/test_repo_config_skills_unlistable.py 4 failed (DID NOT RAISE ConfigError); tests/test_repo_config.py 1 failed, 131 passed.
  • 17 mutants, one break each (strict dropped, errors swallowed, a missing directory raising, the pack file read through a child listing, order reversed, pattern ignored, each OSError conversion removed, the manifest back on glob, a single-skill declared path ignored, the empty-directory fallback removed), each fail a new test.
  • Mutation of changed lines in ci-local: 38 mutants, 33 killed, 5 survived: three are exc.strerror or exc fallbacks of the messages, two are guards (p.is_dir() before children_matching, listed before pack_files) that a missing directory or a file makes redundant.
  • Not run: Python 3.11, 3.12 and 3.14 as interpreters (the test venv is 3.13; the 3.14 Path.is_file is emulated in the test), the Windows legs, and the tests as root (they skip: root lists a mode 0o111 directory).

Open questions

None.

Revert

A plain revert restores the old results: an unlistable root reads as empty in those sites, and defaults.skills drops the skills behind it. Nothing is stored.

Checklist

…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>
@exai-bot

exai-bot commented Dec 1, 2026 •

Copy link
Copy Markdown

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

CI at `34aead4`: 1 failing, 25 passing, 4 skipped

Not fully read: job Tests (py3.14): HTTP 404: The specified blob does not exist.

Check Status
Tests (py3.14) failing
Test notes (1)
  • dokimi/tests/test_repo_config_skills_unlistable.py: dokimi/tests/test_repo_config_skills_unlistable.py passes at the head and also at the merge base, where the code this pull request changes is still as it was. No test in it fails without the change, so none of them would notice if the change were undone.
Review details
  • Commit reviewed: 34aead4 against merge base 9e41f5e
  • Coverage: 14 files in 2 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 482k tokens (357k from cache), 1m4s
  • Tool calls: 48 (30 file_read, 11 code_search, 2 ci_status, 2 file_read_diff, 2 local_check_results, 1 file_find)
  • Handle unlistable repository skill directories: 5 files
  • Handle unlistable root globs across discovery and reporting: 9 files

Comment thread dokimi/dokimi/digest_entries.py Resolved
@codecov-commenter

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 93.02326% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.32%. Comparing base (9e41f5e) to head (f8b3241).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
dokimi/dokimi/skills/formats.py 80.00% 2 Missing ⚠️
dokimi/dokimi/commands/report.py 80.00% 0 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    #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     
Files with missing lines Coverage Δ
dokimi/dokimi/agent_profiles/loader.py 92.30% <100.00%> (+7.69%) ⬆️
dokimi/dokimi/commands/subjects.py 95.53% <100.00%> (+0.82%) ⬆️
dokimi/dokimi/digest_entries.py 79.16% <100.00%> (+5.48%) ⬆️
dokimi/dokimi/harnesses/benchflow.py 95.49% <100.00%> (+0.06%) ⬆️
dokimi/dokimi/repo_config.py 94.28% <100.00%> (ø)
dokimi/dokimi/report/summary.py 95.00% <100.00%> (+0.02%) ⬆️
dokimi/dokimi/commands/report.py 82.38% <80.00%> (+0.45%) ⬆️
dokimi/dokimi/skills/formats.py 93.68% <80.00%> (-0.92%) ⬇️

... and 8 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: 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.

Comment thread dokimi/dokimi/digest_entries.py Resolved

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

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

Comment thread dokimi/dokimi/digest_entries.py Resolved
….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>
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Mutation of changed lines

⚠️ Tests miss 7 of 46 small breaks of the lines this PR changes

At 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 # mutation-ok[<operator>]: <reason> at the end of the line or alone on the line above.

Where Operator Change no test notices Tests reaching the line
dokimi/dokimi/digest_entries.py:52 return-none False → None 4
dokimi/dokimi/digest_entries.py:55 return-none False → None 1
dokimi/dokimi/commands/report.py:192 drop-clause exc.strerror or exc → (exc.strerror) 1
dokimi/dokimi/commands/subjects.py:51 drop-clause exc.strerror or exc → (exc.strerror) 1
dokimi/dokimi/harnesses/benchflow.py:349 drop-clause exc.strerror or exc → (exc.strerror) 1
dokimi/dokimi/report/summary.py:51 take-branch (children_matching(p, "*.json") or [p]) if p.is_dir() else [p] → (children_matching(p, "*.json") or [p]) 35
dokimi/dokimi/skills/formats.py:214 take-branch [p.parent.resolve() for p in pack_files(d, "SKILL.md")] if listed else [] → ([p.parent.resolve() for p in pack_files(d, "SKILL.md")]) 15

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

@antonwolfy

Copy link
Copy Markdown
Contributor Author

(commented) ### Change class: CONTRACT (head f8b3241)

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

@antonwolfy

Copy link
Copy Markdown
Contributor Author

Ready for another look at 34aead4; 2 checks still pending (Tests (py3.14), Windows smoke test (py3.13)); every other check passed.

codecov has not reported on this head yet.

@antonwolfy
antonwolfy requested a review from napetrov December 1, 2026 17:51

@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: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants