harness-everything 0.21.0 → 0.22.0
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +12 -0
- package/benchmarks/results/system-one/cua-s1-forms-resident-cpu-2026-09-23/README.md +74 -0
- package/benchmarks/results/system-one/cua-s1-forms-resident-cpu-2026-09-23/report.json +856 -0
- package/ci/fixtures/system-one-resident-stub.py +28 -0
- package/ci/mechanism-packaging-bytecode.test.js +61 -0
- package/ci/mechanism-system-one-install.test.js +11 -0
- package/ci/mechanism-system-one-resident.test.js +185 -0
- package/ci/system-one-adapter-test.py +166 -0
- package/docs/platform-capabilities.md +3 -0
- package/docs/system-one-routing.md +72 -3
- package/harness-everything/SKILL.md +1 -1
- package/harness-everything/scripts/system-one/cua_adapter.py +265 -6
- package/harness-everything/scripts/system-one/install.js +17 -8
- package/harness-everything/scripts/system-one/provider.js +5 -2
- package/harness-everything/scripts/system-one/resident.js +176 -0
- package/harness-everything/scripts/system-one/router.js +1 -1
- package/opencode-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
- package/plugins/harness-everything/plugin.json +1 -1
- package/plugins/harness-everything/scripts/lib/packaging-noise.js +6 -0
- package/plugins/harness-everything/scripts/lib/skills.js +2 -0
- package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/cua_adapter.py +265 -6
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/install.js +17 -8
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/provider.js +5 -2
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/resident.js +176 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/router.js +1 -1
- package/sbom.cdx.json +7 -7
- package/scripts/build-openai-submission.js +2 -0
- package/scripts/evaluate-system-one.js +13 -4
- package/scripts/lib/packaging-noise.js +6 -0
- package/scripts/lib/skills.js +2 -0
- package/scripts/sync-openai-plugin.js +2 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Stub scorer behind the real resident server code; never model-quality evidence."""
|
|
2
|
+
import importlib.util
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import sys
|
|
5
|
+
import time
|
|
6
|
+
|
|
7
|
+
sys.dont_write_bytecode = True # never leave __pycache__ in the source tree that packaging copies
|
|
8
|
+
path = Path(__file__).resolve().parents[2] / 'harness-everything/scripts/system-one/cua_adapter.py'
|
|
9
|
+
spec = importlib.util.spec_from_file_location('adapter', path)
|
|
10
|
+
adapter = importlib.util.module_from_spec(spec)
|
|
11
|
+
spec.loader.exec_module(adapter)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def factory(weights, manifest):
|
|
15
|
+
if manifest['modelId'] == 'stub-fail':
|
|
16
|
+
raise ValueError('load-failed')
|
|
17
|
+
|
|
18
|
+
def score(request):
|
|
19
|
+
if manifest['modelId'] == 'stub-slow':
|
|
20
|
+
time.sleep(3)
|
|
21
|
+
return [1.0] + [0.0] * (len(request['options']) - 1)
|
|
22
|
+
return score, {'context_tokens': 224, 'option_tokens': 96}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
if __name__ == '__main__':
|
|
26
|
+
if sys.argv[1:2] != ['--serve']:
|
|
27
|
+
sys.exit(2)
|
|
28
|
+
sys.exit(adapter.serve_main(sys.argv[2:], scorer_factory=factory))
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// Python bytecode written by local/CI test runs is an untracked build artifact; no distribution may ship it.
|
|
3
|
+
const { test } = require('node:test');
|
|
4
|
+
const assert = require('node:assert/strict');
|
|
5
|
+
const fs = require('node:fs');
|
|
6
|
+
const os = require('node:os');
|
|
7
|
+
const path = require('node:path');
|
|
8
|
+
const { spawnSync } = require('node:child_process');
|
|
9
|
+
const { copyDir } = require('../scripts/lib/skills');
|
|
10
|
+
const { filesUnder } = require('../scripts/build-openai-submission');
|
|
11
|
+
const root = path.resolve(__dirname, '..');
|
|
12
|
+
const noise = files => files.filter(f => /(^|[\\/])__pycache__([\\/]|$)|\.py[co]$/.test(f));
|
|
13
|
+
|
|
14
|
+
function plant(dir) {
|
|
15
|
+
fs.mkdirSync(path.join(dir, '__pycache__'), { recursive: true });
|
|
16
|
+
fs.writeFileSync(path.join(dir, '__pycache__', 'cua_adapter.cpython-313.pyc'), 'bytecode');
|
|
17
|
+
fs.writeFileSync(path.join(dir, 'stray.pyc'), 'bytecode');
|
|
18
|
+
fs.writeFileSync(path.join(dir, 'keep.py'), 'print(1)\n');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
test('PK-01 skills installer copy and submission file walk skip Python bytecode', () => {
|
|
22
|
+
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'harness-pk-'));
|
|
23
|
+
try {
|
|
24
|
+
const src = path.join(tmp, 'src', 'scripts');
|
|
25
|
+
plant(src);
|
|
26
|
+
copyDir(path.join(tmp, 'src'), path.join(tmp, 'dest'));
|
|
27
|
+
const copied = filesUnder(path.join(tmp, 'dest'));
|
|
28
|
+
assert.deepEqual(noise(copied), []);
|
|
29
|
+
assert.ok(copied.includes('scripts/keep.py'));
|
|
30
|
+
const walked = filesUnder(path.join(tmp, 'src'));
|
|
31
|
+
assert.deepEqual(noise(walked), []);
|
|
32
|
+
assert.deepEqual(walked, ['scripts/keep.py']);
|
|
33
|
+
} finally { fs.rmSync(tmp, { recursive: true, force: true }); }
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('PK-02 plugin sync does not mirror bytecode from the canonical tree', () => {
|
|
37
|
+
const canonical = path.join(root, 'harness-everything', 'scripts', 'system-one');
|
|
38
|
+
const planted = [path.join(canonical, '__pycache__', 'cua_adapter.cpython-313.pyc'), path.join(canonical, 'stray.pyc')];
|
|
39
|
+
const hadCache = fs.existsSync(path.join(canonical, '__pycache__'));
|
|
40
|
+
try {
|
|
41
|
+
fs.mkdirSync(path.join(canonical, '__pycache__'), { recursive: true });
|
|
42
|
+
for (const file of planted) fs.writeFileSync(file, 'bytecode');
|
|
43
|
+
const sync = spawnSync(process.execPath, [path.join(root, 'scripts', 'sync-openai-plugin.js')], { cwd: root, encoding: 'utf8' });
|
|
44
|
+
assert.equal(sync.status, 0, sync.stderr);
|
|
45
|
+
const mirror = path.join(root, 'plugins', 'harness-everything', 'skills', 'harness-everything', 'scripts', 'system-one');
|
|
46
|
+
assert.deepEqual(noise(filesUnder(mirror)), []);
|
|
47
|
+
assert.equal(fs.existsSync(path.join(mirror, '__pycache__')), false);
|
|
48
|
+
} finally {
|
|
49
|
+
for (const file of planted) fs.rmSync(file, { force: true });
|
|
50
|
+
if (!hadCache) fs.rmSync(path.join(canonical, '__pycache__'), { recursive: true, force: true });
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('PK-03 Python tests do not write bytecode into the source tree', () => {
|
|
55
|
+
const canonical = path.join(root, 'harness-everything', 'scripts', 'system-one');
|
|
56
|
+
fs.rmSync(path.join(canonical, '__pycache__'), { recursive: true, force: true });
|
|
57
|
+
const python = process.env.PYTHON || (process.platform === 'win32' ? 'python' : 'python3');
|
|
58
|
+
const run = spawnSync(python, [path.join(__dirname, 'system-one-adapter-test.py')], { encoding: 'utf8', env: { ...process.env, PYTHONDONTWRITEBYTECODE: '' } });
|
|
59
|
+
assert.equal(run.status, 0, run.stderr);
|
|
60
|
+
assert.equal(fs.existsSync(path.join(canonical, '__pycache__')), false);
|
|
61
|
+
});
|
|
@@ -28,6 +28,7 @@ test('S1-I01 pins stay consistent with the provider contract', () => {
|
|
|
28
28
|
assert.equal(manifest.checkpoint, path.join(dir, 'checkpoints', PINS.modelRevision, PINS.files.weights.name));
|
|
29
29
|
assert.equal(manifest.weightsSha256, PINS.files.weights.sha256); assert.equal(manifest.configSha256, PINS.files.config.sha256);
|
|
30
30
|
assert.equal(manifest.revision, PINS.modelRevision); assert.equal(manifest.timeoutMs, 10000);
|
|
31
|
+
assert.equal(manifest.transport, 'resident'); assert.equal(manifest.idleTimeoutMs, 1800000);
|
|
31
32
|
});
|
|
32
33
|
|
|
33
34
|
test('S1-I02 interpreter selection accepts only the upstream-supported Python range', () => {
|
|
@@ -76,6 +77,16 @@ test('S1-I04 downloads are verified before an atomic write; a valid file is reus
|
|
|
76
77
|
} finally { fs.rmSync(dir, { recursive: true, force: true }); }
|
|
77
78
|
});
|
|
78
79
|
|
|
80
|
+
test('S1-I06 child command output goes to stderr so stdout stays machine-readable JSON', () => {
|
|
81
|
+
const code = `require(${JSON.stringify(script)}).exec(process.execPath, ['-e', 'console.log("pip-noise")'])`;
|
|
82
|
+
const child = spawnSync(process.execPath, ['-e', code], { encoding: 'utf8' });
|
|
83
|
+
assert.equal(child.status, 0, child.stderr);
|
|
84
|
+
assert.equal(child.stdout, '');
|
|
85
|
+
assert.match(child.stderr, /pip-noise/);
|
|
86
|
+
const captured = spawnSync(process.execPath, ['-e', `process.stdout.write(require(${JSON.stringify(script)}).exec(process.execPath, ['-e', 'console.log("3.13.6")'], true))`], { encoding: 'utf8' });
|
|
87
|
+
assert.equal(captured.stdout, '3.13.6');
|
|
88
|
+
});
|
|
89
|
+
|
|
79
90
|
test('S1-I05 dry run prints the pinned plan and changes nothing, repeatably', () => {
|
|
80
91
|
const dir = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'harness-s1-dry-')), 'target');
|
|
81
92
|
try {
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { test } = require('node:test');
|
|
3
|
+
const assert = require('node:assert/strict');
|
|
4
|
+
const fs = require('node:fs');
|
|
5
|
+
const os = require('node:os');
|
|
6
|
+
const path = require('node:path');
|
|
7
|
+
const { createHash } = require('node:crypto');
|
|
8
|
+
const { spawnSync } = require('node:child_process');
|
|
9
|
+
const resident = require('../harness-everything/scripts/system-one/resident');
|
|
10
|
+
const provider = require('../harness-everything/scripts/system-one/provider');
|
|
11
|
+
const { createRequest, decide } = require('../harness-everything/scripts/system-one/contract');
|
|
12
|
+
const { TIER_OPTIONS } = require('../harness-everything/scripts/system-one/router');
|
|
13
|
+
const python = process.env.PYTHON || (process.platform === 'win32' ? 'python' : 'python3');
|
|
14
|
+
const stub = path.join(__dirname, 'fixtures/system-one-resident-stub.py');
|
|
15
|
+
const request = createRequest('tier', 'fix a typo in README', TIER_OPTIONS);
|
|
16
|
+
const sha = file => createHash('sha256').update(fs.readFileSync(file)).digest('hex');
|
|
17
|
+
const sleep = ms => Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
18
|
+
|
|
19
|
+
function fixture(modelId = 'stub') {
|
|
20
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'harness-s1-resident-'));
|
|
21
|
+
const checkpoint = path.join(dir, 'model.safetensors');
|
|
22
|
+
fs.writeFileSync(checkpoint, 'synthetic-not-real-weights');
|
|
23
|
+
fs.writeFileSync(path.join(dir, 'model.json'), '{}');
|
|
24
|
+
const manifest = { schemaVersion: 1, python, checkpoint, weightsSha256: sha(checkpoint), configSha256: sha(path.join(dir, 'model.json')),
|
|
25
|
+
modelId, revision: 'v1', domain: 'harness-routing-v1', transport: 'resident', idleTimeoutMs: 60000 };
|
|
26
|
+
const manifestPath = path.join(dir, 'manifest.json');
|
|
27
|
+
fs.writeFileSync(manifestPath, JSON.stringify(manifest));
|
|
28
|
+
const spawns = [];
|
|
29
|
+
const deps = { command: m => { spawns.push(m.modelId); return [python, [stub, '--serve']]; } };
|
|
30
|
+
return { dir, manifest, manifestPath, spawns, deps };
|
|
31
|
+
}
|
|
32
|
+
function cleanup(f) {
|
|
33
|
+
try { resident.stop(f.manifest, f.manifestPath); } catch (_) { /* best effort */ }
|
|
34
|
+
fs.rmSync(f.dir, { recursive: true, force: true });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
test('S1-RS01 manifest transport fields and digest-bound file names', () => {
|
|
38
|
+
const f = fixture();
|
|
39
|
+
try {
|
|
40
|
+
assert.equal(provider.validateManifest(f.manifest), true);
|
|
41
|
+
for (const change of [{ transport: 'oneshot' }, { idleTimeoutMs: 60000 }, { idleTimeoutMs: 14400000 }]) assert.equal(provider.validateManifest({ ...f.manifest, ...change }), true);
|
|
42
|
+
for (const change of [{ transport: 'daemon' }, { transport: '' }, { idleTimeoutMs: 59999 }, { idleTimeoutMs: 14400001 }, { idleTimeoutMs: '60000' }]) {
|
|
43
|
+
assert.throws(() => provider.validateManifest({ ...f.manifest, ...change }));
|
|
44
|
+
}
|
|
45
|
+
const files = resident.stateFiles(f.manifest, f.manifestPath);
|
|
46
|
+
const digest = createHash('sha256').update(JSON.stringify(f.manifest)).digest('hex').slice(0, 16);
|
|
47
|
+
assert.equal(files.state, path.join(f.dir, `system-one-resident-${digest}.json`));
|
|
48
|
+
assert.equal(files.lock, path.join(f.dir, `system-one-resident-${digest}.starting`));
|
|
49
|
+
assert.notEqual(resident.stateFiles({ ...f.manifest, revision: 'v2' }, f.manifestPath).state, files.state);
|
|
50
|
+
} finally { cleanup(f); }
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('S1-RS02 cold start never blocks, spawns once, then serves warm repeatable scores', () => {
|
|
54
|
+
const f = fixture();
|
|
55
|
+
try {
|
|
56
|
+
assert.deepEqual(resident.score(request, f.manifest, f.manifestPath, f.deps), { status: 'unavailable', reason: 'provider-starting' });
|
|
57
|
+
assert.deepEqual(resident.score(request, f.manifest, f.manifestPath, f.deps), { status: 'unavailable', reason: 'provider-starting' });
|
|
58
|
+
assert.deepEqual(f.spawns, ['stub']);
|
|
59
|
+
assert.equal(resident.ensureReady(f.manifest, f.manifestPath, 20000, f.deps), true);
|
|
60
|
+
assert.equal(f.spawns.length, 1);
|
|
61
|
+
const one = resident.score(request, f.manifest, f.manifestPath, f.deps);
|
|
62
|
+
const two = resident.score(request, f.manifest, f.manifestPath, f.deps);
|
|
63
|
+
assert.equal(one.status, 'scored'); assert.deepEqual(one, two);
|
|
64
|
+
assert.equal(decide(request, one.response).selectedId, 'tier1');
|
|
65
|
+
assert.equal(resident.status(f.manifest, f.manifestPath).running, true);
|
|
66
|
+
assert.equal(resident.stop(f.manifest, f.manifestPath), true);
|
|
67
|
+
const deadline = Date.now() + 5000;
|
|
68
|
+
while (fs.existsSync(resident.stateFiles(f.manifest, f.manifestPath).state) && Date.now() < deadline) sleep(50);
|
|
69
|
+
assert.equal(resident.status(f.manifest, f.manifestPath).running, false);
|
|
70
|
+
} finally { cleanup(f); }
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('S1-RS03 stale state is removed and replaced; a wrong token is rejected without respawn', () => {
|
|
74
|
+
const f = fixture();
|
|
75
|
+
try {
|
|
76
|
+
const { state } = resident.stateFiles(f.manifest, f.manifestPath);
|
|
77
|
+
const dead = spawnSync(process.execPath, ['-e', '0']).pid;
|
|
78
|
+
fs.writeFileSync(state, JSON.stringify({ schemaVersion: 1, pid: dead, port: 9, token: 'a'.repeat(64), startedAt: 1 }));
|
|
79
|
+
assert.deepEqual(resident.score(request, f.manifest, f.manifestPath, f.deps), { status: 'unavailable', reason: 'provider-starting' });
|
|
80
|
+
assert.equal(f.spawns.length, 1);
|
|
81
|
+
assert.equal(resident.ensureReady(f.manifest, f.manifestPath, 20000, f.deps), true);
|
|
82
|
+
const good = JSON.parse(fs.readFileSync(state, 'utf8'));
|
|
83
|
+
fs.writeFileSync(state, JSON.stringify({ ...good, token: 'b'.repeat(64) }));
|
|
84
|
+
assert.deepEqual(resident.score(request, f.manifest, f.manifestPath, f.deps), { status: 'unavailable', reason: 'provider-unavailable' });
|
|
85
|
+
assert.equal(f.spawns.length, 1);
|
|
86
|
+
fs.writeFileSync(state, JSON.stringify(good));
|
|
87
|
+
for (const bad of ['not-json', JSON.stringify({ ...good, extra: 1 }), JSON.stringify({ ...good, token: 'short' })]) {
|
|
88
|
+
fs.writeFileSync(state, bad);
|
|
89
|
+
assert.equal(resident.status(f.manifest, f.manifestPath).running, false);
|
|
90
|
+
}
|
|
91
|
+
fs.writeFileSync(state, JSON.stringify(good));
|
|
92
|
+
} finally { cleanup(f); }
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('S1-RS04 a slow server times out within the deadline and is not respawned', () => {
|
|
96
|
+
const f = fixture('stub-slow');
|
|
97
|
+
try {
|
|
98
|
+
assert.equal(resident.ensureReady(f.manifest, f.manifestPath, 20000, f.deps), true);
|
|
99
|
+
const start = Date.now();
|
|
100
|
+
assert.deepEqual(resident.score(request, f.manifest, f.manifestPath, f.deps), { status: 'unavailable', reason: 'provider-timeout' });
|
|
101
|
+
assert.ok(Date.now() - start < 2500);
|
|
102
|
+
assert.equal(f.spawns.length, 1);
|
|
103
|
+
} finally { cleanup(f); }
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('S1-RS05 startup failure is visible and throttled instead of respawning every prompt', () => {
|
|
107
|
+
const f = fixture('stub-fail');
|
|
108
|
+
try {
|
|
109
|
+
assert.equal(resident.score(request, f.manifest, f.manifestPath, f.deps).reason, 'provider-starting');
|
|
110
|
+
assert.equal(resident.ensureReady(f.manifest, f.manifestPath, 20000, f.deps), false);
|
|
111
|
+
const lock = JSON.parse(fs.readFileSync(resident.stateFiles(f.manifest, f.manifestPath).lock, 'utf8'));
|
|
112
|
+
assert.equal(lock.failed, 'load-failed');
|
|
113
|
+
assert.deepEqual(resident.score(request, f.manifest, f.manifestPath, f.deps), { status: 'unavailable', reason: 'provider-unavailable' });
|
|
114
|
+
assert.equal(f.spawns.length, 1);
|
|
115
|
+
} finally { cleanup(f); }
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('S1-RS06 provider dispatch uses the real adapter and reports a missing ML runtime', () => {
|
|
119
|
+
const f = fixture();
|
|
120
|
+
try {
|
|
121
|
+
assert.deepEqual(provider.score(request, f.manifestPath), { status: 'unavailable', reason: 'provider-starting' });
|
|
122
|
+
const { lock } = resident.stateFiles(f.manifest, f.manifestPath);
|
|
123
|
+
const deadline = Date.now() + 20000;
|
|
124
|
+
while (Date.now() < deadline && !(fs.existsSync(lock) && JSON.parse(fs.readFileSync(lock, 'utf8')).failed)) sleep(100);
|
|
125
|
+
const probe = spawnSync(python, ['-c', 'import torch, cua_s1'], { encoding: 'utf8' });
|
|
126
|
+
if (probe.status !== 0) {
|
|
127
|
+
assert.equal(JSON.parse(fs.readFileSync(lock, 'utf8')).failed, 'load-failed');
|
|
128
|
+
assert.deepEqual(provider.score(request, f.manifestPath), { status: 'unavailable', reason: 'provider-unavailable' });
|
|
129
|
+
}
|
|
130
|
+
const off = { ...f.manifest, transport: 'oneshot' };
|
|
131
|
+
fs.writeFileSync(f.manifestPath, JSON.stringify(off));
|
|
132
|
+
assert.notEqual(provider.score(request, f.manifestPath).reason, 'provider-starting');
|
|
133
|
+
} finally { cleanup(f); }
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test('S1-RS07 operator CLI reports status and stops a running server', () => {
|
|
137
|
+
const f = fixture();
|
|
138
|
+
try {
|
|
139
|
+
const cli = args => spawnSync(process.execPath, [path.join(__dirname, '../harness-everything/scripts/system-one/resident.js'), ...args], { encoding: 'utf8' });
|
|
140
|
+
assert.equal(JSON.parse(cli(['status', f.manifestPath]).stdout).running, false);
|
|
141
|
+
assert.equal(resident.ensureReady(f.manifest, f.manifestPath, 20000, f.deps), true);
|
|
142
|
+
const running = JSON.parse(cli(['status', f.manifestPath]).stdout);
|
|
143
|
+
assert.equal(running.running, true); assert.ok(!JSON.stringify(running).includes('token'));
|
|
144
|
+
assert.equal(cli(['stop', f.manifestPath]).status, 0);
|
|
145
|
+
const deadline = Date.now() + 5000;
|
|
146
|
+
while (JSON.parse(cli(['status', f.manifestPath]).stdout).running && Date.now() < deadline) sleep(50);
|
|
147
|
+
assert.equal(JSON.parse(cli(['status', f.manifestPath]).stdout).running, false);
|
|
148
|
+
assert.equal(cli(['bogus', f.manifestPath]).status, 2);
|
|
149
|
+
assert.equal(cli(['status', 'relative.json']).status, 2);
|
|
150
|
+
} finally { cleanup(f); }
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
test('S1-RS08 an executable that cannot spawn is recorded as a visible, throttled failure', () => {
|
|
154
|
+
const f = fixture();
|
|
155
|
+
try {
|
|
156
|
+
const missing = path.join(f.dir, 'no-such-python.exe');
|
|
157
|
+
const deps = { command: () => { f.spawns.push('missing'); return [missing, []]; } };
|
|
158
|
+
assert.deepEqual(resident.score(request, f.manifest, f.manifestPath, deps), { status: 'unavailable', reason: 'provider-unavailable' });
|
|
159
|
+
assert.equal(JSON.parse(fs.readFileSync(resident.stateFiles(f.manifest, f.manifestPath).lock, 'utf8')).failed, 'spawn-failed');
|
|
160
|
+
assert.deepEqual(resident.score(request, f.manifest, f.manifestPath, deps), { status: 'unavailable', reason: 'provider-unavailable' });
|
|
161
|
+
assert.equal(resident.ensureReady(f.manifest, f.manifestPath, 2000, deps), false);
|
|
162
|
+
assert.deepEqual(f.spawns, ['missing']);
|
|
163
|
+
} finally { cleanup(f); }
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test('S1-RS09 a corrupted state file never leaves an orphan server behind', () => {
|
|
167
|
+
const f = fixture();
|
|
168
|
+
try {
|
|
169
|
+
assert.equal(resident.ensureReady(f.manifest, f.manifestPath, 20000, f.deps), true);
|
|
170
|
+
const { state } = resident.stateFiles(f.manifest, f.manifestPath);
|
|
171
|
+
const old = JSON.parse(fs.readFileSync(state, 'utf8'));
|
|
172
|
+
fs.writeFileSync(state, 'corrupt');
|
|
173
|
+
assert.equal(resident.ensureReady(f.manifest, f.manifestPath, 20000, f.deps), true);
|
|
174
|
+
const fresh = JSON.parse(fs.readFileSync(state, 'utf8'));
|
|
175
|
+
assert.notEqual(fresh.pid, old.pid);
|
|
176
|
+
// "Stopped serving" is the contract. On POSIX an exited child stays a zombie (kill(pid, 0) succeeds)
|
|
177
|
+
// until this blocked test process reaps it, so a refused/failed ping also proves the server is gone.
|
|
178
|
+
const alive = pid => { try { process.kill(pid, 0); return true; } catch (e) { return e.code === 'EPERM'; } };
|
|
179
|
+
const serving = () => alive(old.pid) && resident.callSync(old.port, { token: old.token, op: 'ping' }).reply?.ok === true;
|
|
180
|
+
const deadline = Date.now() + 5000;
|
|
181
|
+
while (serving() && Date.now() < deadline) sleep(100);
|
|
182
|
+
assert.equal(serving(), false);
|
|
183
|
+
assert.equal(resident.status(f.manifest, f.manifestPath).pid, fresh.pid);
|
|
184
|
+
} finally { cleanup(f); }
|
|
185
|
+
});
|
|
@@ -2,10 +2,17 @@
|
|
|
2
2
|
import hashlib
|
|
3
3
|
import importlib.util
|
|
4
4
|
import json
|
|
5
|
+
import os
|
|
5
6
|
from pathlib import Path
|
|
7
|
+
import socket
|
|
8
|
+
import subprocess
|
|
9
|
+
import sys
|
|
6
10
|
import tempfile
|
|
11
|
+
import threading
|
|
12
|
+
import time
|
|
7
13
|
import unittest
|
|
8
14
|
|
|
15
|
+
sys.dont_write_bytecode = True # never leave __pycache__ in the source tree that packaging copies
|
|
9
16
|
path = Path(__file__).resolve().parents[1] / 'harness-everything/scripts/system-one/cua_adapter.py'
|
|
10
17
|
spec = importlib.util.spec_from_file_location('adapter', path)
|
|
11
18
|
adapter = importlib.util.module_from_spec(spec)
|
|
@@ -52,5 +59,164 @@ class AdapterTests(unittest.TestCase):
|
|
|
52
59
|
self.assertEqual(json.loads(json.dumps(result)), result)
|
|
53
60
|
|
|
54
61
|
|
|
62
|
+
def stub_factory(weights, manifest):
|
|
63
|
+
return (lambda request: [1.0] + [0.0] * (len(request['options']) - 1)), {'context_tokens': 8, 'option_tokens': 8}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def call(port, payload, raw=None):
|
|
67
|
+
with socket.create_connection(('127.0.0.1', port), timeout=5) as conn:
|
|
68
|
+
conn.sendall(raw if raw is not None else (json.dumps(payload) + '\n').encode('utf-8'))
|
|
69
|
+
conn.shutdown(socket.SHUT_WR)
|
|
70
|
+
data = b''.join(iter(lambda: conn.recv(65536), b''))
|
|
71
|
+
return json.loads(data)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class ResidentServerTests(unittest.TestCase):
|
|
75
|
+
def setUp(self):
|
|
76
|
+
self.root = tempfile.TemporaryDirectory()
|
|
77
|
+
weights = Path(self.root.name) / 'model.safetensors'
|
|
78
|
+
weights.write_bytes(b'synthetic-not-real-weights')
|
|
79
|
+
weights.with_suffix('.json').write_text('{}', encoding='utf-8')
|
|
80
|
+
self.weights = weights
|
|
81
|
+
self.manifest = {'checkpoint': str(weights), 'modelId': 'stub', 'revision': 'v1', 'domain': 'harness-routing-v1',
|
|
82
|
+
'weightsSha256': hashlib.sha256(weights.read_bytes()).hexdigest(),
|
|
83
|
+
'configSha256': hashlib.sha256(weights.with_suffix('.json').read_bytes()).hexdigest()}
|
|
84
|
+
self.state = Path(self.root.name) / 'state.json'
|
|
85
|
+
self.lock = Path(self.root.name) / 'state.starting'
|
|
86
|
+
self.lock.write_text('{}', encoding='utf-8')
|
|
87
|
+
|
|
88
|
+
def tearDown(self):
|
|
89
|
+
self.root.cleanup()
|
|
90
|
+
|
|
91
|
+
def start(self, idle=30):
|
|
92
|
+
thread = threading.Thread(target=adapter.serve, args=(self.manifest, self.state, self.lock),
|
|
93
|
+
kwargs={'scorer_factory': stub_factory, 'idle_timeout_s': idle}, daemon=True)
|
|
94
|
+
thread.start()
|
|
95
|
+
deadline = time.time() + 10
|
|
96
|
+
while not self.state.exists() and time.time() < deadline:
|
|
97
|
+
time.sleep(0.02)
|
|
98
|
+
self.assertTrue(self.state.exists())
|
|
99
|
+
return thread, json.loads(self.state.read_text(encoding='utf-8'))
|
|
100
|
+
|
|
101
|
+
def request(self, context='fix', options=('a', 'b')):
|
|
102
|
+
return {'schemaVersion': 1, 'task': 'tier', 'context': context, 'requestHash': 'a' * 64, 'catalogHash': 'b' * 64,
|
|
103
|
+
'options': [{'id': f'o{i}', 'text': t} for i, t in enumerate(options)]}
|
|
104
|
+
|
|
105
|
+
def test_protocol_auth_limits_and_shutdown(self):
|
|
106
|
+
thread, state = self.start()
|
|
107
|
+
self.assertEqual(set(state), {'schemaVersion', 'pid', 'port', 'token', 'startedAt'})
|
|
108
|
+
self.assertRegex(state['token'], r'^[0-9a-f]{64}$')
|
|
109
|
+
self.assertEqual(state['pid'], os.getpid())
|
|
110
|
+
self.assertFalse(self.lock.exists())
|
|
111
|
+
if os.name == 'posix':
|
|
112
|
+
self.assertEqual(self.state.stat().st_mode & 0o777, 0o600)
|
|
113
|
+
token, port = state['token'], state['port']
|
|
114
|
+
self.assertEqual(call(port, {'token': token, 'op': 'ping'})['ok'], True)
|
|
115
|
+
self.assertEqual(call(port, {'token': '0' * 64, 'op': 'ping'}), {'ok': False, 'reason': 'unauthorized'})
|
|
116
|
+
self.assertEqual(call(port, {'op': 'ping'}), {'ok': False, 'reason': 'unauthorized'})
|
|
117
|
+
self.assertEqual(call(port, None, raw=b'not-json\n'), {'ok': False, 'reason': 'invalid-request'})
|
|
118
|
+
self.assertEqual(call(port, None, raw=b'x' * (2 * 1024 * 1024 + 2)), {'ok': False, 'reason': 'request-limit'})
|
|
119
|
+
self.assertEqual(call(port, {'token': token, 'op': 'unknown'}), {'ok': False, 'reason': 'invalid-request'})
|
|
120
|
+
reply = call(port, {'token': token, 'op': 'score', 'request': self.request()})
|
|
121
|
+
self.assertEqual(reply['ok'], True)
|
|
122
|
+
self.assertEqual(reply['response']['requestHash'], 'a' * 64)
|
|
123
|
+
self.assertEqual(reply['response']['model'], {'id': 'stub', 'revision': 'v1', 'domain': 'harness-routing-v1'})
|
|
124
|
+
self.assertEqual([s['probability'] for s in reply['response']['scores']], [1.0, 0.0])
|
|
125
|
+
self.assertEqual(call(port, {'token': token, 'op': 'score', 'request': self.request(context='123456789')}),
|
|
126
|
+
{'ok': False, 'reason': 'input-too-long'})
|
|
127
|
+
self.assertEqual(call(port, {'token': token, 'op': 'score', 'request': {'context': 'x'}}), {'ok': False, 'reason': 'invalid-request'})
|
|
128
|
+
self.assertEqual(call(port, {'token': token, 'op': 'shutdown'}), {'ok': True})
|
|
129
|
+
thread.join(5)
|
|
130
|
+
self.assertFalse(thread.is_alive())
|
|
131
|
+
self.assertFalse(self.state.exists())
|
|
132
|
+
|
|
133
|
+
def test_artifact_change_stops_server(self):
|
|
134
|
+
thread, state = self.start()
|
|
135
|
+
time.sleep(0.05)
|
|
136
|
+
self.weights.write_bytes(b'changed-weights-with-new-size')
|
|
137
|
+
reply = call(state['port'], {'token': state['token'], 'op': 'score', 'request': self.request()})
|
|
138
|
+
self.assertEqual(reply, {'ok': False, 'reason': 'artifact-changed'})
|
|
139
|
+
thread.join(5)
|
|
140
|
+
self.assertFalse(thread.is_alive())
|
|
141
|
+
self.assertFalse(self.state.exists())
|
|
142
|
+
|
|
143
|
+
def test_idle_timeout_exits_and_removes_state(self):
|
|
144
|
+
thread, _ = self.start(idle=0.3)
|
|
145
|
+
thread.join(5)
|
|
146
|
+
self.assertFalse(thread.is_alive())
|
|
147
|
+
self.assertFalse(self.state.exists())
|
|
148
|
+
|
|
149
|
+
@unittest.skipUnless(os.name == 'nt', 'Windows DACL')
|
|
150
|
+
def test_state_file_has_owner_only_explicit_dacl_on_windows(self):
|
|
151
|
+
thread, state = self.start()
|
|
152
|
+
# Drop the file path (it contains "C:\Users\...") and keep only the ACE text.
|
|
153
|
+
acl = subprocess.run(['icacls', str(self.state)], capture_output=True, text=True).stdout.replace(str(self.state), '')
|
|
154
|
+
self.assertIn(':(F)', acl)
|
|
155
|
+
for bad in ['(I)', 'Users', 'Everyone', 'Administrators', 'SYSTEM']:
|
|
156
|
+
self.assertNotIn(bad, acl)
|
|
157
|
+
call(state['port'], {'token': state['token'], 'op': 'shutdown'})
|
|
158
|
+
thread.join(5)
|
|
159
|
+
|
|
160
|
+
@unittest.skipUnless(os.name == 'nt', 'Windows DACL')
|
|
161
|
+
def test_explicit_foreign_aces_are_replaced_not_kept(self):
|
|
162
|
+
# CI runners create files with explicit (non-inherited) SYSTEM/Administrators/OWNER RIGHTS entries.
|
|
163
|
+
target = Path(self.root.name) / 'explicit.json'
|
|
164
|
+
target.write_text('{}', encoding='utf-8')
|
|
165
|
+
subprocess.run(['icacls', str(target), '/inheritance:d'], capture_output=True, check=True)
|
|
166
|
+
subprocess.run(['icacls', str(target), '/grant', '*S-1-5-32-544:F', '*S-1-5-18:F', '*S-1-3-4:F', '*S-1-5-32-545:R'], capture_output=True, check=True)
|
|
167
|
+
adapter._restrict_to_current_user(target)
|
|
168
|
+
acl = subprocess.run(['icacls', str(target)], capture_output=True, text=True).stdout.replace(str(target), '')
|
|
169
|
+
self.assertEqual(acl.count(':('), 1)
|
|
170
|
+
self.assertIn(':(F)', acl)
|
|
171
|
+
|
|
172
|
+
def test_slow_client_does_not_block_others_and_burst_is_served(self):
|
|
173
|
+
thread, state = self.start()
|
|
174
|
+
idle = socket.create_connection(('127.0.0.1', state['port']), timeout=5)
|
|
175
|
+
try:
|
|
176
|
+
began = time.monotonic()
|
|
177
|
+
self.assertEqual(call(state['port'], {'token': state['token'], 'op': 'ping'})['ok'], True)
|
|
178
|
+
self.assertLess(time.monotonic() - began, 0.5)
|
|
179
|
+
results = []
|
|
180
|
+
workers = [threading.Thread(target=lambda: results.append(call(state['port'], {'token': state['token'], 'op': 'ping'}))) for _ in range(32)]
|
|
181
|
+
for w in workers:
|
|
182
|
+
w.start()
|
|
183
|
+
for w in workers:
|
|
184
|
+
w.join(10)
|
|
185
|
+
self.assertEqual(len(results), 32)
|
|
186
|
+
self.assertTrue(all(r.get('ok') is True or r == {'ok': False, 'reason': 'busy'} for r in results))
|
|
187
|
+
self.assertGreaterEqual(sum(1 for r in results if r.get('ok') is True), 16)
|
|
188
|
+
finally:
|
|
189
|
+
idle.close()
|
|
190
|
+
call(state['port'], {'token': state['token'], 'op': 'shutdown'})
|
|
191
|
+
thread.join(5)
|
|
192
|
+
|
|
193
|
+
def test_server_exits_when_its_state_file_no_longer_names_it(self):
|
|
194
|
+
thread, _ = self.start()
|
|
195
|
+
self.state.write_text('{"corrupt": true}', encoding='utf-8')
|
|
196
|
+
thread.join(5)
|
|
197
|
+
self.assertFalse(thread.is_alive())
|
|
198
|
+
self.assertEqual(self.state.read_text(encoding='utf-8'), '{"corrupt": true}')
|
|
199
|
+
|
|
200
|
+
def test_rejects_requests_outside_phase0_structure(self):
|
|
201
|
+
thread, state = self.start()
|
|
202
|
+
token, port = state['token'], state['port']
|
|
203
|
+
many = self.request(options=tuple('x' for _ in range(257)))
|
|
204
|
+
extra = dict(self.request(), extra=1)
|
|
205
|
+
dup = self.request(); dup['options'][1]['id'] = dup['options'][0]['id']
|
|
206
|
+
bad_id = self.request(); bad_id['options'][0]['id'] = 'Bad ID'
|
|
207
|
+
wrong_version = dict(self.request(), schemaVersion=2)
|
|
208
|
+
for request in [many, extra, dup, bad_id, wrong_version]:
|
|
209
|
+
self.assertEqual(call(port, {'token': token, 'op': 'score', 'request': request}), {'ok': False, 'reason': 'invalid-request'})
|
|
210
|
+
self.assertEqual(call(port, {'token': token, 'op': 'score', 'request': self.request(options=tuple('x' for _ in range(256)))})['ok'], True)
|
|
211
|
+
call(port, {'token': token, 'op': 'shutdown'})
|
|
212
|
+
thread.join(5)
|
|
213
|
+
|
|
214
|
+
def test_startup_failure_is_recorded_in_lock(self):
|
|
215
|
+
self.manifest['weightsSha256'] = '0' * 64
|
|
216
|
+
adapter.serve(self.manifest, self.state, self.lock, scorer_factory=stub_factory, idle_timeout_s=1)
|
|
217
|
+
self.assertFalse(self.state.exists())
|
|
218
|
+
self.assertEqual(json.loads(self.lock.read_text(encoding='utf-8'))['failed'], 'artifact-hash')
|
|
219
|
+
|
|
220
|
+
|
|
55
221
|
if __name__ == '__main__':
|
|
56
222
|
unittest.main()
|
|
@@ -129,5 +129,8 @@ structural floor. Canonical and packaged runtime copies use the same
|
|
|
129
129
|
contract; this establishes no new live-host capability. Python, PyTorch and a
|
|
130
130
|
compatible local checkpoint are optional external dependencies, not npm payloads;
|
|
131
131
|
the explicit `npm run system-one:install` sets them up and hooks never run it.
|
|
132
|
+
With `transport: "resident"`, an opted-in router hook may spawn one detached
|
|
133
|
+
loopback-only Python server per manifest; host survival of that process after
|
|
134
|
+
a hook exits is not live-verified.
|
|
132
135
|
Public Skills-only artifacts do not acquire lifecycle hooks from this feature.
|
|
133
136
|
See [System One routing](system-one-routing.md) for limits, rollback and evidence.
|
|
@@ -68,10 +68,13 @@ installs the pinned `cua_s1` Git URL. It downloads the `cua-ai/cua-s1-forms`
|
|
|
68
68
|
safetensors weights and JSON sidecar at Hugging Face revision
|
|
69
69
|
`f54adbf447f4ca6ec259f529ee3f2e3e09f8cc71`, verifies pinned sizes and SHA-256
|
|
70
70
|
before an atomic write (the pickle `.pt` is never fetched), and writes
|
|
71
|
-
`<dir>/manifest.json` with `timeoutMs: 10000
|
|
71
|
+
`<dir>/manifest.json` with `timeoutMs: 10000`, `transport: "resident"` and
|
|
72
|
+
`idleTimeoutMs: 1800000`. The default `<dir>` is
|
|
72
73
|
`~/.agents/harness-everything/system-one`; `--dir` takes an absolute path and
|
|
73
74
|
`--dry-run` prints the plan without changes. Acceptance requires a `pinned`
|
|
74
|
-
provenance probe and one real CPU inference
|
|
75
|
+
provenance probe and one real warm CPU inference through a resident server that
|
|
76
|
+
the installer starts and then stops; otherwise the exit code is 1. Child-process
|
|
77
|
+
output goes to stderr; stdout carries only the JSON report.
|
|
75
78
|
Torch/numpy/safetensors versions resolve at install time and are recorded by
|
|
76
79
|
the probe. The installer does not change the router mode: it prints
|
|
77
80
|
`HARNESS_SYSTEM_ONE_MODE=shadow` and the manifest path for the host
|
|
@@ -88,13 +91,79 @@ No prompts or model values are written to disk or echoed in error messages.
|
|
|
88
91
|
|
|
89
92
|
The Node transport has a hard timeout and a 1 MiB stdout/stderr bound; it kills
|
|
90
93
|
the direct child on timeout. It starts one short-lived Python process per score
|
|
91
|
-
request. This is
|
|
94
|
+
request. This is the default `oneshot` transport, not a warm server; see the
|
|
95
|
+
resident provider below.
|
|
92
96
|
The process cannot execute actions and is not given a CUA driver. Failures return
|
|
93
97
|
`{status: 'unavailable', reason}` with a bounded reason code; malformed score
|
|
94
98
|
responses are checked by Phase 0. Transport fixtures prove IPC and failure
|
|
95
99
|
handling only. Real checkpoint inference and measured CPU latency remain a
|
|
96
100
|
separate gate, with explicit unavailable evidence if dependencies are absent.
|
|
97
101
|
|
|
102
|
+
## Resident provider (Phase 4 prerequisite)
|
|
103
|
+
|
|
104
|
+
The one-shot bridge pays Python start, `import torch` and checkpoint load on every
|
|
105
|
+
call (measured ≈5 s on CPU); warm in-process inference is a few milliseconds. The
|
|
106
|
+
manifest may set `transport: "resident"` (default `"oneshot"`) and optional
|
|
107
|
+
`idleTimeoutMs` (60000–14400000, default 1800000) to keep one verified model in
|
|
108
|
+
memory. Other manifest rules are unchanged; the timeout remains one-shot only.
|
|
109
|
+
|
|
110
|
+
**Lifecycle.** A resident-mode score never blocks on model loading. If no live
|
|
111
|
+
server exists, the Node provider creates a start lock with exclusive-create,
|
|
112
|
+
spawns `cua_adapter.py --serve` detached with the configured Python (no shell),
|
|
113
|
+
and returns `unavailable/provider-starting`, so the lexical route is used for
|
|
114
|
+
that prompt. Concurrent callers seeing a lock younger than 60 s do not spawn
|
|
115
|
+
again. The server verifies artifact hashes before `load_checkpoint`, writes its
|
|
116
|
+
state file atomically, then removes the lock. A startup failure writes a bounded
|
|
117
|
+
reason into the lock and exits; callers report `provider-unavailable` without
|
|
118
|
+
respawning until the lock is 60 s old. An executable that cannot be spawned at
|
|
119
|
+
all is detected synchronously (no child PID) and recorded as `spawn-failed` the
|
|
120
|
+
same way. The server exits after `idleTimeoutMs` without requests, on
|
|
121
|
+
`shutdown`, when either checkpoint file's size or modification time changes
|
|
122
|
+
(`artifact-changed`), or as soon as its state file no longer names its PID and
|
|
123
|
+
token (replaced, corrupted or deleted), so an undiscoverable server never
|
|
124
|
+
lingers as an orphan. It deletes only a state file that still names it.
|
|
125
|
+
|
|
126
|
+
**Files.** State and lock live beside the manifest as
|
|
127
|
+
`system-one-resident-<digest>.json` / `.starting`, where `<digest>` is the first
|
|
128
|
+
16 hex digits of SHA-256 of the parsed manifest re-serialized with `JSON.stringify`
|
|
129
|
+
(file key order). Editing the manifest
|
|
130
|
+
therefore selects a new server; the old one exits when idle. The state file has
|
|
131
|
+
exactly `schemaVersion: 1`, `pid`, `port`, `token` (64 hex), and `startedAt`, and
|
|
132
|
+
is created with mode 0600; on Windows the file instead receives an explicit
|
|
133
|
+
DACL with inheritance removed and a single full-control entry for the current
|
|
134
|
+
user's SID before the token is written. The manifest directory must still be
|
|
135
|
+
writable only by that user: whoever can replace files there can redirect the
|
|
136
|
+
client, and whoever can edit the manifest chooses the executable.
|
|
137
|
+
|
|
138
|
+
**Protocol.** The server binds only `127.0.0.1` on an ephemeral port and handles
|
|
139
|
+
one request per connection: one newline-terminated JSON object of at most 2 MiB
|
|
140
|
+
with `token`, `op` (`score`, `ping`, `shutdown`) and, for `score`, a request with
|
|
141
|
+
the exact Phase 0 structure (fields, lowercase IDs, unique options, 2–256
|
|
142
|
+
options, 64-hex fingerprints). Connections are served concurrently, up to 64, each
|
|
143
|
+
with a 1 s read deadline; beyond that the reply is `busy`. Inference itself is
|
|
144
|
+
serialized, so a silent or slow client cannot delay other callers. Tokens are compared in constant time; a mismatch returns
|
|
145
|
+
`{ok: false, reason: "unauthorized"}`. `score` applies the same byte limits
|
|
146
|
+
(no truncation) and returns `{ok: true, response}` in the Phase 0 response
|
|
147
|
+
format, which Phase 0 validation still checks. Any other failure returns
|
|
148
|
+
`{ok: false, reason}` with a bounded code; no prompt, traceback, path or score is
|
|
149
|
+
echoed in errors. The server never executes actions and is not given a driver.
|
|
150
|
+
|
|
151
|
+
**Client.** The router API is synchronous, so the client performs one socket
|
|
152
|
+
round trip on a worker thread and waits with `Atomics.wait` (1000 ms deadline).
|
|
153
|
+
Results map to the existing reasons: timeout → `provider-timeout` (no respawn);
|
|
154
|
+
refused connection or dead PID → stale state removed and a new start
|
|
155
|
+
(`provider-starting`); `unauthorized` → `provider-unavailable`; any other
|
|
156
|
+
server-declined request → `provider-exit`; malformed replies → `provider-json`.
|
|
157
|
+
|
|
158
|
+
**Operators.** `node harness-everything/scripts/system-one/resident.js
|
|
159
|
+
start|status|stop <absolute manifest>` controls a server explicitly; `start`
|
|
160
|
+
waits up to 60 s for readiness. The evaluation CLI waits for readiness before
|
|
161
|
+
measuring, so resident runs are recorded with `coldStart: false`. The installer
|
|
162
|
+
writes `transport: "resident"`, verifies one resident score, and stops the server
|
|
163
|
+
it started. Repository tests use a stub scorer behind the real server/protocol
|
|
164
|
+
code; they prove the mechanism, not host survival of detached processes or model
|
|
165
|
+
quality. Those require retained evidence.
|
|
166
|
+
|
|
98
167
|
## Phase 2: tier integration and rollback
|
|
99
168
|
|
|
100
169
|
Set `HARNESS_SYSTEM_ONE_MODE=off|shadow|prefer` in the host environment. Default
|