Skip to content

feat(context): fold an older browser snapshot of the same tab and address in the request copy - #174

Merged
SonAIengine merged 3 commits into
mainfrom
feature/fold-superseded-snapshots
Oct 25, 2026
Merged

SonAIengine merged 3 commits into
mainfrom
feature/fold-superseded-snapshots

Conversation

@SonAIengine

@SonAIengine SonAIengine commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

요약

기기 브라우저 도구의 결과에 실리는 화면 글(스냅샷)이 매 요청 그대로 다시 보내져 입력이 쌓였다. 같은 탭·같은 주소의 더 새 스냅샷이 뒤에 있으면, 앞 스냅샷의 화면 글을 요청 사본에서만 한 줄로 접는다(기록은 그대로).

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 이 오른다).
  • CHANGELOG [Unreleased].

영향

  • 접힌 메시지부터 뒤로는 접두 캐시가 한 번 깨진다(접히는 것은 대개 바로 앞 몇 메시지). 실측은 agent_traces.metadata.usage.cache_read_tokens 로 볼 예정.
  • CLI provider(claude_code·codex)는 기록을 CLI 가 들고 있어 적용되지 않는다.

테스트

  • 새 11개(tests/unit/test_fold_superseded_results.py 9, tests/test_host_local_folders.py 2)
  • 전체 6,272 passed, 16 skipped. ruff 통과.

반영: 릴리스 뒤 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

…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>
SonAIengine and others added 2 commits October 25, 2026 16:39
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>
@SonAIengine
SonAIengine merged commit 664e119 into main Oct 25, 2026
7 checks passed
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