Repository navigation
feat(context): fold an older browser snapshot of the same tab and address in the request copy - #174
Merged
Merged
Conversation
…ress in the request copy Device browser tools put the page text (snapshot) in their results, and DeX now attaches the new page to BrowserNavigate/BrowserInteract results that moved the page. Old snapshots were resent on every request: six snapshots piled up in one Naver mail compose run (10/20), and the BO product form is 14,440 chars a read. - core.message_repair.fold_superseded_results(messages, spec): groups JSON results of the named tools by the key fields; only the newest per key keeps the bulky fields, older ones get a one-line note. Errors, non-JSON results and results missing a key are left alone; a result without the fields does not count as newer. - SharedKeys.FOLDED_TOOL_RESULTS: Stage 6 applies it to the request copy (history untouched, this loop's results included). - Host: when this turn has device browser tools, the turn executor sets host.device_tools.browser_snapshot_fold_spec - key page_id + url, so a page read at another address is never folded (accuracy first); a newer snapshot of the same address already expired the older refs (generation +1 per snapshot). Tests: 6272 passed, 16 skipped (11 new). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CHANGELOG: 이 변경을 [4.103.0] 으로 4.102.0 위에 둔다. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI 의 ruff format --check 와 mypy(core) 가 실패하던 것. 동작은 같다. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요약
기기 브라우저 도구의 결과에 실리는 화면 글(스냅샷)이 매 요청 그대로 다시 보내져 입력이 쌓였다. 같은 탭·같은 주소의 더 새 스냅샷이 뒤에 있으면, 앞 스냅샷의 화면 글을 요청 사본에서만 한 줄로 접는다(기록은 그대로).
DeX 가 페이지를 옮긴 BrowserNavigate·BrowserInteract 결과에도 새 화면을 싣기 시작해서(PlateerLab/xgen-dex-core
fix/browser-navigate-ready) 짝으로 필요하다.변경
core.message_repair.fold_superseded_results(messages, spec)— 지정한 도구의 JSON 결과를key필드로 묶어 가장 새 결과만 큰 필드(fields)를 남기고, 앞 결과의 그 필드는note로 바꾼다. 오류 결과·JSON 아닌 결과·key 빠진 결과는 두고, 큰 필드가 없는 결과는 더 새 것으로 치지 않는다.SharedKeys.FOLDED_TOOL_RESULTS— Stage 6_call_kwargs가 요청 사본에 적용(이번 루프의 결과까지).mcp_<기기>_Browser*, 문 제외)가 있으면host.device_tools.browser_snapshot_fold_spec을 넣는다. key 는page_id·url— 주소가 다르면 앞 페이지에서 읽은 것이 그 글에만 있을 수 있어 접지 않는다. 같은 주소의 더 새 스냅샷이 있으면 앞 것은 ref 도 이미 만료됐다(스냅샷마다 generation 이 오른다).[Unreleased].영향
agent_traces.metadata.usage.cache_read_tokens로 볼 예정.테스트
tests/unit/test_fold_superseded_results.py9,tests/test_host_local_folders.py2)반영: 릴리스 뒤 xgen-workflow 휠 고정을 올리면 된다(xgen-workflow 코드 변경 없음).
관련: PlateerLab/xgen-dex-core#235, xgen-workflow !2302 (http://gitlab.x2bee.com/xgen2.0/xgen-workflow/-/merge_requests/2302)
🤖 Generated with Claude Code