You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "wu-sheng (via GitHub)" <gi...@apache.org> on 2026/09/17 01:18:17 UTC
[PR] Tell a compaction apart from a history that merely grew [skywalking-horizon-ui]
wu-sheng opened a new pull request, #166:
URL: https://github.com/apache/skywalking-horizon-ui/pull/166
## What was wrong
A message of one text block is sent two ways, depending on where it sits in the list:
```
newest: "content": [{"type":"text","text":"which four?","cache_control":{...}}]
once passed: "content": "which four?"
```
The panel's delta stripped the moving `cache_control` — that case had a test — but compared the content shape as written. So a message stopped matching **the moment it stopped being the newest**, the shared prefix ended one message early, and every ordinary growth step was reported as a rewritten history.
Measured on one real 94-call conversation, comparing within each chain the way the panel does:
| | before | after |
| --- | --- | --- |
| growth steps | 28 | **90** |
| flagged "rewritten" | **60** | **2** |
| of those, list actually shrank | 2 | 2 |
So the warning that exists to catch a rewritten history was firing on almost every call, which is the same as not having it. The two genuine cases drop the list 112 → 2 and 76 → 2.
This is not scenario-specific. The Sessionizer reproduces it because it is what Claude Code 2.1.260 was measured to write, so it fires against real captures too.
## What changed
**The comparison.** `canonical()` now reads a one-block text content and its plain string as one value, exactly as it already reads a message that only gained or lost the cache marker. A message of several blocks, or of one block that is not text, never takes the short spelling and is left alone.
**The conclusion.** With the comparison honest, the flag is worth acting on, so the panel says which of two things happened rather than one vague sentence for both:
- **a compaction** — the context was replaced by a summary, so the list is shorter as well as different: *"The context was replaced by a summary here, so the list starts again: 112 message(s) became 2."* The conversation already models this as an `epoch.boundary` step with the summary beside it.
- **anything else** — the history changed without getting shorter. Still a warning, now the only case that raises one.
## Tests
None of these three branches had a test: the delta suite asserted `sharedMessages` and `settingsChanged` and left `rewritten`, the compaction and the empty delta alone, which is why this held. All three are covered now, including the real spelling pair that caused it and the negative cases that keep the guard from being neutered.
95 tests pass in the package.
## Documentation
Both projects documented this and both said only that the cache marker moves — the sentence that leads straight to the comparison this fixes. Aligned on both sides:
- Horizon: `docs/operate/ai-agent-conversations.md`
- Sessionizer: `docs/en/setup/claude-code-provider-bodies.md` (separate PR to follow)
Each now describes the second spelling, that a reader has to treat both as one message, and what a compaction does to the list.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Tell a compaction apart from a history that merely grew [skywalking-horizon-ui]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng merged PR #166:
URL: https://github.com/apache/skywalking-horizon-ui/pull/166
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org