Skip to content

Preserve selected source bodies in codegraph output#652

Open
GaoSSR wants to merge 2 commits into
colbymchenry:mainfrom
GaoSSR:fix-explore-source-truncation
Open

Preserve selected source bodies in codegraph output#652
GaoSSR wants to merge 2 commits into
colbymchenry:mainfrom
GaoSSR:fix-explore-source-truncation

Conversation

@GaoSSR
Copy link
Copy Markdown

@GaoSSR GaoSSR commented Jun 2, 2026

Summary

  • Return the selected symbol body from codegraph_node includeCode=true for container symbols instead of replacing classes/interfaces with member outlines
  • Trim long context code blocks from the middle so both the opening context and tail lines remain visible
  • Add regression coverage for container bodies and long code blocks with important tail content

Testing

  • npx vitest run __tests__/context.test.ts __tests__/symbol-lookup.test.ts
  • npm run build
  • git diff --check

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 8cf3a56186

ℹ️ 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/mcp/tools.ts
if (!outline) {
code = await cg.getCode(node.id);
}
code = await cg.getCode(node.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 Trim large container bodies before formatting

When includeCode is used for a large class/interface/etc. (common now that containers no longer use the member outline), this fetches the entire body and handleNode then applies truncateOutput to the already-formatted section. For container bodies over ~15 KB, the result only contains the prefix of the class and can cut off later methods, the closing fence, and the trail, so users still cannot see the selected symbol body reliably. Consider applying the same middle/tail-preserving trim to the code body before formatNodeDetails (or otherwise bounding it) instead of relying on whole-output truncation.

Useful? React with 👍 / 👎.

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.

1 participant