MoonshotAI / MoonshotAI/kimi-cli

FetchURL duplicates GitHub issue body when comments extraction misfires

Open
#1,862 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
11.4k
Forks
1.3k
Avg merge
9h 47m
Merged PRs (30d)
2

Description

What version of Kimi Code CLI is running?

Current main checkout (reproduced locally on 2026-04-14).

Which open platform/subscription were you using?

N/A

Which model were you using?

N/A

What platform is your computer?

macOS

What issue are you seeing?

FetchURL can return duplicated text for GitHub issue pages.

For example, fetching https://github.com/MoonshotAI/Moonlight/issues/4 returns:

  • the expected issue body once
  • then a second malformed copy of the same content, with spacing around inline code removed

The duplicated trailing block looks like this:

The default parameter value for
optimizer
should probably beadamw
instead ofadamW
according to howget_optimizer
is written.
What steps can reproduce the bug?
  1. Run the FetchURL tool against https://github.com/MoonshotAI/Moonlight/issues/4
  2. Compare the returned text with the expected issue body
  3. Observe that the issue body is appended a second time in malformed form

This is also reproducible with:

uv run pytest tests/tools/test_fetch_url.py -k basic_functionality -vv
What is the expected behavior?

FetchURL should return the extracted main content once, without appending a duplicated malformed copy from comment extraction.

Additional information

I traced this to the trafilatura extraction path with include_comments=True.

For this GitHub issue page:

  • the main extracted text is correct
  • the comments extraction path appears to misclassify the issue body as comment content
  • the final output therefore includes both the normal main text and a malformed duplicate "comment" block

I already have a local fix that suppresses extracted comments when they normalize to the same content as the main body, plus a regression test for this case.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run tests/tools/test_fetch_url.py with the basic_functionality filter and reproduce the GitHub issue URL case. Inspect the FetchURL trafilatura extraction path with include_comments=True, then verify that the main content is returned once and the regression test passes without the duplicated malformed block.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.