Inject web crawl user messages correctly (#2129)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Fix stable user-message injection across steps**
>
> - Extracts `prepareStepMessages` logic into `prepare_step_utils` with
`transformContentPart`, `processPendingMessages`, and
`injectMessagesAtPositions` to track injected messages with
`insertAtIndex` and FIFO `sequence`, then re-inject them each step at
the same positions
> - Updates `local_agent_handler` to use `prepareStepMessages`,
maintaining `pendingUserMessages` and accumulated `allInjectedMessages`
>
> **Web crawl behavior update**
>
> - `web_crawl` now requires a screenshot and injects only screenshot +
markdown (HTML removed); clone instructions emphasize screenshot as
primary visual reference
>
> **Tests**
>
> - Adds comprehensive unit tests for the new utilities and an
integration-style multi-step simulation validating stable ordering and
reinjection
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
3b02b73cf25b497a2d09ab6239ec9e3598ae823e. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixes incorrect injection of web-crawl user messages across agent steps.
Messages are now re-injected at stable positions each step so screenshot
and markdown context persist across tool rounds.
- **Bug Fixes**
- Track injected user messages with an insertion index and re-inject
them every step (sorted in reverse) to keep order and prevent loss.
- Web crawl now requires a screenshot and injects only screenshot +
markdown (HTML removed). Updated clone instructions to emphasize the
screenshot.
<sup>Written for commit 3b02b73cf25b497a2d09ab6239ec9e3598ae823e.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
正在显示
请
注册
或者
登录
后发表评论