Repository navigation
fix(compaction): annotate partial summaries with chunk order and source time range - #100684
Conversation
3ada122 to
e6d0919
Compare
e6d0919 to
2a530f2
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 3:49 AM ET / 07:49 UTC. Summary PR surface: Source +46, Tests +13. Total +59 across 2 files. Reproducibility: yes. current main builds final staged merge messages as unlabeled user content with Date.now timestamps, and agent-core serialization emits user content without timestamps. I did not run a live model-quality compaction session in this read-only review. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this content-label fix as the canonical staged-compaction repair once CI is green or the unrelated failing shard is classified, then close the linked issue and supersede timestamp-only sibling attempts. Do we have a high-confidence way to reproduce the issue? Yes: current main builds final staged merge messages as unlabeled user content with Date.now timestamps, and agent-core serialization emits user content without timestamps. I did not run a live model-quality compaction session in this read-only review. Is this the best way to solve the issue? Yes: putting chunk order and source time ranges into the synthetic merge message content is the narrowest maintainable fix because the serializer drops timestamps. The timestamp-only sibling PRs are less complete because they do not make chronology visible to the merger model. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against be48a430bfa6. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +46, Tests +13. Total +59 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
2a530f2 to
84be326
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
84be326 to
f7052bb
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…time ranges Add extractChunkTimeRange helper that scans each chunk for min/max timestamp bounds and formats them as human-readable date ranges. Annotate each partial summary with [Chunk N — oldest/most recent messages [YYYY-MM-DD HH:MM — YYYY-MM-DD HH:MM]] labels so the LLM merger can distinguish old from new context. Use descending timestamps for strict monotonicity across synthetic messages. The label goes into message content because serializeConversation preserves only text, discarding timestamps. Co-Authored-By: PR openclaw#100684 approach Fixes openclaw#100636
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
…ce time range labels In summarizeInStages, partial summaries are wrapped into synthetic AgentMessage objects before the final merge pass. Previously each synthetic message used Date.now() as its timestamp and no ordering metadata was embedded in the content. Since serializeConversation (in agent-core) only preserves text content and discards timestamps, the LLM merger could not distinguish which summary chunk represented older vs newer history, making the "PRIORITIZE recent context" merge instruction ineffective. Fix: 1. Embed a chronological label with source time range in each summary content text (e.g. "[Chunk 1 - oldest messages [2026-07-05 14:00]]"). 2. Extract actual timestamp ranges from original chunk messages via new extractChunkTimeRange() helper. 3. Assign ascending timestamps from a single Date.now() capture so relative order is preserved for code paths reading timestamp field. 4. Update test to verify merge messages receive the labels. 5. Add real behavior proof script (proof/issue-100636-chunk-labels.ts) with 10/10 verification checks. Fixes openclaw#100636
2f04290 to
20cc7a5
Compare
|
Maintainer review complete on exact head
Known gap: no live provider/model-quality compaction session was run. The focused tests cover message construction, deterministic labels, and ordering. Ready to squash-merge. |
|
Merged via squash.
|
What Problem This Solves
In
summarizeInStages, partial summaries are wrapped into syntheticAgentMessageobjects before the final merge pass. Previously each synthetic message usedDate.now()as its timestamp and no ordering metadata was embedded in the content. SinceserializeConversation(in agent-core) only preserves text content and discards timestamps, the LLM merger could not distinguish which summary chunk represented older vs newer history, making the "PRIORITIZE recent context" merge instruction ineffective. Fixes #100636.Changes
src/agents/compaction.tsextractChunkTimeRange()— extracts the min/max timestamp range from each chunk of original messages and formats it as a human-readable time range.summarizeInStages— each synthetic merge message now carries a chunk label with chronological position and source time range embedded in its content (e.g.,[Chunk 1 — oldest messages [2026-07-05 14:00 — 2026-07-06 09:30]]). Also sets proper monotonic timestamps from a singleDate.now()capture.src/agents/compaction.identifier-preservation.test.tsEvidence
Unit tests (136/136 passed across 5 test files):
Type check:
pnpm tsgo:core:test— zero errors.Real behavior proof (10/10 verification checks):
The proof script exercises the actual code paths with realistic multi-hour conversation data, showing labels are correctly constructed and serialized:
Review