3.3 KiB
3.3 KiB
T1.5 — Context partition capture
| Field | Value |
|---|---|
| Phase | P1 — Walking skeleton |
| Size | S — under 1 day |
| Status | Not started |
| Flags | — |
| Spec | inlined below |
| Blocks | — |
Goal
Record, per model step, which context was packed, which was available but not packed, and which was dropped — as identifiers.
Facts (inlined — no spec read needed)
- Three buckets: packed, available-not-packed, dropped.
- They hold identifiers, not text. That keeps them small enough to inline in the attempt view rather than going by blob reference, which is what lets a verifier read them without paying for prompt text.
- This is the signal behind "retried three times because context was missing X" — the thing a pass rate cannot see and a learning loop needs.
- It is not derivable after the fact from the conversation. If it is not captured at pack time it is gone, which is why its absence is a test failure rather than a gap.
Steps
- Define
ContextPartition { packed: Vec<ContextItemId>, available: Vec<ContextItemId>, dropped: Vec<ContextItemId> }. Ordered collections, so serialization is stable. - Capture at the point the prompt is assembled — the packer already knows all three sets; recording them costs a clone of id vectors.
- Attach the partition to the attempt record and emit it in the same
EventLog::commitas the rest of the attempt transition. - Surface it on
AttemptView.context: Option<ContextPartition>for verifiers (T4.2) and graders. - Test: assert every model-step attempt in a completed run carries a partition;
a missing one fails the test rather than being tolerated as
None.
Acceptance
- Partition present on every model step.
- Not derivable from the conversation, so its absence is a test failure.
Verify
Harness: a workflow with a packer configured to drop known items, so the expected partition is known in advance.
Integration test — tests/it_context_partition.rs:
- Configure the packer with 10 candidate context items and a budget admitting 6.
- Run a model step.
- Assert the recorded partition has
packed.len() == 6,available+droppedcovering the remaining 4, and that the three sets are disjoint and their union is the full candidate set. - Assert
droppedis non-empty — a capture that only ever recordspackedis the common half-implementation and passes any "partition present" check. - Iterate every model-step attempt in a completed multi-step run; assert
context.is_some()for each. ANonefails the test. - Assert the partition survives
assert_refold_identical.
Command: cargo test -p executor context_partition
False pass:
- Asserting only
context.is_some(). An empty partition isSome. Step 3's set arithmetic is the real check. - Testing on a workflow whose budget admits everything, so
droppedis legitimately empty and step 4 cannot fail.
Traps
- Storing the packed context text here. It belongs in the prompt blob (T1.6); inlining text blows broker payload limits and penalizes verifiers that need none of it.
- Capturing only
packed. The interesting signal is usually indropped.
Background (not required to do this task): rust-agentic-sys.md §10.1 · rust-agentic-task.md