Files
hermes-agent/contributors/emails/officialasishkumar@gmail.com
teknium1 787b261ff8 fix(agent): trim the PermissionError guard salvage to two live tests
Follow-up to the cherry-picked #112432 (@lorencato23):

- Drop the try/except around ``cursor_rules_dir.glob("*.mdc")``: ``Path.glob``
  already swallows PermissionError on an unreadable directory (verified live on
  a 000-mode ``.cursor/rules`` -> ``[]``), so the wrapper guarded code that
  cannot raise.
- Replace the four monkeypatch-based tests with two real-filesystem tests
  (chmod 0, skipped as root): ``_find_hermes_md`` on an unreadable cwd returns
  None and ``build_context_files_prompt(cwd=<unreadable>)`` still returns a
  string; ``_cursorrules_candidates`` on an unreadable cwd returns [] while a
  readable sibling project still yields its ``.cursor/rules/*.mdc``.

Dropped: TestFindHermesMd::test_unreadable_candidate_is_treated_as_not_found,
TestFindHermesMd::test_walk_continues_past_unreadable_directory,
TestCursorrulesCandidates::test_finds_cursorrules_file,
TestCursorrulesCandidates::test_unreadable_rules_dir_is_treated_as_absent.

#8767 (@officialasishkumar) was the earliest PR to guard ``_find_hermes_md``
against PermissionError; its ``_find_git_root`` half landed via #8751
(337113c1b8) and its ``_find_hermes_md`` half is superseded by this branch.

Part of #112430.

Co-authored-by: Asish Kumar <officialasishkumar@gmail.com>
2026-09-16 17:08:45 -07:00

2 lines
19 B
Plaintext