From 535b05adbfc76a655f7bae1e87f93db93167b24a Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Fri, 23 Oct 2026 14:29:38 -0500 Subject: [PATCH] row 298: Untested full gate; targeted 29 pass and ten mutants killed, address review (#1804) --- BUILD-LOG.md | 2 + agents/boyd/work/queue-298/BUILD.md | 80 ++++++++++++++++++++++ agents/boyd/work/queue-298/MANIFEST.sha256 | 4 +- agents/boyd/work/queue-298/mutants.py | 38 ++++++++-- docs/SESSIONS.md | 2 + packages/bus/README.md | 2 +- packages/bus/tests/grant-scope.test.mjs | 15 +++- 7 files changed, 132 insertions(+), 11 deletions(-) diff --git a/BUILD-LOG.md b/BUILD-LOG.md index 1b9f68140..0be8e2478 100644 --- a/BUILD-LOG.md +++ b/BUILD-LOG.md @@ -5425,3 +5425,5 @@ Row 299 (573, #1806, Gander, Filbert): before, the P10 band test timed a fault r 2026-10-23 | Gladstone | Row320 / #1816 first review CHANGES (morgana-0217) | Reviewer run: hostcheck19/19, unit47/47, install24/24, copy17/18; seven of eight mutants killed, M4 survived because both base/mutant failed only cleanup. Fixed this row's F4 test to enter cwd then chmod000, assert no read/search, pass an absolute outside bundle, and restore0700 in finally. Existing tests/setup and production scripts unchanged. Correction untested locally pending Morgana's focused rerun; no acceptance claim. 2026-10-23 | Boyd | Row 298 (#1804, Q228), before implementation completion | Took over Megavolt 7a141269c on boyd/row298 at 45dca69f6 under mos-1496/1502. Approved D1-D6 govern human-only grants.scope.set, empty fallback, in-scope close/evidence and spend recheck. All inherited code UNTESTED; no Node/tests until Sage CLEAR. Plan and static gaps recorded in agents/boyd/work/queue-298/BUILD.md; no live grant or credential access. + +2026-10-23 | Boyd | Row 298 (#1804, Q228), targeted verification | On sage-3642 T1 lane B, five whole files serial: business scope 7/0, bus scope 14/0, scope runtime 1/0, CLI scope 4/0, project runtime 3/0 (29/0, no skips). Initial bus fixture typo recorded and corrected. M1-M10 killed by named assertions, source restored and final files green. Dewey dewey-0933 positive control and notes addressed; manifest and evidence in agents/boyd/work/queue-298/BUILD.md. Full package/script gate remains Sage's. No live scope set. diff --git a/agents/boyd/work/queue-298/BUILD.md b/agents/boyd/work/queue-298/BUILD.md index 5aeb74938..8442fd261 100644 --- a/agents/boyd/work/queue-298/BUILD.md +++ b/agents/boyd/work/queue-298/BUILD.md @@ -139,3 +139,83 @@ Review package: product/test/documentation files in MANIFEST.sha256, excluding append-only project logs and the preserved predecessor packet. The manifest identifies exact bytes for Dewey; each later product change regenerates it and requires a review delta. Existing tests changed: only project-runtime, 1/1. + +## Dewey static review dewey-0933 + +N1: Added a positive control to the malformed-evidence fixture. A valid event +must pass scope authorization and reach decision-mismatch on the deliberately +absent definition binding; invalid events remain not-authorized. No spend. +N2: Additional named mutants cover spend recheck, exact argv length, Gitea spend +rollback, launch.by eligibility and accepting any evidence row (results below). +N3: At spend only grant scope membership is rechecked, not whether the raising +chief is still launch.by. This implements sage-3594 Q5; changing the launcher +later does not by itself invalidate a pending scope-approved request. +N4: The scope shortcut returns the closed decision view to the chief without +sending a separate close message; documented in the bus verb table. +N5: grant.scope is logged after the organization file commit in a separate bus +transaction. A crash between them leaves durable changes.jsonl as the receipt, +as with other organization writers. The setter does not claim cross-store +atomicity. + +## T1 lane B results (sage-3642, 2026-10-23 19:23Z–19:29Z) + +TMPDIR: `/mnt/storage/scratch/tmp/boyd298-4bzr6fn7`. Each whole file ran serially +as `timeout -k 10 180 node --test --test-concurrency=1 FILE`, TMPDIR set to that +scratch directory. Final restored candidate results: + +| Whole file | Pass | Fail | Skip | +| --- | ---: | ---: | ---: | +| business/tests/grant-scope.test.mjs | 7 | 0 | 0 | +| bus/tests/grant-scope.test.mjs | 14 | 0 | 0 | +| bus/tests/grant-scope-runtime.test.mjs | 1 | 0 | 0 | +| cli/tests/grants-scope.test.mjs | 4 | 0 | 0 | +| bus/tests/project-runtime.test.mjs | 3 | 0 | 0 | + +29/0/0 total. `final-1.log` through `final-5.log` hold the final output. The +runtime's reload-needs-restart notice is expected: the fixture's boot document +has fewer credential references than its organization document, as in the +existing instances runtime tests. No credential contents are loaded from the +real user config. + +Initial run: business 7/0; bus 13/1 due to Boyd's test typo, an out-of-scope +`opts` reference in the missing-scope assertion. Corrected only that new-test +line, then bus 14/0 and the remaining files green. Dewey N1 positive control +was added and the whole bus file passed again; final rerun above followed all +mutants. No production code changed during this test window. + +Mutants: all whole files, serial, with timeout -k 10 and the same TMPDIR. +`mutants.py --sage-clear sage-3642 --logs SCRATCH/review-mutants --deadline +2026-10-23T19:38:00+00:00` restores exact original source after each run. +M1/M2/M3/M4 are brief/Sage mutants; M5–M10 cover review focus and dewey-0933. +Each exited 1 with named assertion failures, no loader/syntax kill. + +| Mutant | Change | Pass/fail | Named killer | +| --- | --- | --- | --- | +| M1 | skip raise scope check | 11/3 | bus out-of-scope Gitea waits; empty/bad scope waits; host argv exclusion | +| M2 | skip invalid-value fallback | 5/2 | business missing/bad scope fallback; bad file scope fallback | +| M3 | remove #human from scope verb | 13/1 | bus Q3 caller refusals | +| M4 | drop grant.scope.used write | 9/5 | bus Q4 protected evidence assertion; four executor waits also fail | +| M5 | skip scope digest check | 13/1 | bus Q4 bad evidence: decision-mismatch instead of not-authorized | +| M6 | rethrow narrowing, rolling spend back | 13/1 | bus Q5 Gitea spent assertion | +| M7 | same without length check | 6/1 | business Q2 shorter command prefix exclusion | +| M8 | no-op #scopeRecheck | 12/2 | bus Q5 Gitea and host scope-changed outcomes | +| M9 | remove launch.by check | 13/1 | bus Q6 second chief stays open | +| M10 | accept any matched scope evidence row | 13/1 | bus Q4 bad evidence, with positive control | + +Mutation log sha256 (under scratch/review-mutants): + +```text +55e9973af5fca0088963e2ca11fd81b2fb46dfead813a577c0e0aad2d6269b68 M1.log +abd1b784eff5ae1333a7b47085d3e199cad6d27a00e2584edf0b62417ad4c888 M2.log +1a56085e548d1e244f0f88fe12a45f77c162375880794f9ef88b241ed3a1704d M3.log +9c120f3f7128488edaf8bfd6d41bae712e69e76da4195a0d4dc0e8336b02038f M4.log +1bba88a3752823454acdaa51abde6aad66fdd5488801b4aceda02a3b42c8123d M5.log +a4ce3cacca9f7ea56b8cdfd503c76173a8e4ff1d8a7ec07032c93f0b51aa60d8 M6.log +acecd5afc93d68d96d713f8a9a2dc08351831a0b7360a13b4e30a572ad4167bf M7.log +fce7fa505ccf4f2d4190bd03c209fd19f1cf2770d3ae1246a3bd03697594019e M8.log +a830a7964890dd04a2dcc7a932a1502f1dea06419a1eae6b91a85f7878dc5681 M9.log +38ce3e7f69f6c6ffe10133397465d52538a930a830f76256a8b9280f8df78e4b M10.log +``` + +Full touched-package suites and every scripts/test-*.sh remain for Sage's full gate; this CLEAR authorized only the five whole files. Candidate remains +marked Untested for the full gate. No queue row has been changed by Boyd. diff --git a/agents/boyd/work/queue-298/MANIFEST.sha256 b/agents/boyd/work/queue-298/MANIFEST.sha256 index fc2134975..5fc830755 100644 --- a/agents/boyd/work/queue-298/MANIFEST.sha256 +++ b/agents/boyd/work/queue-298/MANIFEST.sha256 @@ -1,8 +1,8 @@ -c4bcfb4535440a272ae72e1d0210134298d2b178c7e9090f67da6f1a0d81d4f1 packages/bus/README.md +612488b705853e75e6f8952e41552526f4d07dd297d7619d608d434ed75121d6 packages/bus/README.md 3677f403104c121d53eb50b874de7a5d8d22e038faac52a5ea5bad449d0d409c packages/bus/src/broker.mjs 2e0ade9233404439cd4a629245600878da960f1126e7299aa2ccfb3aff86d784 packages/bus/src/runtime.mjs e7065db949cacfd4679a1031eebf5cde09ed196ce85612e8400ae563f02a0f18 packages/bus/tests/grant-scope-runtime.test.mjs -38352d09827def3238385113f1bb3ce2e977fc3b016b12b4beab2b0400243a9f packages/bus/tests/grant-scope.test.mjs +4030cf584481a1db12d9e6f744015c48fdebd468335d065ead3e90180858d366 packages/bus/tests/grant-scope.test.mjs bc432d8d430433b9d84c00883584dc53d4b27afb5e93f739fe3ca28e80f01efa packages/bus/tests/project-runtime.test.mjs 84d6dd15d5ca2926d8f7a34548c70c3e7a3c58e692f0b009414f1af35cb096cc packages/business/src/business.mjs 1ac106522c8a115cb9479f2a6c5591fb9c77d138bbe93d2df10b6c4295645d0e packages/business/src/instance-settings.mjs diff --git a/agents/boyd/work/queue-298/mutants.py b/agents/boyd/work/queue-298/mutants.py index 129d40a2e..829d35712 100644 --- a/agents/boyd/work/queue-298/mutants.py +++ b/agents/boyd/work/queue-298/mutants.py @@ -42,6 +42,30 @@ def mutate(name, source): agent: raise.grant.agent, scope, revision, scopeSha256: sha256(JSON.stringify(scope)), }, d.id);""" return replace_once(source, old, ' // MUTANT: scope evidence omitted.') + if name == 'M5': + return replace_once(source, + "evidence.agent === grant.agent && evidence.scopeSha256 === sha256(JSON.stringify(checked.scope)) &&", + "evidence.agent === grant.agent &&") + if name == 'M6': + start = source.index(" checked = this.#store.transaction(() => {\n const consumed = this.#consumeGrant") + end = source.index('\n } catch (e) {', start) + return source[:start] + " checked = this.#store.transaction(() => this.#giteaRecheck(business, decision, this.#consumeGrant(business, decision, 'gitea')));" + source[end:] + if name == 'M7': + return replace_once(source, + 'const same = (a, b) => a.length === b.length && a.every((x, i) => x === b[i]);', + 'const same = (a, b) => a.every((x, i) => x === b[i]);') + if name == 'M8': + return replace_once(source, + " if (this.#closed(decision)?.via === 'scope' && !grantInScope(this.#scopeNow(business).scope, g)) fail('scope-changed');", + " // MUTANT: no spend-time scope recheck.") + if name == 'M9': + return replace_once(source, + ' if (s.role !== this.#business(s.business).launch?.by) return view;', + ' // MUTANT: any chief instance can use scope.') + if name == 'M10': + start = source.index(' const evidence = JSON.parse(row.body);', source.index(' #scopeUsed(')) + end = source.index('\n }', start) + return source[:start] + ' return true;' + source[end:] raise ValueError(name) @@ -49,26 +73,26 @@ def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--sage-clear', required=True, help='CLEAR message key; required before any Node run') parser.add_argument('--logs', type=pathlib.Path, required=True) - parser.add_argument('--mutant', choices=['M1', 'M2', 'M3', 'M4', 'all'], default='all') - parser.add_argument('--deadline', default='2026-10-23T20:00:00+00:00') + parser.add_argument('--mutant', choices=['M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'M8', 'M9', 'M10', 'all'], default='all') + parser.add_argument('--deadline', default='2026-10-23T19:38:00+00:00') args = parser.parse_args() deadline = datetime.datetime.fromisoformat(args.deadline) args.logs.mkdir(parents=True, exist_ok=True) - names = ['M1', 'M2', 'M3', 'M4'] if args.mutant == 'all' else [args.mutant] + names = ['M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'M8', 'M9', 'M10'] if args.mutant == 'all' else [args.mutant] for name in names: remaining = (deadline - datetime.datetime.now(datetime.timezone.utc)).total_seconds() - if remaining <= 5: + if remaining <= 15: raise RuntimeError('Sage slot deadline reached; no new test run') - path, test = (VOCABULARY, BUSINESS_TEST) if name == 'M2' else (BROKER, BUS_TEST) + path, test = (VOCABULARY, BUSINESS_TEST) if name in ['M2', 'M7'] else (BROKER, BUS_TEST) original = path.read_bytes() mutated = mutate(name, original.decode()) log = args.logs / f'{name}.log' try: path.write_text(mutated) with log.open('w') as output: - result = subprocess.run(['node', '--test', '--test-concurrency=1', test], + result = subprocess.run(['timeout', '-k', '10', str(int(min(180, remaining - 13))), 'node', '--test', '--test-concurrency=1', test], cwd=ROOT, stdout=output, stderr=subprocess.STDOUT, - timeout=min(180, remaining - 3), check=False) + timeout=min(195, remaining - 1), check=False) print(f'{name}: exit={result.returncode} log={log}', flush=True) finally: path.write_bytes(original) diff --git a/docs/SESSIONS.md b/docs/SESSIONS.md index 9fb8c5acb..0f6b5b70e 100644 --- a/docs/SESSIONS.md +++ b/docs/SESSIONS.md @@ -1599,3 +1599,5 @@ are never rewritten or removed; corrections are new entries. 2026-10-23T22:06Z | Duckworth (Opus 5.5) | row 239 (#1745) round 1 on r4 e0cb1db2c (honker-0206, rev 3719) | APPROVE (static): r4 range-diff all =, 16 paths byte-equal to r3, e0cb1db2c BUILD.md only, 4 channel-proof pins match; record waits for Sage's comment id and gap (duckworth-0295) | 2026-10-23T19:13:00Z | Boyd (48a3ae38, Codex gpt-6.1-sol) | Row 298 (#1804, Q228) takeover from Megavolt under mos-1496 | Started on boyd/row298 at 45dca69f6; reading brief, D1-D6 and human-shell proof; awaiting Megavolt handoff. No Node/tests before Sage CLEAR, no queue writes. + +2026-10-23T19:29:00Z | Boyd (48a3ae38) | Row 298 (#1804) targeted T1 lane B | Five whole files 29/0/0, ten mutants killed, source restored; reviewer delta prepared. Earlier startup timestamp corrected in Boyd BUILD.md. Full gate and queue/landing remain Sage's. diff --git a/packages/bus/README.md b/packages/bus/README.md index 8ef3b2c05..2b3142bae 100644 --- a/packages/bus/README.md +++ b/packages/bus/README.md @@ -227,7 +227,7 @@ an operator inspect content and delivery evidence after an uncertain result. | `hosts.revoke` | `{agent,host,reason}`; the human, the business's assistant, or the tester when `bus.tester` is exactly `true` (row 235, #1741, r6 section 6). Anyone else gets `revoke-refused`. The tester check reads `bus.tester` again at the call, `tester-dev-only`. One transaction deletes the `host_grants` record and writes `grant.revoked` with `hostLine:"pending"`. With no await between, the key leaves memory and its file goes, and a `host.run` or executor in flight aborts. Then `remove ` runs on the host and `grant.revoke.closed` records `hostLine:"removed"` or `hostLineLeft`. A revoke with no record still runs, with `granted:false`. Returns `{agent,host,tag,granted,keyFile,hostLine or hostLineLeft}`. A restart with a pending marker runs the remove once the bus is up; `hosts.status` lists its tag under `revoking`. | | `hosts.sweep` | `{host}`; the human or the tester (r6 X3). Runs `list ` and removes each listed tag this business recorded for the host in a `grant.step` or `grant.revoked` that no live grant holds. Another business's line and an unrecorded `mosaic-` line stay. Writes `grant.host.swept {host,removed,left}`; `hostLineLeft` then counts from it. Returns `{host,removed,hostLineLeft}`. | | `grants.scope` | `{}`; the proven human CLI only (row 298, #1804, Q228). Returns the organization revision, effective scope and fallback flag. `launch.grantScope` missing or invalid covers nothing. | -| `grants.scope.set` | `{revision,scope}`; the proven human CLI only, itself Approve for the scope change. Agents, testers, readers and Console caps refuse. Strict scope shape; optimistic organization revision, durable organization receipt, and `grant.scope` with human proof and old/new scope digests. General organization setters cannot write this setting. Scope matches per-method agent and every project, or agent/host and exact command arrays; host enrollment is excluded. In-scope requests by `launch.by` close via `scope` with protected `grant.scope.used` evidence, and run the existing grant executor without per-grant Approve. Outside scope waits as before. Scope narrowing before spend fails `scope-changed`; every issued grant keeps its records and revoke path. Empty default ships; the live value is Jason's to set. | +| `grants.scope.set` | `{revision,scope}`; the proven human CLI only, itself Approve for the scope change. Agents, testers, readers and Console caps refuse. Strict scope shape; optimistic organization revision, durable organization receipt, and `grant.scope` with human proof and old/new scope digests. General organization setters cannot write this setting. Scope matches per-method agent and every project, or agent/host and exact command arrays; host enrollment is excluded. In-scope requests by `launch.by` close via `scope` with protected `grant.scope.used` evidence, and run the existing grant executor without per-grant Approve. The raise returns the closed decision view to the chief; this shortcut sends no separate decision-close message. Outside scope waits as before. Scope narrowing before spend fails `scope-changed`; every issued grant keeps its records and revoke path. Empty default ships; the live value is Jason's to set. | | `grants.status` | `{service:"gitea"}`; the human, the tester or the chief (row 236, #1742, #436b r5). The admin slot's url, account and rotate-by date with `rotationDue`, `adminTokenLeft`, the `gitea_users` and `gitea_grants` records, approved decisions not yet run (`spentAtNextStart`), grants `running` or `settlePending`, agents held as `tokenUnknown`, the `serviceLeft` entries a sweep retries, and revokes still `revoking`. No token. | | `grants.run` | `{decision}`; the human only. Starts the Gitea executor of a `credential.mint` decision with a gitea grant the human said yes to, as the yes itself does (X1). Step 0's refusals come back with no record: `not-authorized`, `decision-consumed`, `grant-token-unknown`, `grant-busy`, `gitea-not-configured`. Returns `{decision,agent,started:true}`; the outcome is a `grant.applied` or `grant.failed` and a notice. | | `grants.revoke` | `{service:"gitea",agent,reason}`; the human, the business's assistant, or the tester when `bus.tester` is exactly `true`. The token leaves memory and its file goes, an executor in flight aborts, then one transaction deletes the `gitea_grants` record and writes `grant.revoked` with the token ids to delete. The deletes run with the admin token after C1 to C4, and `grant.revoke.closed` records `serviceLeft`, a list. `credentials.revoke AGENT gitea` and `credentials.delete` do the same for a stack-made user; delete also deletes every token of the user and sets `prohibit_login` (fire). | diff --git a/packages/bus/tests/grant-scope.test.mjs b/packages/bus/tests/grant-scope.test.mjs index 452ec3f01..559e9ac24 100644 --- a/packages/bus/tests/grant-scope.test.mjs +++ b/packages/bus/tests/grant-scope.test.mjs @@ -180,7 +180,7 @@ test('row 298 (Q3): the human verb writes the scope and a grant.scope record wit oldSha256: sha256(JSON.stringify({})), newSha256: sha256(JSON.stringify(GITEA)), transaction: 'tx-298', }]); await rejects(() => f.call('human', 'grants.scope.set', { revision: REVISION, scope: { gitea: {} } }), 'invalid-request'); - await rejects(() => f.call('human', 'grants.scope.set', { revision: Object.hasOwn(opts, 'revision') ? opts.revision : REVISION }), 'invalid-request'); + await rejects(() => f.call('human', 'grants.scope.set', { revision: REVISION }), 'invalid-request'); await rejects(() => f.call('human', 'grants.scope.set', { revision: REVISION, scope: {}, extra: 1 }), 'invalid-request'); assert.equal(f.grantEvents().filter((e) => e.action === 'grant.scope').length, 1); }); @@ -300,6 +300,19 @@ test('row 298 Q4: missing scope evidence or a bad scope digest cannot authorize assert.deepEqual(f.spent(id), []); assert.equal(f.record(), undefined); } + // Positive control: the same fixture with valid scope evidence reaches the + // next grant check. Its intentionally absent definition binding refuses there. + const id = grantDecision(f.store, { + grant: { method: 'gitea', agent: 'coder', target: { projects: ['app'] }, rotateBy: dayFrom(30) }, + close: { op: 'resolved', by: 'grant-scope', choice: 'yes', via: 'scope' }, + }); + writeGrantEvent(f.store, new Date().toISOString(), 'demo', { + action: 'grant.scope.used', grantDecision: id, decisionSeq: f.closes(id)[0].seq, + method: 'gitea', agent: 'coder', ...good, + }, id); + assert.equal(await f.broker.runGiteaGrant('demo', id), 'decision-mismatch'); + assert.deepEqual(f.spent(id), []); + assert.equal(f.record(), undefined); }); // Break caught: host grants bypassing records or losing the ordinary revoke path.