Address Cody review round 2: all ten findings (CODY-001 to CODY-010)
CODY-001 Bridge URL must be HTTPS (HTTP only to loopback), in the client and
in manifest generation.
CODY-002 Even host calls stay serialised until the SDK call really settles;
a microphone start that completes after its timeout is followed by
a stop.
CODY-003 Request id is stored before the first submit and cleared only on a
definitive answer; lost replies are treated as ambiguous and
reconciled under the same id; HUD no longer claims "not sent".
CODY-004 Revoking a device cancels its in-flight turns, aborts
transcription and asks Hermes to stop, from HTTP and CLI paths.
CODY-005 Speech model pinned to a commit with per-file SHA-256; fetched and
verified ahead of time; verified on every load; never downloaded
at run time; no unpinned configuration.
CODY-006 State directory 0700, database/WAL/SHM 0600 regardless of umask.
CODY-007 credential_expired handled like unauthorized on every path.
CODY-008 Approval wait start and paused agent deadline persisted and
restored across restarts (schema v2).
CODY-009 Exactly one conversation create per epoch, sent in sequence, with
stale results dropped before persistence.
CODY-010 Wrong pairing guesses no longer consume the outstanding code;
failures are indistinguishable.
Checks: typecheck clean; npm test 182 passed; client build ok;
test:real-stt 11 passed (including with no network); test:real-hermes 9
passed; test:simulator 6 passed; git diff --check clean.
Not reviewed. No physical-device, droplet or production evidence.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import { ConfigError, loadConfig } from './config.ts';
|
||||
import { openDb } from './db.ts';
|
||||
import { Devices } from './devices.ts';
|
||||
import { loadEnvFile } from './env.ts';
|
||||
import { fetchModel, verifyModel } from './stt/modelStore.mjs';
|
||||
|
||||
/**
|
||||
* Operator CLI. It talks to the SQLite file directly, so there is no admin
|
||||
@@ -15,17 +16,45 @@ function usage(): never {
|
||||
' pair Print a single-use pairing code for one new device',
|
||||
' devices List paired devices',
|
||||
' revoke <device-id> Revoke a device credential immediately',
|
||||
' fetch-model Download the pinned speech model and verify every file',
|
||||
' verify-model Check the speech model on disk against its pinned hashes',
|
||||
].join('\n'),
|
||||
);
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
function main(): void {
|
||||
async function main(): Promise<void> {
|
||||
loadEnvFile();
|
||||
const config = loadConfig();
|
||||
const [command, arg] = process.argv.slice(2);
|
||||
|
||||
// Model commands run at deploy time, possibly as a different user from the service, and
|
||||
// must not create or touch the database.
|
||||
if (command === 'fetch-model' || command === 'verify-model') {
|
||||
const manifest = config.stt.manifest;
|
||||
if (!manifest) {
|
||||
console.log('STT_PROVIDER is not "builtin": there is no speech model to manage.');
|
||||
return;
|
||||
}
|
||||
console.log(`${manifest.model} at ${manifest.revision} (${manifest.dtype}) in ${config.stt.modelDir}`);
|
||||
if (command === 'fetch-model') {
|
||||
const result = await fetchModel(config.stt.modelDir, manifest, {
|
||||
onFile: (path, bytes) => console.log(` fetched ${path} (${bytes} bytes)`),
|
||||
});
|
||||
console.log(`Verified ${result.verified} file(s); downloaded ${result.downloaded}.`);
|
||||
return;
|
||||
}
|
||||
const check = await verifyModel(config.stt.modelDir, manifest);
|
||||
if (!check.ok) {
|
||||
console.error(`Verification FAILED: ${check.reason} ${check.path}`);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`Verified ${manifest.files.length} file(s).`);
|
||||
return;
|
||||
}
|
||||
|
||||
const db = openDb(config.dbPath);
|
||||
const devices = new Devices(db, config);
|
||||
const [command, arg] = process.argv.slice(2);
|
||||
|
||||
switch (command) {
|
||||
case 'pair': {
|
||||
@@ -62,9 +91,7 @@ function main(): void {
|
||||
db.close();
|
||||
}
|
||||
|
||||
try {
|
||||
main();
|
||||
} catch (err) {
|
||||
console.error(err instanceof ConfigError ? `Configuration error: ${err.message}` : err);
|
||||
main().catch((err: unknown) => {
|
||||
console.error(err instanceof ConfigError ? `Configuration error: ${err.message}` : err instanceof Error ? err.message : err);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user