Repository navigation
fix: retain operation attribution in lifecycle evidence - #202
Conversation
abogartz
left a comment
There was a problem hiding this comment.
Verdict: APPROVE (one non-blocking nit, N1 below)
Adversarial review at head 258be21 (base bf9f4d2). Issue #199 is the scope boundary recorded in the #189 approval; this PR makes the policy call #199 asked for (lifecycle records follow operation-entry attribution) and satisfies its acceptance list one-for-one: deterministic mid-async moves, memory_evidence reads from both repos, named-unresolved privacy preserved, intentional suppression preserved, ambient behavior preserved, scrubbing untouched, no cross-operation call-ID borrowing, and the README now documents the chosen trail instead of pointing at #199.
Body claims checked against the tree
- Shared captured owner:
record()now resolves attribution via the captured context when one is provided, and never re-resolves per event (src/evidence.ts:105).runInitcaptures in its third line, before the firstawait(src/init.ts:213) — so the tests' "suspended at first await" premise is deterministic, not a race I had to statistically win. All three init records pass the snapshot. In the capture path,gateContext(sid)sits incaptureSession's synchronous prefix (aftersetCurrent/bindSessionProvisional, both sync), and every capture record — refused/partial/promoted/audit — threadscaptureGate.evidenceContext, includingrecordCaptureLag's new parameter. {sid}-only privacy arm (src/evidence.ts:111): fires only when a context was captured, scope is null, and the owner is a named session other than the ambient?. Resolved captures stay fully suppressed; context-less legacy callers are untouched (no context ⇒ unchanged empty). Credential scrubbing remains the last spread, so it still wins at the boundary.- "Snapshot remains unresolved even if the session later binds" — pinned by construction: the unresolved init arm rebinds the owner to B after capture and asserts the line carries no repo but
sid=owner, visible to that session and invisible from B's reader. - Scope honesty: viewer audit attribution and disposal-cancellation are genuinely not claimed; ambient/runtime telemetry (
epoch_recompute,decay_*,store_lock) still resolves per event, consistent with the stated boundary.
Verification (macOS, Bun 1.4.3; Windows leg via CI)
- Red/green measured: all six regression tests fail on unchanged base
bf9f4d2(incl. the privacy-label assertion, where the base line visibly lackssid=) and 6/6 pass at head. - Full gate at head: unit 835 pass / 11 skip / 0 fail (= base 829/11/0 + your 6), e2e 11/0, typecheck clean.
- Lint: gate command
biome lintis identical base vs head (408 warnings, 128 infos, exit 0). FYI,biome checkreports two format diffs in the edited hunks ofsrc/evidence.ts/src/init.ts— the repo gate and CI lint leg don't run format, so this matches existing repo state; runbiome formaton the two files if you want them tidy. - CI on
258be21: lint / test / smoke / test-windows all green;mergeStateStatus CLEAN.
N1 (nit, not blocking)
The no-target auto_capture_refused (src/index.ts:1552, the #152 pre-model bail when the instance has no workspace) now also receives the captured context, but no test exercises it — the refusal arm of test 2 pins the :1595 write-failure variant. The one-liner is the same pattern and fails safe, but it's the one changed call site living purely on the body's word. A capture against an instance with no workspace, or folded into the existing test 2 shape, would close it.
Not merging — the user merges by hand.
|
🎉 This PR is included in version 0.15.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Fixes #199. A session move during init or capture could leave gate evidence in the starting repository and lifecycle records in another repository. Init start/complete/skip, capture outcomes/refusals/partial receipts, and capture lag now share the gate operation's captured entry-time attribution.
Resolved operations keep lifecycle session/call metadata suppressed. A captured named-but-unresolved owner retains only its
sidprivacy label even when call metadata is suppressed: without either a repository stamp or that owner label, the evidence reader treats a line as legacy/global. The snapshot remains unresolved even if the session later binds. Ambient maintenance retains its captured process scope, and credential scrubbing remains at the evidence boundary.Six regression tests exercise resolved, unresolved, and ambient init; a parked model call followed by a session move for capture promotion and refusal; real
memory_evidencereads from both repositories; init skip; and suppressed unresolved evidence with a credential-shaped reason. All six fail against unchanged mainbf9f4d2and pass with the change. The refusal case uses a synthetic gate exception to isolate lifecycle attribution; existing lock/partial-write tests cover the real storage refusal behavior.Windows / Bun 1.4.4 full gate passes: typecheck, lint (408 advisory warnings), 835 unit/scenario tests (11 skips) and 11 real-host E2E tests.
Scope: evidence ownership only. Viewer audit attribution, cancellation of in-flight capture at disposal, and the other findings from the concurrent reviews remain separate. This does not claim new live-host session-move verification or change durable row ownership.
Please feel free to decline or close this if per-event lifecycle attribution is intentional or you prefer another policy for the project.