Feat/task memory evidence pipeline - #69
Merged
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change is