Skip to content

fix(context): protect human anchors and recover current reminders - #39

Draft
Brian Krabach (bkrabach) wants to merge 1 commit into
mainfrom
fix/first-human-protection
Draft

Brian Krabach (bkrabach) wants to merge 1 commit into
mainfrom
fix/first-human-protection

Conversation

@bkrabach

Copy link
Copy Markdown
Collaborator

Problem

Compaction treated persisted ephemeral reminders as ordinary user anchors. A reminder could therefore displace the actual first/last human request, and a reminder re-emitted for the current turn could be absent after compaction.

Change

  • Select first and last human user anchors using trusted persisted-reminder metadata, not reminder text or the user role alone. The level-8 extreme-compaction fallback retains its established legacy behavior.
  • Add an optional, budgeted request-overlay API. When a required trusted reminder is not fully visible, it is restored once at its current pre_user or tail placement for that request only. Canonical history is not duplicated; unsafe placement or an insufficient budget fails visibly.
  • The existing no-recovery request path is unchanged. This introduces no blanket pinning, configuration, or lifetime framework.

This context PR independently fixes first-human protection. The overlay API is intentionally present for its companion loop consumer, which remains local and unpublished until this upstream context change is merged; this PR does not claim both changes have shipped.

Verification

  • Local unit suites on the existing locks with DTU core 1.6.1: context 146 passed, 1 expected xfailed; loop companion 277 passed.
  • Paired baseline-fail/candidate-pass L5 test using the same 32 × 70k synthetic-assistant stress: first human preserved; current reminder exact-once; canonical reminder count one. Also covered current and bundled-system controls, tail expiry, SET_MESSAGES restore/dedup (not full-click resume), and A→B→A supersession.
  • Component provider checks (not a full CLI/all-bundle-hooks run): Terra 2/2 returned the marker exactly with policy once on the wire and canonical count one. Sonnet real HTTP accepted policy once with canonical count one and unchanged settings, but 1/1 did not return the exact marker. Only hashes and lengths of returned text were retained, so the cause is unknown; source review confirms this is not a thinking-block parsing issue.
  • An earlier Sonnet 400 against a long synthetic-filler fixture is a separate test-limit observation, not a reproduced production 400.

Outstanding gates

  • Draft / not merge-ready: investigate the Sonnet behavioral failure before merge. Green CI would not resolve this gate.
  • No new full benchmark or weakened assertion is proposed to bypass it.
  • The companion loop commit stays local and unpublished pending upstream merge order.

Generated with Amplifier

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants