Skip to content

fix: issue triage quick wins (chunk cap, map, path search) - #154

Open
PatrickSys wants to merge 1 commit into
masterfrom
cursor/issue-triage-quick-wins-0f7d
Open

PatrickSys wants to merge 1 commit into
masterfrom
cursor/issue-triage-quick-wins-0f7d

Conversation

@PatrickSys

Copy link
Copy Markdown
Owner

Summary

Open-issue triage for PatrickSys/codebase-context (7 open). Skipped implementation overlap with open PRs #145, #146, and #147 and closed PR #142.

Triage (by category)

Issue Category Notes
#68 Still valid (in flight) Mutex/onnx — PR #147
#70 Still valid (in flight) OPENAI_BASE_URL — PR #145
#71 Still valid (in flight) Native Ollama — PR #146
#149 Quick win (this PR) Honest chunk-cap reporting + config docs
#150 Quick win (partial) + help wanted Path-token keyword boosts; deeper doc search still open
#151 Quick win (this PR) Exclude vendored/raw hashed bundles from bounded map
#152 Still valid + help wanted Path boosts help; edit-preflight guard wiring still needed

(GitHub token could not add issue comments/labels; suggested labels: #68 bug+help wanted, #70/#71 enhancement+good first issue, #149/#151 bug, #150/#152 bug+help wanted.)

Changes

Tests

  • tests/indexer-chunk-limit-reporting.test.ts
  • tests/search-path-token-boost.test.ts
  • tests/codebase-map.test.ts (vendored bundle exclusion)

Fixes #149
Fixes #151
Fixes #150
Fixes #152

Open in Web Open in Cursor 

Clarify searchable chunk limits, exclude vendored bundles from bounded map,
and boost keyword hits for file-like query tokens. Adds regression tests.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T22:36:59.040648Z 28e71e3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 28e71e31a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/core/codebase-map.ts
/(?:^|\/)[^/]*\.(?:generated|gen|min)\.[^/]+$/i,
/(?:^|\/)raw(?:\/|$)/i,
/(?:^|\/)live-from-ai(?:\/|$)/i,
/[^/]+-[A-Za-z0-9]{6,}\.(?:js|css|mjs|cjs)$/i,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Distinguish bundle hashes from ordinary hyphenated filenames

In the default bounded map, this pattern also excludes handwritten files whose final hyphen-separated word has six or more letters. For example, the existing scripts/sync-grammars.mjs matches it, as would request-handler.js. Because isMapEligiblePath filters graph nodes, edges, and chunks, these legitimate source files disappear from architecture sections rather than just generated bundles being removed. Narrow the bundle detection so ordinary descriptive filenames remain eligible.

Useful? React with 👍 / 👎.

Comment thread src/core/search.ts
Comment on lines +1974 to +1977
fuseResults = [
...pathRescue,
...rescue,
...fuseResults.filter(({ item }) => !seen.has(item.id))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Deduplicate the two rescue lists before merging candidates

When a filename-bearing query triggers rescue and a chunk matches both its path token and the lexical rescue criteria, that chunk appears in both pathRescue and rescue. The seen set only filters the original Fuse results, so the duplicate survives selectCurrentCandidates, consumes two candidate slots, and causes collectHybridMatches to append two keyword ranks for the same query variant. fuseAndScoreResults then sums both contributions, artificially inflating relevance and confidence. Deduplicate the rescue lists against each other before candidate selection.

Useful? React with 👍 / 👎.

Comment thread src/core/indexer.ts
Comment on lines +1215 to +1216
searchableChunks: stats.searchableChunks,
chunkLimitApplied: stats.chunkLimitApplied,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore the cap metadata on unchanged incremental runs

After indexing a capped repository, restarting without source changes takes the incremental short-circuit, whose persisted-stats reader restores only indexedFiles, totalChunks, and totalFiles. Although these new fields are written here, neither is restored, so formatIndexingCompleteLine falls back to reporting all analyzed chunks as indexed—for example, 88424 chunks instead of 5000/88424 chunks searchable. Restore searchableChunks and chunkLimitApplied in the no-change path so the new reporting remains accurate on subsequent starts.

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 2/5

[Medium impact] The changes reach indexing reports, project search results, and bounded codebase summaries.

Fix the map exclusions and search ranking before merging, and satisfy the documentation requirements.

Findings

  1. P1 Ordinary source files disappear ▶
  2. P1 Repeated chunks skew search ▶
  3. P1 Loose paths hide exact files ▶
  4. P2 Cap details disappear on reuse ▶
  5. P2 Published users get ineffective advice ▶
  6. P2 Search weights lack a reason ▶

Summary

This PR adds chunk-cap reporting, filters bounded maps, and boosts filename-like search terms.

  • Indexing reports how many chunks are searchable and where to change the cap.
  • Search finds and ranks files named in natural-language queries.
  • Bounded maps leave raw folders and hashed bundles out of their summaries.

Reviews (1) · Last reviewed commit: "fix: triage quick wins for chunk cap, ma..." · Reviewed by Greptile

Comment thread src/core/codebase-map.ts
/(?:^|\/)[^/]*\.(?:generated|gen|min)\.[^/]+$/i,
/(?:^|\/)raw(?:\/|$)/i,
/(?:^|\/)live-from-ai(?:\/|$)/i,
/[^/]+-[A-Za-z0-9]{6,}\.(?:js|css|mjs|cjs)$/i,

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.

P1 Ordinary source files disappear

The bundle pattern also matches maintained source such as query-builder.js, error-handler.js, and scripts/check-agent-instructions.mjs. The default bounded map removes these files and their graph edges, hiding useful source from the map. Restrict the exclusion to paths with evidence that they are generated bundles, and test an ordinary hyphenated filename.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment thread src/core/search.ts
Comment on lines +1974 to +1978
fuseResults = [
...pathRescue,
...rescue,
...fuseResults.filter(({ item }) => !seen.has(item.id))
].sort((a, b) => (a.score ?? 0) - (b.score ?? 0));

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.

P1 Repeated chunks skew search

pathRescue and rescue can contain the same chunk, but seen only removes duplicates from the trailing Fuse results. A natural-language script query can match both the script's path and multiple query words. The repeated chunk consumes candidate slots and gets two contributions to its final search score. Deduplicate the combined lists by item.id before selecting candidates.

Comment thread src/core/search.ts
Comment on lines +1962 to +1967
const pathRescue: FuseResult<CodeChunk>[] = this.matchChunksByPathTokens(query, filters).map(
(chunk, refIndex) => ({
item: chunk,
refIndex,
score: 0
})

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.

P1 Loose paths hide exact files

Every path match gets score: 0, including loose substring matches. A query naming NOW.md also matches archive/now.md.bak through includes(token), giving both the maximum keyword score. Matches keep index order, and the candidate limit applies before the later boosts. Enough loose matches can exclude NOW.md entirely. Rank exact filenames above stem and substring matches before applying the limit.

Comment thread src/core/indexer.ts
Comment on lines +1215 to +1216
searchableChunks: stats.searchableChunks,
chunkLimitApplied: stats.chunkLimitApplied,

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.

P2 Cap details disappear on reuse

The new cap fields are saved but not restored when indexing finds no changed files. That branch restores only indexedFiles, totalChunks, and totalFiles, then returns. After a capped build, an unchanged run loses the searchable count and prints the analyzed total without the cap warning. Restore both fields from the saved stats and test a capped build followed by an unchanged run.

Comment thread docs/capabilities.md
- `projects[].analyzerHints.analyzer`: prefers a registered analyzer by name for that project and falls back safely when the name is missing or invalid
- `projects[].analyzerHints.extensions`: adds project-local source extensions for indexing and auto-refresh watching without changing defaults for other projects
- `projects[].parsing.maxChunks`: sets the maximum number of searchable chunks indexed for that project (requires 2.4.0, not yet published)
- `projects[].parsing.maxChunks`: sets the maximum number of searchable chunks indexed for that project (default 5000; configurable via `~/.codebase-context/config.json`)

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.

P2 Published users get ineffective advice

Removing the unreleased label presents projects[].parsing.maxChunks as available to npm users. The guide says unmarked features apply to the published package, but the v2.3.0 config reader does not read parsing; this option was added later. Keep an unreleased or built-checkout qualifier here and in README.md. The repository requires public docs not to claim capabilities that are not shipped, so this must be corrected before merging.

Context Used: AGENTS.md (source)

Comment thread src/core/search.ts
Comment on lines +2017 to +2027
for (const token of extractQueryPathTokens(query)) {
const base = path.basename(relativePathLower);
const stem = base.replace(/\.[^.]+$/, '');
if (
base === token ||
relativePathLower.endsWith(`/${token}`) ||
stem === token.replace(/\.[^.]+$/, '')
) {
score = Math.min(1.0, score + 0.45);
} else if (stem.includes(token) || relativePathLower.includes(token)) {
score = Math.min(1.0, score + 0.25);

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.

P2 Search weights lack a reason

The new ranking adds 0.45 for exact path matches and 0.25 for partial matches without explaining the weights or how repeated tokens should affect the score. The repository requires every ranking heuristic to include research citations or a principled justification. Before merging, document the reason for these boosts, including their interaction with the score cap and the full-name/stem tokens.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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

Labels

None yet

Projects

None yet

2 participants