You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0a3dc7c
Browse filesBrowse the repository at this point in the historyBrowse files
moc
committed
fix: strip ledger contamination, bind upstream output into lineage, add MCP contract test
- store.mjs rebuilt from main: findCrossRunReuse only, no integrity-ledger
code (the ledger belongs to MiniMax-AI#48; the previous round accidentally carried it)
- lineageHash now includes each succeeded dependency's output hash, so an
upstream that re-executes with different output (mcode node without an
explicit model, tracked-file change during execution) invalidates downstream
adoption — regression covers the maintainer's divergence shape
- checks/cross-reuse-mcp.check.mjs: packaged MCP advertises reuseAcrossRuns on
workflow_start/workflow_update and accepts/rejects it through the public
tool surface (additionalProperties:false contract)
for(constnameof['workflow_start','workflow_update']){consttool=tools.find(t=>t.name===name);assert.ok(tool,`${name} listed`);assert.equal(tool.inputSchema.properties.reuseAcrossRuns?.type,'boolean',`${name} schema must advertise reuseAcrossRuns (additionalProperties:false)`);}
8
+
conststarted=awaitclient.callTool({name:'workflow_start',arguments:{requestId:'cross-mcp',name:'Cross-run via public surface',executor:'demo',reuseAcrossRuns:true,script:'return await ctx.agent({id:"a",prompt:"p"});'}});
assert.equal(run.reuseAcrossRuns,true,'the flag must survive the public tool surface');
11
+
constrejected=awaitclient.callTool({name:'workflow_start',arguments:{requestId:'cross-mcp-bad',name:'Bad flag type',executor:'demo',reuseAcrossRuns:'yes',script:'return 1;'}});
12
+
assert.ok(rejected.isError,'a non-boolean flag must be rejected by the public surface');
this.db = new DatabaseSync(join(dir, "workflows.sqlite"));
@@ -7752,8 +7751,7 @@ var Store = class {
7752
7751
CREATE TABLE IF NOT EXISTS steps(runId TEXT,id TEXT,body TEXT NOT NULL,PRIMARY KEY(runId,id));
7753
7752
CREATE TABLE IF NOT EXISTS repair_cache(runId TEXT,id TEXT,body TEXT NOT NULL,PRIMARY KEY(runId,id));
7754
7753
CREATE TABLE IF NOT EXISTS events(seq INTEGER PRIMARY KEY AUTOINCREMENT,runId TEXT,body TEXT NOT NULL);
7755
-
CREATE INDEX IF NOT EXISTS run_events ON events(runId,seq);
7756
-
CREATE TABLE IF NOT EXISTS integrity_rows(surface TEXT NOT NULL,pos INTEGER NOT NULL,key TEXT NOT NULL,hash TEXT NOT NULL,PRIMARY KEY(surface,pos));`);
7754
+
CREATE INDEX IF NOT EXISTS run_events ON events(runId,seq);`);
7757
7755
const unfinished = this.db.prepare("SELECT body FROM runs WHERE json_extract(body,'$.status') IN ('running','queued','stopping','pausing')").all();
7758
7756
for (const row of unfinished) {
7759
7757
const run = JSON.parse(row.body);
@@ -7768,8 +7766,6 @@ var Store = class {
7768
7766
}
7769
7767
}
7770
7768
transaction(fn) {
7771
-
if (this.txDepth) return fn();
7772
-
this.txDepth = 1;
7773
7769
this.db.exec("BEGIN IMMEDIATE");
7774
7770
try {
7775
7771
const r = fn();
@@ -7778,8 +7774,6 @@ var Store = class {
7778
7774
} catch (e) {
7779
7775
this.db.exec("ROLLBACK");
7780
7776
throw e;
7781
-
} finally {
7782
-
this.txDepth = 0;
7783
7777
}
7784
7778
}
7785
7779
templates() {
@@ -7841,61 +7835,16 @@ var Store = class {
7841
7835
return r ? JSON.parse(r.body) : null;
7842
7836
}
7843
7837
saveRepairCandidate(runId, step) {
7844
-
this.transaction(() => {
7845
-
const rowid = Number(this.db.prepare("INSERT INTO repair_cache VALUES(?,?,?)").run(runId, step.id, JSON.stringify(step)).lastInsertRowid);
7846
-
this.chainAdvance("repair", "repair", "SELECT rowid AS pos,runId,id,body FROM repair_cache WHERE rowid>? AND rowid<=? ORDER BY rowid", rowid, (r) => `${r.runId}/${r.id}`);
7847
-
});
7838
+
this.db.prepare("INSERT INTO repair_cache VALUES(?,?,?)").run(runId, step.id, JSON.stringify(step));
const seq = Number(this.db.prepare("INSERT INTO events(runId,body) VALUES(?,?)").run(runId, JSON.stringify(event)).lastInsertRowid);
7853
-
this.chainAdvance("event", "events", "SELECT seq AS pos,body FROM events WHERE seq>? AND seq<=? ORDER BY seq", seq, (r) => String(r.pos));
7854
-
return { seq, ...event };
7855
-
});
7842
+
const seq = Number(this.db.prepare("INSERT INTO events(runId,body) VALUES(?,?)").run(runId, JSON.stringify(event)).lastInsertRowid);
7843
+
return { seq, ...event };
7856
7844
}
7857
7845
events(runId, after = 0, limit = 150) {
7858
7846
return this.db.prepare("SELECT seq,body FROM events WHERE runId=? AND seq>? ORDER BY seq LIMIT ?").all(runId, after, limit).map((e) => ({ seq: e.seq, ...JSON.parse(e.body) }));
return { head: rec.head, upto: rec.upto, verified, checked: rows.length, unchained: Number(this.db.prepare(`SELECT COUNT(*) AS n FROM ${table} WHERE ${posCol}>?`).get(rec.upto).n), firstDivergence };
0 commit comments