Hand-patches to the protected runtime are silently discarded on upgrade, with no supported override

Aperta
#883 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript

Direzione di ricerca

Start with the runtime integrity code around nativeRuntimeVerified() and the packaged files node-services/dist/main.js, files.json, and verified.json. Trace how STEP_TIMEOUT_MS and MODEL_CALL_MAX_WAIT_MS are defined and where startup verification and upgrade downloads report failures. Done means configurable limits have documented defaults, verification errors identify the mismatched file and digests, and upgrade or override behavior is covered by tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The question

I had to patch the shipping runtime twice in two days to keep a local install working — once to fix wiki page rendering, once to raise two hard 5-minute model-call ceilings (see #881). Both times the fix worked, and both times I had to edit node-services/dist/main.js by hand.

Will these patches survive a version upgrade? From reading the integrity layer: no, and there is no supported alternative.

What the integrity check actually does

.simplexai-runtime/offline/ carries:

  • files.json — {schema: 1, target: "darwin-arm64", sourceCommit, sourceArchiveSha256, files: {<path>: {bytes, sha256}}}
  • verified.json — {"files": "<sha256 of files.json>"}

with four protected entries (web/static-host.mjs, web/dist/index.html, node-services/dist/main.js, node-services/dist/supervisor.js).

nativeRuntimeVerified() is effectively verifiedFor(dir) === manifest.sha256, so the two mechanisms are:

  1. every protected file must match its sha256 in files.json;
  2. verified.json must hash to the files.json it belongs to.

Editing dist/main.js therefore breaks (1) and the runtime refuses to start. I re-hashed the file, rewrote its entry in files.json (2-space JSON — a plain string replace on a minified form silently misses it), recomputed the files.json digest, and updated verified.json. That passes verification today, but the next upgrade re-downloads offline/ from sourceArchiveSha256 and my work is gone — and because the edit is unversioned, nothing in the UI or logs tells the user their install is now diverging from the release.

Why this matters more than it sounds

The two things I patched are both cases where a local install cannot work without a code change:

  • A rendering bug in renderWikiPage produced broken wiki pages for every published generation. No config could work around it.
  • Two constants — STEP_TIMEOUT_MS = 5 * 60_000 and MODEL_CALL_MAX_WAIT_MS = 3e5 — are not reachable from any config file or environment variable. When a day's evidence pack outgrows them, background reports stop existing with no user-visible error (#881).

So the only lever a user has today is to break the checksum, which is exactly what the checksum exists to prevent.

What I would ask for

  1. Say it out loud. If hand-patches are unsupported and wiped on upgrade, the verification failure should name the file and the expected/actual digest, and the UI should show "this install has local modifications" rather than a generic startup failure.
  2. A supported override for the limits. Timeouts, retry counts and evidence-pack size are operational tunables, not security boundaries — they belong in config (with the defaults above), not in compiled constants.
  3. A local overlay, if a real code fix is ever needed. Something like offline/local-overrides/ that is checked in addition to the manifest rather than instead of it, so a user can carry a fix through an upgrade and a maintainer can ask for it verbatim in a bug report.
  4. A visible upgrade path for patches. If a patched install upgrades, at minimum log which protected files differed and were replaced, so the user knows what they lost.

Reproducing the current state

D=~/.simplexai/desktop/source/<sourceCommit>/.simplexai-runtime/offline
python3 - <<'PY'
import hashlib, json, os
d = os.environ['D']
m = json.load(open(f'{d}/files.json'))
for p, e in m['files'].items():
    actual = hashlib.sha256(open(f'{d}/{p}','rb').read()).hexdigest()
    print(p, 'OK' if actual == e['sha256'] else 'MODIFIED', actual[:16])
print('manifest sha256', hashlib.sha256(open(f'{d}/files.json','rb').read()).hexdigest()[:16])
print('verified.json  ', open(f'{d}/verified.json').read())
PY

Run it on a clean install and after any local edit; the difference is the state I am describing.

Environment

macOS darwin-arm64, runtime sourceCommit 43c02e4bf47ab271a4881a00906e4fabc49fc6ec, node v26.5.0. Related: #881 (the two 5-minute gates and the stuck scheduler).

Lingua principale
TypeScript
Stelle
3.8k
Fork
360
Merge medio
8h 10m
PR unite (30g)
540

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di simplexai-labs/linger

Tutte le issue di simplexai-labs/linger

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.