Repository navigation
Description
Part of #292.
Problem
Six evidence emit paths call record(ev, fields, false) without threading the calling session's sid, so captureEvidenceContext() falls back to the ambient getCurrent().sid (src/evidence/record.ts:90) and the line's repo=/repoPath= stamp comes from whichever session's hook ran last. The stamp drives read partitioning: evidenceVisibleTo (src/store/model/visibility.ts:150-159) shows a stamped line strictly by repo match, so a misstamped line is visible to the wrong repo's memory_evidence and invisible to its owner. The call sites all hold the authoritative sid already and do not pass it:
src/tools/decay.ts:36(decay_dry_run),:74(decay_appliedpartial),:92(decay_applied)src/tools/consolidate.ts:39(consolidate_propose)src/inject/digest.ts:90(frontier_injected)src/inject/epochs.ts:254(epoch_recompute)
This is the residue of the same family #118/#127/#133/#135 fixed: the comment in captureEvidenceContext (src/evidence/record.ts:94-101) states the rule — a named session is stamped from its OWN resolved scope, never the ambient — and gate-authored lines were threaded then; these tool/inject paths were not. recordCaptureLag (src/evidence/record.ts:157-183) shows the intended shape: pass the session as the 4th argument.
Fix direction
Pass the in-scope sid as record()'s 4th argument at the six sites above. With includeContext=false the line keeps dropping sid/call fields but the repo stamp resolves through sessionScope(sid); a named-unresolved session then writes an unstamped private line, which is the documented correct outcome. Add a pin test driving the real call sites (pattern: test/gate-evidence-attribution.test.ts uses setCurrent/rememberSessionDir/readEvidenceLog): bind sessions A and B to different repo dirs, set the ambient current to B, run the decay dry-run path for session A, and assert the emitted line's repo= is A's key.
Acceptance
RED: on main 7405dc61d919e7eee7033dea6e4324eda58ee669, a test that sets the ambient current to session B (repo B) and executes the memory_decay dry run for session A (repo A) reads back an evidence line stamped repo=<B-key> — the test fails.
GREEN: bun run test passes; the line is stamped repo=<A-key>; the same assertion holds for consolidate_propose, frontier_injected and epoch_recompute (each driven with a mismatched ambient current).
Activity
WhollyMindless commentedon Nov 4, 2026
Claiming this at WhollyMindless's request. I'll thread the calling session through the six evidence emit sites and add regressions that exercise the real decay, consolidation, frontier and epoch paths with a different ambient session. I'll post a separate PR for review. Please feel free to defer or reject it if you prefer another direction; I won't change the agent labels.
abogartz-opencode-self-improvement commentedon Nov 5, 2026
🎉 This issue has been resolved in version 0.15.37 🎉
The release is available on:
Your semantic-release bot 📦🚀