Skip to content

feat(core): validate deferred_apply_threshold < compaction_threshold in wizard #1302

@bug-ops

Description

@bug-ops

Follow-up from epic #1294 review (IMPL-CRIT-01).

The --init wizard validates that deferred_apply_threshold is in range (0, 1) but does not enforce that it is strictly less than compaction_threshold. A user setting deferred_apply_threshold = 0.85 with compaction_threshold = 0.80 would cause Tier 0 to never fire before Tier 1, defeating the purpose of deferred summarization.

Note: the CRIT-01 safety net in compact_context() prevents data loss even in this misconfiguration. But the tier ordering would be effectively broken.

Fix

In src/init.rs build_config() / wizard step:

  1. After collecting both values, validate deferred < compaction
  2. If not, emit a clear error/warning: "deferred_apply_threshold must be less than compaction_threshold"
  3. Ideally, prompt the user to re-enter the value rather than just warning

Also add a runtime check at agent startup with tracing::warn! if the invariant is violated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions