Commit Graph

19 Commits

Author SHA1 Message Date
Charles Cunningham
96b88aee15 Reinject context for summary-only mid-turn compaction 2026-02-18 01:50:58 -08:00
Charles Cunningham
223eda12d3 Reinject previous-turn context for pre-sampling model-switch compaction 2026-02-18 01:17:13 -08:00
Charles Cunningham
2ede42d319 Reinsert initial context for mid-turn compaction 2026-02-18 01:00:35 -08:00
Charles Cunningham
25c22dcefc Unify model-switch persistence through compaction history 2026-02-18 00:26:02 -08:00
Charles Cunningham
714e0b78ba Align compaction tests with always-skip post-layout 2026-02-18 00:08:39 -08:00
Charles Cunningham
d58204f9df Always skip reinjection during auto-compaction 2026-02-17 23:29:28 -08:00
Charles Cunningham
a9c6219d85 Append incoming pre-turn items after compaction summary 2026-02-17 22:43:21 -08:00
Charles Cunningham
589b0763cc Fix compact test snapshot and include bazel lock update 2026-02-17 18:29:14 -08:00
Charles Cunningham
7139784970 Strip incoming model-switch updates from remote compaction input 2026-02-17 18:29:13 -08:00
Charles Cunningham
9d34abf954 core: snapshot pre-turn model-switch compaction strip behavior 2026-02-17 18:29:13 -08:00
Charles Cunningham
bddd53bae5 Rebase: align compaction snapshots and imports 2026-02-17 18:29:11 -08:00
Charles Cunningham
15730c2fcb Align compaction tests with incoming-item and empty-history behavior 2026-02-17 18:29:11 -08:00
Charles Cunningham
8b2f5066a5 update snaps 2026-02-17 18:29:11 -08:00
Charles Cunningham
2a804d9f4d Update snaps 2026-02-17 18:29:11 -08:00
Charles Cunningham
4022de74ef compact: preserve incoming items during pre-turn trim retries 2026-02-17 18:29:11 -08:00
Charles Cunningham
5c389f9f20 Update pre-sampling model-switch compaction snapshot 2026-02-17 18:29:11 -08:00
Charles Cunningham
c7cef7dab1 update snapshot 2026-02-17 18:29:10 -08:00
Charley Cunningham
eb68767f2f Unify remote compaction snapshot mocks around default endpoint behavior (#12050)
## Summary
- standardize remote compaction test mocking around one default behavior
in shared helpers
- make default remote compact mocks mirror production shape: keep
`message/user` + `message/developer`, drop assistant/tool artifacts,
then append a summary user message
- switch non-special `compact_remote` tests to the shared default mock
instead of ad-hoc JSON payloads

## Special-case tests that still use explicit mocks
- remote compaction error payload / HTTP failure behavior
- summary-only compact output behavior
- manual `/compact` with no prior user messages
- stale developer-instruction injection coverage

## Why
This removes inconsistent manual remote compaction fixtures and gives us
one source of truth for normal remote compact behavior, while preserving
explicit mocks only where tests intentionally cover non-default
behavior.
2026-02-17 18:18:47 -08:00
Charley Cunningham
85034b189e core: snapshot tests for compaction requests, post-compaction layout, some additional compaction tests (#11487)
This PR keeps compaction context-layout test coverage separate from
runtime compaction behavior changes, so runtime logic review can stay
focused.

## Included
- Adds reusable context snapshot helpers in
`core/tests/common/context_snapshot.rs` for rendering model-visible
request/history shapes.
- Standardizes helper naming for readability:
  - `format_request_input_snapshot`
  - `format_response_items_snapshot`
  - `format_labeled_requests_snapshot`
  - `format_labeled_items_snapshot`
- Expands snapshot coverage for both local and remote compaction flows:
  - pre-turn auto-compaction
  - pre-turn failure/context-window-exceeded paths
  - mid-turn continuation compaction
  - manual `/compact` with and without prior user turns
- Captures both sides where relevant:
  - compaction request shape
  - post-compaction history layout shape
- Adds/uses shared request-inspection helpers so assertions target
structured request content instead of ad-hoc JSON string parsing.
- Aligns snapshots/assertions to current behavior and leaves explicit
`TODO(ccunningham)` notes where behavior is known and intentionally
deferred.

## Not Included
- No runtime compaction logic changes.
- No model-visible context/state behavior changes.
2026-02-14 19:57:10 -08:00