Skip to content

fix(sessions): keep a matched rg path even at the repo root - #2639

Merged
RaghavChamadiya merged 1 commit into
repowise-dev:mainfrom
drakeo338:claude/2623-fix
Oct 1, 2026
Merged

RaghavChamadiya merged 1 commit into
repowise-dev:mainfrom
drakeo338:claude/2623-fix

Conversation

@drakeo338

Copy link
Copy Markdown

Summary

The Codex adapter's _rewrite_search_output dropped every root-level file (app.py, setup.py) from rg search results, because it kept a candidate only when it contained a path separator, even for lines _RG_MATCH_RE had already matched as path:line: content. That left search_codebase results empty for root-level matches, so _bind_first_file had nothing to bind the search call's path to. The fix keeps a regex-matched path unconditionally and loosens the bare-line fallback to admit a root-level filename (no separator but a "." after the first character) while still dropping stray prose lines.

Related Issues

Fixes #2623.

Test Plan

  • Tests pass (pytest) — ran uv run pytest tests/unit/sessions/test_codex_adapter.py -k codex -q on this branch's HEAD: 22 passed, 0 failed. Did not run the full tests/providers/ tests/unit/ suite.
  • Lint passes (ruff check .) — ran ruff check on the two changed files only, not the whole repo: no findings.
  • Web build passes (npm run build) (if frontend changes) — no frontend changes, not run.

Checklist

  • My code follows the project's code style — ruff check on the touched files is clean (see Test Plan).
  • I have added tests for new functionality — three new tests added to tests/unit/sessions/test_codex_adapter.py.
  • All existing tests still pass — only ran the scoped test file above, not the full suite, so leaving this unticked.
  • I have updated documentation if needed — no doc changes needed for this bugfix.

_rewrite_search_output required a separator in the candidate before
keeping it as a file, so a root-level rg match like app.py:12: was
dropped even though _RG_MATCH_RE had already confirmed it was a path.
Bare rg --files/-l output for a root-level file (setup.py) was dropped
too.

Keep a matched path unconditionally, since the :line: suffix already
proves it is a path and not prose. For an unmatched bare line, loosen
the filter with _looks_like_a_bare_path: admit it when it has no
whitespace and either a separator or a "." after the first character,
which still drops stray prose like "No files were searched".
@repowise-bot

repowise-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown

Reviewed the whole diff: nothing to fix.

⚠️ Health of changed files: 6.2 → 6.0 (-0.1)


📊 See the full report for this PR
Your repo map with this PR's blast radius lit up, every caller of the contracts it changes, and health before and after. No sign-in. · Reviewed with AI · Plain markdown for agents · ⭐ Star Repowise · 📥 Install bot · Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings/bot · Updated 2026-09-29 04:03 UTC

@drakeo338

Copy link
Copy Markdown
Author

Review please?

@RaghavChamadiya RaghavChamadiya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @drakeo338, and sorry this sat a couple of days after your ping. Trusting the :\d+: match as proof of a path and only applying the bare-path heuristic to unmatched lines is the right split, and the prose-is-still-dropped test keeps the heuristic honest. Not a blocker: an extensionless root file like Makefile is still dropped, which is fine to leave for another day.

@RaghavChamadiya
RaghavChamadiya merged commit eb29cda into repowise-dev:main Oct 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A Codex rg search that finds a file at the repository root binds nothing, because the result must contain a slash

2 participants