Skip to content

feat(rebuilder): default trigger_mode threshold (#746) - #750

Merged
robotrocketscience merged 4 commits into
mainfrom
feat/issue-746-rebuilder-default-threshold
May 13, 2026
Merged

feat(rebuilder): default trigger_mode threshold (#746)#750
robotrocketscience merged 4 commits into
mainfrom
feat/issue-746-rebuilder-default-threshold

Conversation

@robotrocketscience

Copy link
Copy Markdown
Owner

Closes #746.

What this PR does

Flips DEFAULT_TRIGGER_MODE in src/aelfrice/context_rebuilder.py from TRIGGER_MODE_MANUAL to TRIGGER_MODE_THRESHOLD. Fresh installs now experience the PreCompact augment-mode rebuild without configuration; opt-out remains available via [rebuilder] trigger_mode = "manual" in .aelfrice.toml.

Why now

Both bench gates referenced by the v1.4.0 ship-default conservatism note have closed:

The original manual default was explicitly framed as "until production telemetry confirms the calibrated threshold" — the telemetry is in, the threshold cleared, the gate exists to be flipped.

Commits (atomic)

  1. feat(rebuilder): default trigger_mode threshold (#746) — one-line constant flip + docstring rewrite citing feat(eval-harness): wire context-rebuilder eval harness for #587 hot-start scoring #592/eval-harness: Cohen's-κ judge calibration before #592 close #687 closure.
  2. test(rebuilder): default trigger_mode threshold (#746) — renames test_tm1_default_trigger_mode_is_manual_is_threshold, asserts threshold at both the constant and RebuilderConfig() default; adds new test_tm1_no_config_file_defaults_to_threshold exercising the user-visible promise (no TOML present → threshold); updates obsolete v1.4-vintage comments in test_hook_pre_compact.py that described threshold as opt-in.
  3. docs(rebuilder): default trigger_mode is threshold (#746)docs/context_rebuilder.md roadmap row + TOML example + mode descriptions reordered so threshold leads with gate-clearance history.
  4. docs(changelog): note rebuilder default trigger_mode flip (#746)[Unreleased] > Changed entry.

Acceptance coverage (#746 checklist)

  • DEFAULT_TRIGGER_MODE flipped to TRIGGER_MODE_THRESHOLD (context_rebuilder.py:197)
  • Docstring at context_rebuilder.py:198-209 updated to reflect gate clearance
  • Opt-out via [rebuilder] trigger_mode = "manual" verified working — existing test_tm1_manual_mode_pre_compact_hook_no_ops covers this path; the config-load + hook-dispatch paths already honor the override.
  • AELFRICE_NO_REBUILDER env override — checked: no such env var exists in the codebase (grep -rn 'AELFRICE_NO_REBUILDER\|NO_REBUILDER' returns nothing). TOML-based opt-out is the only opt-out and was already the documented surface. The acceptance bullet appears to be aspirational; not adding one in this PR since the issue body itself frames it as "decide whether to add one" and TOML opt-out is sufficient.
  • docs/context_rebuilder.md updated. README scan showed no remaining "opt-in via .aelfrice.toml" wording in the v3 revision, so no README change required.
  • CHANGELOG entry added under [Unreleased] > Changed.
  • Tests updated for new default.

Out of scope (per the issue body)

  • Suppress-mode (parked for v2.x).
  • Dynamic trigger-mode (parked at v1.4.0).
  • Token-budget recalibration (gated on captured production corpus).
  • Stop-hook cadence checkpoint (different design space).

Risk

  • Per-compaction token spend rises by the rebuild block size (~5-6 KB observed). CHANGELOG entry sets the expectation explicitly. For token-sensitive workflows the opt-out remains a one-line TOML write.
  • Calibration drift. threshold_fraction = 0.6 is fixture-bound. Users opting into custom calibration already have the override path ([rebuilder] threshold_fraction = X); this flip doesn't change that.

Test plan

  • uv run pytest tests/test_rebuilder_triggers.py tests/test_hook_pre_compact.py → 24 passed.
  • uv run pytest -q -x (full suite) → 3821 passed, 59 skipped, 75 xfailed.
  • Discretion grep on diff → clean.

Flip DEFAULT_TRIGGER_MODE from TRIGGER_MODE_MANUAL to TRIGGER_MODE_THRESHOLD.
PreCompact rebuilder is now default-on for fresh installs.

The v1.4.0 ship-default of 'manual' was conservative pending production
telemetry. Both bench gates have cleared:

- #592 (eval-harness commit-3): hot-start 100% at trigger_threshold <= 0.6,
  cold-start 75% across t in {0.5..0.8}, closed 2026-05-13.
- #687 (Cohen's-kappa multi-run validation): closed 2026-05-13.

Opt-out via [rebuilder] trigger_mode = "manual" in .aelfrice.toml. The
config-load and hook-dispatch paths already honor that override; no
plumbing changes required by this commit.
Update tests for the threshold-default flip in #746:

- test_tm1_default_trigger_mode_is_manual -> renamed
  test_tm1_default_trigger_mode_is_threshold; asserts threshold both at
  the constant and at RebuilderConfig() default.
- test_tm1_no_config_file_defaults_to_threshold: new test exercising the
  user-visible promise of #746 (fresh install with no .aelfrice.toml
  auto-fires). Belt + suspenders alongside the constant check.
- test_hook_pre_compact.py: clarify obsolete v1.4-vintage comments that
  said 'default is manual; opt in to threshold'. The opt-in TOML writes
  remain in the fixtures so the tests stay self-documenting and robust
  to any future default flip.

All 24 tests in test_rebuilder_triggers.py and test_hook_pre_compact.py
pass.
Surgical updates to docs/context_rebuilder.md for the #746 flip:

- Roadmap row: 'default manual' -> 'default threshold since #746'.
- TOML example: switch the example value from manual to threshold,
  rewrite the comment to lead with the new default and frame manual
  as the opt-out.
- Bullet annotations: '(default at v1.4.0)' on manual -> '(opt-out
  since #746)' with the augment-mode token-spend trade-off; threshold
  bullet gets '(default since #746; bench gates #592 + #687 cleared
  2026-05-13)' annotation while the rest of the line stays put.

README scan showed no remaining 'opt-in via .aelfrice.toml' wording in
the current revision, so no README change required.
Behavior change: PreCompact rebuilder fires by default on fresh
installs. Opt-out via [rebuilder] trigger_mode = "manual". Entry
under [Unreleased] > Changed; cites bench gates #592 and #687 which
both closed 2026-05-13 to clear the v1.4.0 conservative hold.
@robotrocketscience robotrocketscience added the author-Maxwell PR coordination mutex label May 13, 2026
@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@robotrocketscience has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 11 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fbb84fbc-7374-4294-94cf-a3b4401890aa

📥 Commits

Reviewing files that changed from the base of the PR and between bf288f5 and 77af4a4.

⛔ Files ignored due to path filters (1)
  • CHANGELOG.md is excluded by !**/CHANGELOG.md
📒 Files selected for processing (4)
  • docs/context_rebuilder.md
  • src/aelfrice/context_rebuilder.py
  • tests/test_hook_pre_compact.py
  • tests/test_rebuilder_triggers.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-746-rebuilder-default-threshold

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @robotrocketscience, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@robotrocketscience robotrocketscience added the attn:review Needs review (PR open, awaiting reviewer) label May 13, 2026
@github-actions

github-actions Bot commented May 13, 2026

Copy link
Copy Markdown

PR-size soft cap

This PR is over the advisory size threshold:

  • 88 changed lines (limit: 200)
  • 5 changed files (limit: 3)

Bigger PRs collide with more open work, which under the parallel-session workflow tends to produce repeated attn:merge-conflict cycles (see #602). When practical, split into smaller PRs that each touch a focused surface.

This is advisory only — nothing is blocked. If the size is intentional (large refactor, module removal, generated code), apply the size:override label and this comment will be removed on the next push.

@robotrocketscience

Copy link
Copy Markdown
Owner Author

[claim:review:curie:2026-05-13T21:26:12Z]

@robotrocketscience
robotrocketscience merged commit 77af4a4 into main May 13, 2026
26 of 28 checks passed
@robotrocketscience
robotrocketscience deleted the feat/issue-746-rebuilder-default-threshold branch May 13, 2026 21:27
@robotrocketscience

Copy link
Copy Markdown
Owner Author

[release:review:curie:2026-05-13T21:27:29Z]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

attn:review Needs review (PR open, awaiting reviewer) author-Maxwell PR coordination mutex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flip default: rebuilder trigger_mode manual → threshold — bench gates #592 + #687 cleared

1 participant