Skip to content

Feat/task memory evidence pipeline - #69

Merged
AnzoBenjamin merged 2 commits into
mainfrom
feat/task-memory-evidence-pipeline
Sep 1, 2026
Merged

Feat/task memory evidence pipeline#69
AnzoBenjamin merged 2 commits into
mainfrom
feat/task-memory-evidence-pipeline

Conversation

@AnzoBenjamin

@AnzoBenjamin AnzoBenjamin commented Sep 1, 2026

Copy link
Copy Markdown
Owner

This change is Reviewable

Compaction was only observable after the fact, so a pass that ran and reclaimed nothing left no trace and the request-time emergency trim was invisible entirely. The SDK now reports that trim through a new context_request_trim event and an optional onRequestContextTrimmed callback, and context_window carries the model-aware compaction trigger/target so the status bar can mark where compaction will fire. The CLI renders passes as typed compaction blocks with a terminal declined status, subagent labelling for nested passes, and trimSource 'request', collapsing consecutive declined passes of a run into one card and tracking live status per run via pendingRunIds so nested runs cannot cross-settle each other.

Separately, a passing validation/reviewer gate was being read as a stopping point mid-workflow. The base2 gate-pass finalization notice is now built per call and appends a soft continuation directive while declared write_todos work remains, and the DEFAULT / EXECUTE_PLAN step prompts say the same, without hard-blocking finalization.

All public surface additions are additive and optional: a new event variant, optional event fields, and an optional observational callback. Unknown event types remain no-ops, replayed events without the new fields still validate, and existing callers need no migration.

Validated: 184 agents/__tests__/base2.test.ts tests, 144 CLI tests (sdk-event-handlers, sweep-boxes, status-bar-chips), 58 agent-runtime/sdk tests (loop-agent-steps, llm-context-window); typechecks clean in cli, agents, packages/agent-runtime, sdk, common.
The reviewer-skip fast path required reviewedReviewableFingerprint to equal the current reviewable fingerprint, but that is a single slot overwritten on every gate pass: after an early wave reviewed one reviewable set and a later wave reviewed another, the scalar held only the later wave's fingerprint, so a cycle that re-armed on the unchanged earlier set re-spawned the reviewer even though a matching LOOKS_GOOD receipt for those exact bytes was still on file. The decision now reads the durable reviewReceipts ledger, matching a receipt on its gate-computed gateId, reviewer:expectedFingerprint, plus the reviewed file set. That match is strictly more specific than the scalar it replaces: same reviewer family, same file set, same bytes base2 itself hashed.

Two guards keep it fail closed. The current reviewable fingerprint must be attestable, so the stable unreadable:no-crypto marker, under which two unrelated snapshots compare equal, can never grant a skip. And the reviewer-REPORTED snapshotFingerprint on a receipt is deliberately not read as content evidence, because the attestation path drift-tolerates it; only the fingerprint base2 computed for that review may buy a skip.

reviewedReviewableFingerprint is soft-deprecated rather than removed. It is now write-only with no production reader, documented with an explicit reader inventory and a three-step removal path, and still written so state serialized by this base2 round-trips unchanged for older readers.

Separately, a gate that passes while declared work remains was only discouraged in prose. The gate-state block gained an optional workflow key carrying completedCount, totalCount, and nextWorkflowAction, emitted on the three gate-PASS paths and only when declared write_todos work actually remains. base2's boundWorkflowProgress bounds the action to 240 sanitized chars and omits the key whole otherwise, and the CLI's parseGateStateWorkflow re-enforces every bound independently because it also parses hand-authored assistant text. The key is additive and optional, so no consumer migration is required and blocks persisted before it existed replay unchanged. It is observability only: no gate phase, finalization decision, or follow-up permission reads it. The published schema enumeration is now in step across the producer comment, GateStateContentBlock, the parseGateStateBlock docblock, GateStateBox, and cli/knowledge.md.

Test-only fixes: makeProjectTempDir ensures the shared .base2-test-scratch root at use time, because the e2e files' afterAll can remove it between module load and use, and boundWorkflowProgress uses a type alias so both annotations stay bracket-free, since extractInlineFunctionSource cannot parse a return annotation opening with a leading union pipe. common/knowledge.md documents the context_request_trim event, the optional compactionTriggerTokens and compactionTargetTokens on context_window, and the onRequestContextTrimmed callback from the preceding commit, which the memory-drift staleness guard required.

Validated: agents unit and e2e 1120 pass / 0 fail; CLI message-block-helpers and gate-state-box 168 pass / 0 fail; repo-wide, cli, and agents typechecks clean; guard:memory-drift reports 0 findings across 12 checkers; the runtime validation/reviewer gate passed with LOOKS_GOOD.
@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openbuff Ready Ready Preview, v0 Sep 1, 2026 5:19pm UTC

@AnzoBenjamin
AnzoBenjamin merged commit fc1c720 into main Sep 1, 2026
16 checks passed
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