opencode-self-improvement 0.15.36 → 0.15.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/package.json +1 -1
- package/src/evidence/record.ts +25 -0
- package/src/inject/digest.ts +6 -1
- package/src/inject/epochs.ts +4 -1
- package/src/status/write.ts +34 -2
- package/src/tools/consolidate.ts +4 -1
- package/src/tools/decay.ts +8 -1
- package/src/tools/status-tool.ts +2 -2
- package/src/tui/panel.tsx +18 -2
- package/src/viewer/mutate.ts +49 -3
package/README.md
CHANGED
|
@@ -206,6 +206,7 @@ STORE
|
|
|
206
206
|
- **No prompt content is stored.** The ledger keeps a scan-truncated string from the *memory* side, never your message.
|
|
207
207
|
- **Reinforcement is a tie-break only** (`useBoost ≤ 1.0`): a recently used row wins a tie and can never outrank a real score gap. In consolidation the most recently used member of a cluster is never the merge loser.
|
|
208
208
|
- **`never retrieved` is stated, not acted on.** Pruning is your decision. Retired rows cannot inherit reinforcement: ledger rows are verified against the store on read.
|
|
209
|
+
- **Aggregate STORE counts are machine-wide by decision (#213 B).** They count every repository's rows in the shared store on this machine, never just the reading session's repository — the numbers describe the store, not your slice of it. Privacy applies to the content surfaces instead: `memory_evidence` and the recent-blocked-writes list in `memory_status` and `/memory` follow each reader's repository visibility (#306).
|
|
209
210
|
- **Capture lag** is how stale the newest message was when auto-capture fired. The line prints only when at least one `capture_lag` sample exists, which needs auto-capture to have fired — see [Auto-capture is experimental](#auto-capture-is-experimental).
|
|
210
211
|
|
|
211
212
|
## Consolidation
|
|
@@ -351,6 +352,8 @@ The output is a canonical mutation score — killed over total, with equivalent
|
|
|
351
352
|
|
|
352
353
|
Run it when you want to know whether the suite still has teeth — after changing tests or coverage, or as a pre-release gate with `bun scripts/test-sweep.ts --fail-on-survivors`, which exits 4 when anything survives. Two cheaper checks come first: `bun scripts/test-sweep.ts --validate` confirms every mutation pattern still lands on exactly one source site without running the suite, and `bun scripts/test-sweep.ts --selftest` plants a mutation in a trivially-tested pure function and fails unless the suite kills it — proof the instrument itself can go red.
|
|
353
354
|
|
|
355
|
+
**Pre-release ritual (decided 2026-11-04, #72):** before pushing a release commit, a human runs `--validate`, then `--selftest`, then `--fail-on-survivors`, and records the mutation score and the survivor list in `bench/RESULTS.md` beside the published evidence. Cadence is pre-release only, run by a person: the sweep is a full suite per mutant and never belongs in CI, where it would cost more than it informs. Survivors become entries on the unpinned-invariant list, not red checks.
|
|
356
|
+
|
|
354
357
|
## Troubleshooting
|
|
355
358
|
|
|
356
359
|
| Problem | Fix |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-self-improvement",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.38",
|
|
4
4
|
"description": "Durable memory for opencode: remember facts, decisions, and commands across sessions, plus a one-command per-repo setup (/repo-init).",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"exports": {
|
package/src/evidence/record.ts
CHANGED
|
@@ -111,6 +111,31 @@ export function captureEvidenceContext(sessionID?: string): EvidenceContext {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
// #305: evidence ABOUT a specific row inherits the ROW's repository, not the
|
|
115
|
+
// writing process's. The viewer is an admin entry point with no repository of
|
|
116
|
+
// its own, so its ambient context stamps nothing — and evidenceVisibleTo
|
|
117
|
+
// reads an unstamped, sid-less line as GLOBAL. Without this, editing or
|
|
118
|
+
// deleting another repository's private row from the viewer exposed the
|
|
119
|
+
// operator's reason and row ids to every other repository's memory_evidence.
|
|
120
|
+
// Callers that hold the target row spread these fields into record(): a
|
|
121
|
+
// private stamp is carried verbatim; a global (or legacy unstamped) target
|
|
122
|
+
// becomes an explicit `repo=global` line — same visibility as before, now
|
|
123
|
+
// honest on the line itself. The fields spread last in record(), so they
|
|
124
|
+
// outrank any ambient stamp even in a process that loaded a plugin. The
|
|
125
|
+
// global branch returns an EXPLICIT `repoPath: undefined` (N1 on #308): the
|
|
126
|
+
// spread must also clear an ambient repoPath, or a shared process that
|
|
127
|
+
// happens to hold repo B's scope would leave B's path on a globally readable
|
|
128
|
+
// line about a global row. formatLine drops undefined values, so the key
|
|
129
|
+
// never lands on disk — it only cancels the ambient one in the merge.
|
|
130
|
+
export function targetRepoFields(target: {
|
|
131
|
+
repo?: string;
|
|
132
|
+
repoPath?: string;
|
|
133
|
+
}): { repo: string; repoPath?: string } {
|
|
134
|
+
return target.repo && target.repo !== "global"
|
|
135
|
+
? { repo: target.repo, repoPath: target.repoPath }
|
|
136
|
+
: { repo: "global", repoPath: undefined };
|
|
137
|
+
}
|
|
138
|
+
|
|
114
139
|
export async function record(
|
|
115
140
|
ev: EvidenceEvent,
|
|
116
141
|
fields: Record<string, unknown> = {},
|
package/src/inject/digest.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { loadAll } from "../store/files/load.ts";
|
|
|
3
3
|
import { type Memory } from "../store/model/memory.ts";
|
|
4
4
|
import { isInjectable } from "../store/model/predicates.ts";
|
|
5
5
|
import { readerFromSid, visibleTo } from "../store/model/visibility.ts";
|
|
6
|
-
import { record } from "../evidence/record.ts";
|
|
6
|
+
import { captureEvidenceContext, record } from "../evidence/record.ts";
|
|
7
7
|
import { frontierBudget } from "../core/config/budgets.ts";
|
|
8
8
|
import { SESSION_CAP, SessionLru } from "../core/lru.ts";
|
|
9
9
|
import { dateStr } from "../core/time.ts";
|
|
@@ -45,6 +45,9 @@ export async function systemDigest(
|
|
|
45
45
|
typeof (_input as Record<string, unknown>).sessionID === "string"
|
|
46
46
|
? String((_input as Record<string, unknown>).sessionID)
|
|
47
47
|
: "?";
|
|
48
|
+
// Snapshot before any awaits; unresolved callers still need a private sid
|
|
49
|
+
// on their evidence even when ordinary call metadata is suppressed (#297).
|
|
50
|
+
const evidenceContext = captureEvidenceContext(sid);
|
|
48
51
|
// Repo-scoped: model-facing reads see the CALLER's repo + global rows, via
|
|
49
52
|
// the sid carried on this flow's input (#127) — never a global re-read
|
|
50
53
|
// after the loadAll await.
|
|
@@ -101,5 +104,7 @@ export async function systemDigest(
|
|
|
101
104
|
ts_since: dateStr(),
|
|
102
105
|
},
|
|
103
106
|
false,
|
|
107
|
+
sid,
|
|
108
|
+
evidenceContext,
|
|
104
109
|
);
|
|
105
110
|
}
|
package/src/inject/epochs.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { type Memory } from "../store/model/memory.ts";
|
|
|
5
5
|
import { isInjectable } from "../store/model/predicates.ts";
|
|
6
6
|
import { isVisibleTo, readerFromSid } from "../store/model/visibility.ts";
|
|
7
7
|
import { SESSION_CAP, SessionLru } from "../core/lru.ts";
|
|
8
|
-
import { record } from "../evidence/record.ts";
|
|
8
|
+
import { captureEvidenceContext, record } from "../evidence/record.ts";
|
|
9
9
|
import { capToBudget, injectedRows } from "./budget.ts";
|
|
10
10
|
import { systemDigest } from "./digest.ts";
|
|
11
11
|
import { storeVersion } from "./version.ts";
|
|
@@ -186,6 +186,7 @@ export function createInjectionEpochs({
|
|
|
186
186
|
};
|
|
187
187
|
const refreshEpoch = async (sid: string, rows?: Memory[]): Promise<void> => {
|
|
188
188
|
if (!latestPrompt.has(sid)) return;
|
|
189
|
+
const evidenceContext = captureEvidenceContext(sid);
|
|
189
190
|
const mems = rows ?? (await injectableRows(sid));
|
|
190
191
|
const version = await storeVersion(mems);
|
|
191
192
|
const cached = epoch.get(sid);
|
|
@@ -259,6 +260,8 @@ export function createInjectionEpochs({
|
|
|
259
260
|
chars: built.block.length,
|
|
260
261
|
},
|
|
261
262
|
false,
|
|
263
|
+
sid,
|
|
264
|
+
evidenceContext,
|
|
262
265
|
);
|
|
263
266
|
epochRecomputes++;
|
|
264
267
|
// Ledger: a store_changed recompute of a live epoch is an
|
package/src/status/write.ts
CHANGED
|
@@ -19,6 +19,12 @@ import { evidenceDir, memoryRoot } from "../core/config/paths.ts";
|
|
|
19
19
|
import { dateStr } from "../core/time.ts";
|
|
20
20
|
import { parseLine } from "../core/logfmt/format.ts";
|
|
21
21
|
import { readLines } from "../core/logfmt/read.ts";
|
|
22
|
+
import { resolveRepo } from "../identity/repokey.ts";
|
|
23
|
+
import {
|
|
24
|
+
ADMIN_READER,
|
|
25
|
+
evidenceVisibleTo,
|
|
26
|
+
type Reader,
|
|
27
|
+
} from "../store/model/visibility.ts";
|
|
22
28
|
import {
|
|
23
29
|
type BlockedRow,
|
|
24
30
|
SESSION_FILE_CAP,
|
|
@@ -100,8 +106,17 @@ export async function readStatus(
|
|
|
100
106
|
}
|
|
101
107
|
|
|
102
108
|
// Newest-first last `limit` write_blocked evidence rows, scanning today and
|
|
103
|
-
// yesterday so a block just before midnight stays visible.
|
|
104
|
-
|
|
109
|
+
// yesterday so a block just before midnight stays visible. #306 (decision #213
|
|
110
|
+
// B): the lines follow the SAME visibility rule as memory_evidence — a row
|
|
111
|
+
// stamped to another repository, or private to a named session, is not this
|
|
112
|
+
// surface's data. The default is the historical unfiltered read (ADMIN_READER)
|
|
113
|
+
// for out-of-plugin callers; every plugin-facing surface must pass its own
|
|
114
|
+
// Reader, exactly like the quarantine list beside it in the same report.
|
|
115
|
+
export async function blockedRecent(
|
|
116
|
+
limit = 6,
|
|
117
|
+
reader: Reader = ADMIN_READER,
|
|
118
|
+
callerSid?: unknown,
|
|
119
|
+
): Promise<BlockedRow[]> {
|
|
105
120
|
try {
|
|
106
121
|
const today = dateStr();
|
|
107
122
|
const yesterday = new Date(Date.now() - 86_400_000)
|
|
@@ -114,6 +129,7 @@ export async function blockedRecent(limit = 6): Promise<BlockedRow[]> {
|
|
|
114
129
|
)) {
|
|
115
130
|
const f = parseLine(line);
|
|
116
131
|
if (!f || f.ev !== "write_blocked") continue;
|
|
132
|
+
if (!evidenceVisibleTo(f, reader, callerSid)) continue;
|
|
117
133
|
rows.push({
|
|
118
134
|
ts: String(f.ts ?? day),
|
|
119
135
|
sid: String(f.sid ?? "?"),
|
|
@@ -126,3 +142,19 @@ export async function blockedRecent(limit = 6): Promise<BlockedRow[]> {
|
|
|
126
142
|
return []; // A refused root is no status data, not an unhandled panel refresh.
|
|
127
143
|
}
|
|
128
144
|
}
|
|
145
|
+
|
|
146
|
+
// #306: the Reader for the terminal panel. The TUI process owns no
|
|
147
|
+
// session→repo map (the server binds sessions in its own process), so the
|
|
148
|
+
// panel resolves the ACTIVE session's repository from its root directory —
|
|
149
|
+
// resolveRepo is deterministic for the same path on this machine, hence the
|
|
150
|
+
// same key the server stamped the evidence line with. An absent or
|
|
151
|
+
// unresolvable root fails closed to global-only, exactly like
|
|
152
|
+
// readerForSession: unknown is never everything.
|
|
153
|
+
export function blockedReaderFor(rootDir?: string): Reader {
|
|
154
|
+
if (!rootDir) return { kind: "global-only" };
|
|
155
|
+
try {
|
|
156
|
+
return { kind: "repo", scope: resolveRepo(rootDir) };
|
|
157
|
+
} catch {
|
|
158
|
+
return { kind: "global-only" };
|
|
159
|
+
}
|
|
160
|
+
}
|
package/src/tools/consolidate.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { ToolRegister } from "./deps.ts";
|
|
5
5
|
import { proposeConsolidations } from "../consolidate/propose.ts";
|
|
6
6
|
import { renderProposals } from "../consolidate/render.ts";
|
|
7
|
-
import { record } from "../evidence/record.ts";
|
|
7
|
+
import { captureEvidenceContext, record } from "../evidence/record.ts";
|
|
8
8
|
import { readLedger, readReads } from "../hits/ledger.ts";
|
|
9
9
|
import { loadAll } from "../store/files/load.ts";
|
|
10
10
|
import { isInjectable } from "../store/model/predicates.ts";
|
|
@@ -21,6 +21,7 @@ export const register: ToolRegister = (editor, deps) => {
|
|
|
21
21
|
options: direct,
|
|
22
22
|
async execute(args, context): Promise<{ content: string }> {
|
|
23
23
|
const { sid } = toolIds(context);
|
|
24
|
+
const evidenceContext = captureEvidenceContext(sid);
|
|
24
25
|
const reader = readerFromSid(sid);
|
|
25
26
|
const all = (await loadAll())
|
|
26
27
|
.filter(isInjectable)
|
|
@@ -44,6 +45,8 @@ export const register: ToolRegister = (editor, deps) => {
|
|
|
44
45
|
would_drop: report.rowsBefore - report.rowsAfter,
|
|
45
46
|
},
|
|
46
47
|
false,
|
|
48
|
+
sid,
|
|
49
|
+
evidenceContext,
|
|
47
50
|
);
|
|
48
51
|
return { content: out };
|
|
49
52
|
},
|
package/src/tools/decay.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// and handler are byte-identical to the pre-split source; closure access arrives
|
|
3
3
|
// through ToolDeps.
|
|
4
4
|
import type { ToolRegister } from "./deps.ts";
|
|
5
|
-
import { record } from "../evidence/record.ts";
|
|
5
|
+
import { captureEvidenceContext, record } from "../evidence/record.ts";
|
|
6
6
|
import { snapshotFiles } from "../store/files/snapshots.ts";
|
|
7
7
|
import { markManySuperseded } from "../store/files/supersede.ts";
|
|
8
8
|
import { findStaleOpen } from "../portable/decay.ts";
|
|
@@ -19,6 +19,7 @@ export const register: ToolRegister = (editor, deps) => {
|
|
|
19
19
|
options: direct,
|
|
20
20
|
async execute(args, context): Promise<{ content: string }> {
|
|
21
21
|
const { sid } = toolIds(context);
|
|
22
|
+
const evidenceContext = captureEvidenceContext(sid);
|
|
22
23
|
const days =
|
|
23
24
|
Number(args.olderThanDays) > 0 ? Number(args.olderThanDays) : 14;
|
|
24
25
|
const dryRun = args.dryRun !== false; // only an explicit false mutates
|
|
@@ -41,6 +42,8 @@ export const register: ToolRegister = (editor, deps) => {
|
|
|
41
42
|
mem: stale.map((m) => m.ts).join(","),
|
|
42
43
|
},
|
|
43
44
|
false,
|
|
45
|
+
sid,
|
|
46
|
+
evidenceContext,
|
|
44
47
|
);
|
|
45
48
|
return {
|
|
46
49
|
content:
|
|
@@ -82,6 +85,8 @@ export const register: ToolRegister = (editor, deps) => {
|
|
|
82
85
|
error: why,
|
|
83
86
|
},
|
|
84
87
|
false,
|
|
88
|
+
sid,
|
|
89
|
+
evidenceContext,
|
|
85
90
|
).catch((audit) => {
|
|
86
91
|
why += `; audit failed: ${String(audit)}`;
|
|
87
92
|
});
|
|
@@ -98,6 +103,8 @@ export const register: ToolRegister = (editor, deps) => {
|
|
|
98
103
|
snapshot: snapshot.join(",") || "-",
|
|
99
104
|
},
|
|
100
105
|
false,
|
|
106
|
+
sid,
|
|
107
|
+
evidenceContext,
|
|
101
108
|
);
|
|
102
109
|
return {
|
|
103
110
|
content:
|
package/src/tools/status-tool.ts
CHANGED
|
@@ -26,7 +26,7 @@ export const register: ToolRegister = (editor, deps) => {
|
|
|
26
26
|
validated(EmptyArgs, {
|
|
27
27
|
name: "memory_status",
|
|
28
28
|
description:
|
|
29
|
-
"Plain-text memory report for chat clients (desktop/web/IDE), same sections as the terminal /memory panel: CONTEXT (this session's injected block, budget use, cumulative ride and abstentions), CACHE (plain-language cache receipts: bust count, and the provider-reported share of prompt tokens served from cache — the proof that memory never mutates your prefix), the block verbatim, recent blocked writes with gate reasons, and store stats. Reads only — no model call.",
|
|
29
|
+
"Plain-text memory report for chat clients (desktop/web/IDE), same sections as the terminal /memory panel: CONTEXT (this session's injected block, budget use, cumulative ride and abstentions), CACHE (plain-language cache receipts: bust count, and the provider-reported share of prompt tokens served from cache — the proof that memory never mutates your prefix), the block verbatim, recent blocked writes with gate reasons (filtered to this reader's evidence visibility, #306), and store stats. Aggregate STORE counts are machine-wide — they count every repository's rows by decision (#213 B), not this reader's. Reads only — no model call.",
|
|
30
30
|
options: direct,
|
|
31
31
|
async execute(_args, context): Promise<{ content: string }> {
|
|
32
32
|
// In-process truth: the live epoch + ledger, fresher than any file.
|
|
@@ -61,7 +61,7 @@ export const register: ToolRegister = (editor, deps) => {
|
|
|
61
61
|
content: renderMemoryReport({
|
|
62
62
|
status,
|
|
63
63
|
store,
|
|
64
|
-
blocked: await blockedRecent(6),
|
|
64
|
+
blocked: await blockedRecent(6, reportReader, sid),
|
|
65
65
|
quarantined: act
|
|
66
66
|
.filter((m) => isVisibleTo(m, reportReader) && isQuarantined(m))
|
|
67
67
|
.map((m) => ({ ts: m.ts, patterns: quarantineReasons(m) })),
|
package/src/tui/panel.tsx
CHANGED
|
@@ -23,7 +23,12 @@ import {
|
|
|
23
23
|
contextLines,
|
|
24
24
|
windowLines,
|
|
25
25
|
} from "../status/report.ts";
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
blockedReaderFor,
|
|
28
|
+
blockedRecent,
|
|
29
|
+
readStatus,
|
|
30
|
+
statusDir,
|
|
31
|
+
} from "../status/write.ts";
|
|
27
32
|
|
|
28
33
|
const PANEL = "self-improvement.memory";
|
|
29
34
|
const POLL_MS = 5000;
|
|
@@ -80,7 +85,18 @@ export default Plugin.define({
|
|
|
80
85
|
const refresh = async (sid?: string): Promise<void> => {
|
|
81
86
|
if (sid !== undefined) activeSid = sid;
|
|
82
87
|
setStatus(await readStatus(activeSid));
|
|
83
|
-
|
|
88
|
+
// #306: the blocked list follows evidence visibility. The terminal
|
|
89
|
+
// process owns no session→repo map (the server binds sessions in its
|
|
90
|
+
// own process), so resolve the active session's repository from its
|
|
91
|
+
// root — same machine, same resolveRepo hash the server stamped the
|
|
92
|
+
// line with. Unknown root fails closed to global-only.
|
|
93
|
+
let rootDir: string | undefined;
|
|
94
|
+
try {
|
|
95
|
+
rootDir = activeSid ? context.data.session.root(activeSid) : undefined;
|
|
96
|
+
} catch {
|
|
97
|
+
rootDir = undefined; // an unknown session has no repository here
|
|
98
|
+
}
|
|
99
|
+
const rows = await blockedRecent(8, blockedReaderFor(rootDir), activeSid);
|
|
84
100
|
setBlocked(rows);
|
|
85
101
|
const keys = new Set(rows.map((r) => `${r.ts}|${r.reason}`));
|
|
86
102
|
if (notifyBlocked && seenBlockKeys) {
|
package/src/viewer/mutate.ts
CHANGED
|
@@ -8,7 +8,12 @@
|
|
|
8
8
|
// All mutations require a reason and write audit + evidence lines.
|
|
9
9
|
import { deletionsFile } from "../core/config/paths.ts";
|
|
10
10
|
import { addBlock, removeBlock } from "../store/blocklist.ts";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
record,
|
|
13
|
+
chainId,
|
|
14
|
+
contentHash,
|
|
15
|
+
targetRepoFields,
|
|
16
|
+
} from "../evidence/record.ts";
|
|
12
17
|
import { removeTombstone, tombstone } from "../store/tombstones/tombstone.ts";
|
|
13
18
|
import { redactSecrets } from "../store/secrets.ts";
|
|
14
19
|
import { formatLine, parseLine } from "../core/logfmt/format.ts";
|
|
@@ -20,7 +25,7 @@ import {
|
|
|
20
25
|
import { readLines } from "../core/logfmt/read.ts";
|
|
21
26
|
import { withStoreLock, LOCK_WRITE } from "../store/lock.ts";
|
|
22
27
|
import { appendMemory } from "../store/files/append.ts";
|
|
23
|
-
import { loadAll } from "../store/files/load.ts";
|
|
28
|
+
import { loadAll, memoryFiles } from "../store/files/load.ts";
|
|
24
29
|
import { snapshotFiles } from "../store/files/snapshots.ts";
|
|
25
30
|
import { markSuperseded } from "../store/files/supersede.ts";
|
|
26
31
|
import { type Memory } from "../store/model/memory.ts";
|
|
@@ -123,6 +128,9 @@ export async function editMemory(input: EditInput): Promise<MutationResult> {
|
|
|
123
128
|
reason: input.reason,
|
|
124
129
|
snapshot: snapshot[0] ?? "-",
|
|
125
130
|
op: "write",
|
|
131
|
+
// #305: the line inherits the target's repository, so a repo-B edit is
|
|
132
|
+
// private to B (and admin), never a global broadcast of the reason.
|
|
133
|
+
...targetRepoFields(target),
|
|
126
134
|
});
|
|
127
135
|
|
|
128
136
|
return {
|
|
@@ -175,6 +183,9 @@ export async function deleteMemory(
|
|
|
175
183
|
snapshot: snapshot[0] ?? "-",
|
|
176
184
|
audit: deletionsFile(),
|
|
177
185
|
tool: "memory_viewer",
|
|
186
|
+
// #305: same inheritance as viewer_edit — a delete of a private row is
|
|
187
|
+
// not a globally readable event.
|
|
188
|
+
...targetRepoFields(target),
|
|
178
189
|
});
|
|
179
190
|
|
|
180
191
|
return {
|
|
@@ -224,6 +235,29 @@ async function audit(
|
|
|
224
235
|
);
|
|
225
236
|
}
|
|
226
237
|
|
|
238
|
+
// F1 on #308: the origin lookup must NOT go through loadAll(). loadAll
|
|
239
|
+
// intentionally hides blocklisted rows, but releaseQuarantine scans the raw
|
|
240
|
+
// day files and acts on them anyway — so a blocked private row released from
|
|
241
|
+
// the viewer resolved to no target, and its evidence line fell back to the
|
|
242
|
+
// unstamped/global reading: the operator's reason leaked to every other
|
|
243
|
+
// repository's memory_evidence. This reads the same raw files the release
|
|
244
|
+
// acts on, and returns ONLY the origin fields, never content.
|
|
245
|
+
async function findTargetOrigin(
|
|
246
|
+
ts: string,
|
|
247
|
+
): Promise<{ repo?: string; repoPath?: string } | undefined> {
|
|
248
|
+
for (const file of await memoryFiles()) {
|
|
249
|
+
for (const line of await readLines(file)) {
|
|
250
|
+
const f = parseLine(line);
|
|
251
|
+
if (f && f.ts === ts)
|
|
252
|
+
return {
|
|
253
|
+
repo: typeof f.repo === "string" ? f.repo : undefined,
|
|
254
|
+
repoPath: typeof f.repoPath === "string" ? f.repoPath : undefined,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return undefined;
|
|
259
|
+
}
|
|
260
|
+
|
|
227
261
|
export async function releaseQuarantinedMemory(
|
|
228
262
|
ts: string,
|
|
229
263
|
reason: string,
|
|
@@ -235,6 +269,12 @@ export async function releaseQuarantinedMemory(
|
|
|
235
269
|
// Layered with ReleaseQuarantineBody's trim/min check. Neither layer alone
|
|
236
270
|
// is pinned by the route rejection test; direct callers still need this one.
|
|
237
271
|
requireReason(reason);
|
|
272
|
+
// Resolve the target's origin BEFORE releasing so the audit line can
|
|
273
|
+
// inherit it (#305). A not_found noop has no row — no origin exists to
|
|
274
|
+
// carry, and the line names nothing private, so it stays unstamped. The
|
|
275
|
+
// lookup is unfiltered (F1 on #308): a blocklisted row is still a row the
|
|
276
|
+
// release below can act on, and its evidence must carry its repo.
|
|
277
|
+
const target = await findTargetOrigin(ts);
|
|
238
278
|
const outcome = await releaseQuarantine(ts);
|
|
239
279
|
const result =
|
|
240
280
|
outcome === "released"
|
|
@@ -243,7 +283,13 @@ export async function releaseQuarantinedMemory(
|
|
|
243
283
|
try {
|
|
244
284
|
await record(
|
|
245
285
|
result.released ? "quarantine_released" : "quarantine_release_noop",
|
|
246
|
-
{
|
|
286
|
+
{
|
|
287
|
+
mem: ts,
|
|
288
|
+
reason,
|
|
289
|
+
outcome,
|
|
290
|
+
source: "viewer",
|
|
291
|
+
...(target ? targetRepoFields(target) : {}),
|
|
292
|
+
},
|
|
247
293
|
false,
|
|
248
294
|
);
|
|
249
295
|
return result;
|