Skip to content

fix: avoid resending web uploads after restart#2288

Open
he-yufeng wants to merge 1 commit into
MoonshotAI:mainfrom
he-yufeng:fix/web-upload-sent-marker
Open

fix: avoid resending web uploads after restart#2288
he-yufeng wants to merge 1 commit into
MoonshotAI:mainfrom
he-yufeng:fix/web-upload-sent-marker

Conversation

@he-yufeng
Copy link
Copy Markdown

@he-yufeng he-yufeng commented May 14, 2026

Summary

  • persist the web upload .sent marker after normal upload encoding
  • reuse that marker on a restarted SessionProcess so already-sent uploads are not attached to a later text-only prompt
  • add a regression test for the process-restart path

Fixes #2279.

To verify

  • uv run pytest tests\web\test_uploaded_files.py -q --basetemp .tmp\pytest -p no:cacheprovider
  • uv run pytest tests\web -q --basetemp .tmp\pytest -p no:cacheprovider
  • uv run ruff check src\kimi_cli\web\runner\process.py tests\web\test_uploaded_files.py
  • uv run ruff format --check src\kimi_cli\web\runner\process.py tests\web\test_uploaded_files.py
  • uv run python -m py_compile src\kimi_cli\web\runner\process.py tests\web\test_uploaded_files.py

Open in Devin Review

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: a6c4cb6a9b

ℹ️ 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 on lines +507 to +509
sent_marker.write_text(
json.dumps(sorted(self._sent_files), ensure_ascii=False),
encoding="utf-8",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Persist upload marker only after prompt send succeeds

Writing .sent here commits uploads as delivered before send_message() actually forwards the prompt to the worker (stdin.write/drain happens later). If the worker exits or the pipe write fails in that window, the prompt never reaches the model, but the persisted marker survives restart and causes those files to be skipped on retry, silently dropping user uploads. This regression is specific to restart/error paths introduced by persisting the marker in _encode_uploaded_files.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

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.

Web 模式:恢复会话后历史图片被重复发送给 LLM || Web mode: historical images are repeatedly sent to LLM after restoring the session

1 participant