Skip to content

fix(context): provider-safe assembly after history trim (supersedes #55) - #62

Merged
jordanauge merged 1 commit into
mainfrom
feat/kernel-outbound-wait-assembly
Sep 11, 2026
Merged

jordanauge merged 1 commit into
mainfrom
feat/kernel-outbound-wait-assembly

Conversation

@jordanauge

@jordanauge jordanauge commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Problem

When conversation history is trimmed (max_messages, sliding window, or token budget), cuts can land between an assistant tool-call message and its tool result. Bedrock and similar APIs reject that payload.

Supersedes #55 with a different layering: repair at assembly instead of shape-aware trimmers.

Changes

  • Repair committed history at assembly via sanitize_provider_messages
  • Pin in-turn working memory with token-budget pin_tail
  • Add per-session kernel outbound-waits ledger (MODEL / TOOL / HITL)
  • Fix assembler to retain tool messages and skip live-turn sanitize
  • Fix pre-existing driver.py lint; add AGENTS.md zero-tolerance rule for open failures

Rationale

  1. Trimming strategies stay position-based — no tool-shape coupling.
  2. Provider invariants enforced once at the assembly boundary.
  3. In-turn working memory is never split by token budget mid-ReAct.
  4. Regression tests cover PR fix: keep tool_calls/tool_result pairs when trimming conversation #55 failure modes (stack orphans, sliding splits, token budgets).

Test plan

Tracking: cisco-eti/ioc-core-mas-lab#46

- Repair committed history at assembly via sanitize_provider_messages
- Pin in-turn working memory with token-budget pin_tail
- Add per-session kernel outbound-waits ledger (MODEL/TOOL/HITL)
- Fix assembler to retain tool messages and skip live-turn sanitize
- Fix pre-existing driver.py lint issues; document zero-tolerance for failures in AGENTS.md

Signed-off-by: Jordan Augé <augjorda@cisco.com>
@jordanauge
jordanauge force-pushed the feat/kernel-outbound-wait-assembly branch from c16cbfc to ee54f43 Compare September 11, 2026 12:13
@jordanauge
jordanauge merged commit 247131e into main Sep 11, 2026
3 checks passed
@jordanauge
jordanauge deleted the feat/kernel-outbound-wait-assembly branch September 11, 2026 12:19
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.

1 participant