Skip to content

feat(context): integrate TypedPage compaction into assembler pipeline#3638

Merged
bug-ops merged 1 commit intomainfrom
3630-typedpage-assembler-pipeline
May 6, 2026
Merged

feat(context): integrate TypedPage compaction into assembler pipeline#3638
bug-ops merged 1 commit intomainfrom
3630-typedpage-assembler-pipeline

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented May 6, 2026

Summary

  • Wire typed_page.rs (previously dead code) into the context summarization pipeline via a config-gated feature ([memory.compression.typed_pages], disabled by default)
  • Add BatchAssertions (aggregate tool-coverage check) replacing the impractical per-page invariants
  • Fix two panics found during security audit: channel(0) and UTF-8 byte-index slice on non-ASCII content
  • Fix CompactionAuditSink::flush() to use a oneshot-rendezvous with a 100ms timeout instead of yield_now()
  • Guard Active mode against all-SystemContext batches producing meaningless LLM summaries

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace --features "desktop,ide,server,chat,pdf,scheduler" -- -D warnings — 0 warnings
  • cargo nextest run --config-file .github/nextest.toml --workspace --lib --bins — 8899 passed
  • Regression: audit_sink_capacity_zero_does_not_panic
  • Regression: classify_with_role_non_ascii_body_does_not_panic
  • Verify zero-cost disabled path: feature enabled=false produces no allocations in compaction hot path
  • Live session test with [memory.compression.typed_pages] enabled = true to exercise audit sink and batch assertions

Closes #3630

@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate dependencies Dependency updates enhancement New feature or request size/XL Extra large PR (500+ lines) labels May 6, 2026
@bug-ops bug-ops enabled auto-merge (squash) May 6, 2026 02:24
Wire crates/zeph-context/src/typed_page.rs into the context summarization
pipeline. Previously the module was fully tested in isolation but had no
integration points and was dead code in production.

Changes:
- zeph-config: add TypedPagesConfig under [memory.compression.typed_pages]
  with enabled/enforcement/audit_sink/flush_timeout_ms fields; disabled by default
- zeph-context: add BatchViolation, BatchAssertions, TypedPagesState; fix
  CompactionAuditSink::flush() with oneshot rendezvous + 100ms timeout cap;
  fix panic on audit_channel_capacity=0 (capacity.max(1)); fix UTF-8 boundary
  panic in body truncation (char-boundary-safe loop)
- zeph-agent-context: add typed_pages field to ContextSummarizationView;
  wire classify step (2.5), SystemContext pointer-replace in active mode (3.5),
  BatchAssertions check (5.5), and audit emit (7.5) into compact_context();
  skip LLM call when entire batch is pointer-replaced SystemContext stubs
- zeph-core: add typed_pages_state to CompressionState and CompactionAdapters;
  expose with_typed_pages_state() builder method
- src/runner.rs: add build_typed_pages_state() async init; wire into builder chain

The feature is zero-cost when disabled. Two regression tests added:
audit_sink_capacity_zero_does_not_panic and
classify_with_role_non_ascii_body_does_not_panic.

Closes #3630
@bug-ops bug-ops force-pushed the 3630-typedpage-assembler-pipeline branch from 68471c6 to caf893f Compare May 6, 2026 02:24
@bug-ops bug-ops merged commit d034eaa into main May 6, 2026
32 checks passed
@bug-ops bug-ops deleted the 3630-typedpage-assembler-pipeline branch May 6, 2026 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate dependencies Dependency updates documentation Improvements or additions to documentation enhancement New feature or request rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: integrate TypedPage compaction into context assembler pipeline

1 participant