Add reset family carryover summaries#90259
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 10, 2026, 7:32 AM ET / 11:32 UTC. Summary PR surface: Source +756, Tests +1460, Docs -1, Other +85. Total +2300 across 54 files. Reproducibility: yes. at source level: the supplied real-module proof creates on-disk reset-family transcripts and observes bounded history resolution plus exactly one summary at the model boundary. This is not a failing current-main bug reproduction because the PR proposes a new opt-in capability. Review metrics: 3 noteworthy metrics.
Stored data model 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
Maintainer decision needed
Security Review detailsBest possible solution: Land the narrower family-history API first, then rebase this branch into an isolated carryover change and approve it only with explicit provider-disclosure, upgrade, and exact-head integration proof. Do we have a high-confidence way to reproduce the issue? Yes at source level: the supplied real-module proof creates on-disk reset-family transcripts and observes bounded history resolution plus exactly one summary at the model boundary. This is not a failing current-main bug reproduction because the PR proposes a new opt-in capability. Is this the best way to solve the issue? Unclear as product direction: the implementation is credible and well-tested, but the narrowest maintainable landing is to establish the family-history contract first and review automatic carryover separately. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c8655be91514. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +756, Tests +1460, Docs -1, Other +85. Total +2300 across 54 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 (28 earlier review cycles; latest 8 shown)
|
…-summary # Conflicts: # test/scripts/native-app-i18n.test.ts
…-summary # Conflicts: # test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/discord-group-codex-message-tool.md # test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/telegram-direct-codex-message-tool.md # test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path/telegram-heartbeat-codex-tool.md
…-summary # Conflicts: # scripts/protocol-gen-swift.ts
…-summary # Conflicts: # apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift # scripts/protocol-gen-swift.ts # src/gateway/session-reset-service.ts
Behavior or issue addressed
Depends on #90239.
When a session has been reset/rotated, the active transcript can be clean while the previous reset archive still contains the latest compaction summary. The next embedded-agent prompt therefore starts without the carryover context unless the model/tool explicitly asks for family history.
This change reuses the session-family transcript resolver from #90239 and injects the latest reset-archive compaction summary into embedded-agent prompt context before the LLM boundary, but only when the active context does not already contain a compaction summary.
Fix
chat.history(includeFamily)on the shared resolver.compactionSummaryfrom reset ancestor transcripts.origin/mainand preserved the newer transcript-reader seam plus same-session reset fallback.Real behavior proof
Current head proven:
ba74ecd54e52c2416ab8f7906491266b989f529c.Behavior or issue addressed: A reset/rotated logical session should read bounded reset-family history through the shared resolver, keep current reset archive plus current active transcript available inside the cap, preserve the newest eligible ancestors even when an older retained ancestor has many reset-topic archives, and inject exactly one reset-family compaction summary before the embedded-agent LLM boundary.
Real environment tested: Local OpenClaw checkout on this PR branch at
/home/clever/.openclaw/workspace/github/openclaw, using current branch TypeScript modules and temporary on-disk session stores/transcripts under/tmp/openclaw-family-proof-ba74ecd54e-*. No private channel, endpoint, phone, prompt, auth, or user transcript data was used.Exact steps or command run after this patch:
Evidence after fix:
ancestor04Presentis false.ancestor34Presentis true andarchiveHeavyTopicTargetCountis 0.Exact-head ba74ecd54e carryover 34, and preserved its token count.compactionSummarybefore the model boundary and remained idempotent on a second pass.Validation on current head:
What was not tested: Full live Telegram/Slack/Discord end-to-end reset turn was not run locally; the proof exercises the real resolver and embedded carryover path against on-disk OpenClaw-like session artifacts.
Current head addendum:
f59176b8acClawSweeper's exact-head proof request is addressed on current head
f59176b8acbb9847ab4c69c09ad4539cde66b9d0.The carryover prompt injection is now default-off and requires explicit
agents.defaults.experimental.sessionFamilyCarryover: true. The proof below uses current-branch modules, temporary on-disk reset-family transcript files, the real reset-family carryover resolver, and the real transform installer/gate.Observed result after fix:
useronlysessionFamilyCarryoveropt-in installs the transform and prepends exactly one archived reset-family compaction summary before the user messagetokensBeforeValidation after the stacked #90239 CI repair cherry-pick:
Current head addendum:
1f2e39b6d9ClawSweeper's current-head proof request is refreshed on head
1f2e39b6d9f93c541c1d15549620b9e4a27fd751after the selector/offset validation and embedded/Gateway family-history parity updates.The carryover prompt-boundary proof below uses current-branch TypeScript modules directly and no private transcript data:
Additional exact-head validation after the embedded family-history parity fix and includeFamily/offset validation:
Observed result after fix:
includeFamilyremains the only selector andincludeFamily + offsetis rejected in tool, Gateway, and embedded paths.chat.history(includeFamily)now skips the final current-sessionsessionStartedAtannounce filter, matching Gateway, so ancestor/resetsubagent_announcerows are preserved in family history.Current head addendum:
1ca3a90b24Follow-up head
1ca3a90b24bed1bf8aa0a855614afa8d5f70d45dkeeps the same behavior as the1f2e39b6d9proof and only adjusts the new embedded regression test to satisfy lint and test-type gates.Runtime carryover proof on the exact current head:
Exact-head validation after the lint/type follow-up:
The earlier
1f2e39b6d9addendum in this PR body remains the focused behavioral validation forincludeFamily + offset, embedded/Gateway family-history parity, and carryover tests; this head only changes test typing/property-access style.Current head addendum: `a054665423`
ClawSweeper's protocol-validator concern is addressed on current head `a054665423d6037478feb28a26467d257f5adb9d`:
Exact-head validation:
```text
$ git rev-parse HEAD
a054665
$ CI=true node scripts/run-vitest.mjs run packages/gateway-protocol/src/index.test.ts
Test Files 1 passed (1)
Tests 45 passed (45)
$ CI=true node scripts/run-vitest.mjs run src/agents/tools/sessions-history-tool.test.ts src/agents/openclaw-tools.sessions.test.ts -t 'includeFamily|offset'
Test Files 4 passed (4)
Tests 12 passed | 84 skipped (96)
$ CI=true node scripts/run-vitest.mjs run src/agents/tools/embedded-gateway-stub.test.ts src/gateway/server.chat.gateway-server-chat-b.test.ts -t 'family|includeFamily|subagent_announce|sessionStartedAt|offset|cap'
Test Files 3 passed (3)
Tests 30 passed | 59 skipped (89)
$ pnpm protocol:check
passed; generated protocol schema and Swift models are current
$ pnpm lint --threads=8
passed
$ CI=true pnpm check:test-types
passed
$ git diff --check
no output
```
Current head addendum:
30c6060925ClawSweeper's proof request is refreshed on head
30c6060925f11aeaebdfbe7d2dfaf549da93f5bfafter the current reset-archive target-cap fix.The runtime proof below uses current-branch TypeScript modules directly, temporary on-disk session artifacts, the shared family target resolver, and the embedded carryover transform gate. No private transcript or channel data was used.
Observed result after fix:
useronlysessionFamilyCarryoveropt-in installs the transform and prepends exactly one archived reset-familycompactionSummarybefore the user messagetokensBeforeExact-head validation: