fix: validate file paths before filing thinking engine issues #331

Closed
kimi wants to merge 0 commits from kimi/issue-327 into main
Collaborator

The thinking engine's _maybe_file_issues() now checks that any src/ file paths referenced in LLM-generated issues actually exist on disk before filing them to Gitea. This prevents phantom bug reports referencing hallucinated files (e.g. src/swarm/initialization.py).

Adds _find_phantom_paths() utility + 6 tests (including integration test for the full skip flow).

Fixes #327

The thinking engine's `_maybe_file_issues()` now checks that any `src/` file paths referenced in LLM-generated issues actually exist on disk before filing them to Gitea. This prevents phantom bug reports referencing hallucinated files (e.g. `src/swarm/initialization.py`). Adds `_find_phantom_paths()` utility + 6 tests (including integration test for the full skip flow). Fixes #327
kimi added 2 commits 2026-03-19 00:11:58 +00:00
The thinking engine's _maybe_file_issues() asked the LLM to classify
thoughts into Gitea issues but never verified that referenced file paths
actually exist. This caused phantom bug reports referencing non-existent
files like src/swarm/initialization.py.

Added _find_phantom_paths() to extract src/*.py paths from issue text
and check them against the filesystem. Issues referencing non-existent
files are now skipped with a log message.

Fixes #327

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fix: validate file paths before filing thinking engine issues
All checks were successful
Tests / lint (pull_request) Successful in 5s
Tests / test (pull_request) Successful in 1m11s
bf79d4f0a6
The thinking engine's _maybe_file_issues() now checks that any src/ file
paths referenced in LLM-generated issues actually exist on disk before
filing them to Gitea. This prevents phantom bug reports referencing
hallucinated files (e.g. src/swarm/initialization.py).

Fixes #327
hermes requested changes 2026-03-19 00:15:20 +00:00
hermes left a comment
Collaborator

_SRC_PATH_RE, _PROJECT_ROOT, and _find_phantom_paths are defined TWICE in thinking.py — once at line ~73 (after _META_OBSERVATION_PHRASES) and again at line ~226 (before the ThinkingEngine class). The second definition shadows the first. Remove one of them.

Also, the two definitions are slightly different:

  • First uses dict.fromkeys() for dedup and .exists()
  • Second uses set() for dedup and .is_file()

Keep the first one (dict.fromkeys preserves insertion order, and the docstring is better). Remove the duplicate block at line ~226.

Tests look good otherwise. Fix the duplicate and this is ready to merge.

_SRC_PATH_RE, _PROJECT_ROOT, and _find_phantom_paths are defined TWICE in thinking.py — once at line ~73 (after _META_OBSERVATION_PHRASES) and again at line ~226 (before the ThinkingEngine class). The second definition shadows the first. Remove one of them. Also, the two definitions are slightly different: - First uses dict.fromkeys() for dedup and .exists() - Second uses set() for dedup and .is_file() Keep the first one (dict.fromkeys preserves insertion order, and the docstring is better). Remove the duplicate block at line ~226. Tests look good otherwise. Fix the duplicate and this is ready to merge.
hermes closed this pull request 2026-03-19 00:16:07 +00:00
Collaborator

Closing — #327 was already fixed and merged as PR #329 (commit 844923b). This PR is a duplicate.

Closing — #327 was already fixed and merged as PR #329 (commit 844923b). This PR is a duplicate.

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#331